nrf5340 - How to make a clean software reset

Hi there,

We are developping a project on a nRF5340 and we have to make a software reset to restart the device under critical use case. To do so, we use NVIC_SystemReset()...

When each thread is started, we initialize all variables that are not in the .noInit memory area, to make sure that an old value will not affect the software's operation.

Occasionally, however, the nrf5340 does not restart correctly. Power consumption is high (~3mA).

Has anyone ever encountered this problem?

Hope somebody could help us...
Regards
Patrice

Parents
  • Hi,

    Oh, Hakon, I'm sorry, I forgot to press the "reply" button when I wanted to reply...

    I'm using both nRF5340_dk and a custom board...

    But in the meantime, I've found the solution to the problem by searching the DevZone ;-)
    The solution involves forcing the network core to OFF, then restarting it ... The code is below.

    		// errata - Tested this workaround. Be aware of the register address:
    		// - 0x50005000 for secure firmware
    		// - 0x40005000 for non-secure firmware
    		*(volatile uint32_t *) 0x40005618ul = 1ul;
    		NRF_RESET->NETWORK.FORCEOFF = (RESET_NETWORK_FORCEOFF_FORCEOFF_Release << RESET_NETWORK_FORCEOFF_FORCEOFF_Pos);
    		k_msleep(5); // Wait for at least five microseconds
    		NRF_RESET->NETWORK.FORCEOFF = (RESET_NETWORK_FORCEOFF_FORCEOFF_Hold << RESET_NETWORK_FORCEOFF_FORCEOFF_Pos);
    		k_msleep(1); // Wait for at least one microsecond
    		NRF_RESET->NETWORK.FORCEOFF = (RESET_NETWORK_FORCEOFF_FORCEOFF_Release << RESET_NETWORK_FORCEOFF_FORCEOFF_Pos);
    		*(volatile uint32_t *) 0x40005618ul = 0ul;
    

    Since this addition to my code, the software reset works all the time.

Reply Children
No Data
Related