Skip to content

NCS36510 hard fault when entering deep sleep #5065

Closed
@c1728p9

Description

@c1728p9

In certain configurations the NCS36510 crashes with a hard fault when entering deep sleep mode with interrupts disabled. When single stepping through the same code with a debugger a crash does not occur. Additionally adding breakpoints after the WFI instruction makes the crash go away, but may not be a robust solution.

Example program which can reproduce the crash (needs to be build with IAR - mbed compile -t IAR -m NCS36510 --profile debug) :

#include "mbed.h"

DigitalOut led1(LED1);
LowPowerTicker ticker;

void blink()
{
    led1 = !led1;
}

#define ENABLE          (uint8_t)0x01
#define DISABLE         (uint8_t)0x00
#define MAC_LUT_SIZE    (uint8_t)96


void test_sleep()
{
    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
    PMUREG->CONTROL.BITS.ENCOMA = DISABLE;

    /** Enter into deep sleep mode */
    __ISB();
    __WFI();
    // Uncomment the below two lines to fix the hardfault
    //__NOP();
    //__NOP();

    /** Wait for the external 32MHz to be power-ed up & running
     * Re-power down the 32MHz internal osc
     */
    while (!CLOCKREG->CSR.BITS.XTAL32M);
    PMUREG->CONTROL.BITS.INT32M = 1;
}

void test_func()
{
    test_sleep();
}

int main() {
    ticker.attach_us(blink, 500 * 1000);

    printf("Running test\r\n");
    core_util_critical_section_enter();
    test_func();
    core_util_critical_section_exit();
    printf("Test completed\r\n");
}

Hex and elf files build at mbed-os revision e12f116 with above program can be found here:
ncs32510_files.zip

IAR version used to build:
IAR Embedded Workbench for ARM - 7.80.4.12495
IAR Embedded Workbench shared components - 7.5.6.4719

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions