Reasons that RESETREAS is zero

Hello,

we faced sometimes the issue that the reset reason Register  RESETREAS is Zero at Startup. What does it tell me? So what happend in the Firmware that there is a reset "without reason". Normally we have a power reset and a reset from System off through GPIO, which is all nicely shown in the Register. 

Could it be that we have a crash or a Problem that an exception handler is called? But wouldn't a reset from exception handler not be visible in the reset Register (not tried yet)?

In "the old Atmel world" it could happen when the program counter jumps wrongly into the Memory area above my application. All those 0xFF where interpreted as NOPs until the end of the program area is reached so PC wraps over and the processor starts again from the beginning even there was no reset. But with NNRF5340 this cannot happen, Right? When PC reaches a not programmed Areas there is an exception. At least I have in mind that I observed this a longer time ago. Can someone confirm this?

Best regards
Erwin

Parents
  • Hi Erwin,

    The RESETREAS register is cleared by a power-on or a brown-out reset (see Application core reset behavior), so I would look at the supply voltage when this happens. For other reset reasons you will see the corresponding bit set in the RESETREAS (this will be the case after a reset from an exception handler).

    Yes, if trying to execute all FFs you will get an exception. Cortex CPUs does not interpret programmed memory as NOPs.

    Einar

  • Thanks for the fast and good answer.

    Just one question for confirmation: the reset pin is only connected to the debugger connection. There is no HW that pulls it externally to high. I assume that some internal logic in the processor assured that when I simply turn on the power supply the reset bit in the register is set. 

    As a consequence I can implement in my firmware: if the A bit is set it was a real power cut or better a switch on of the (external) power supply. When the whole register is 0 we really had a power drop, that lead to a brown out reset. By completely switching off the power supply (for at least a second) and switching on again, I see bit A set.

    Erwin

  • Hi Erwin,

    The reset pin has an internal pull-up, so it is not needed to pull it up externally.

    What you describe is sensible, and is a major reason for having the RESETREAS (the ability to act differently based on what triggered the reset).

    If bit A is set in RESETREAS, then there has been a pin reset. You should not get this set after a power-cycle like you describe. You can test this simply with this modified hello world sample on a nRF5340 DK, built for the app core:

    #include <zephyr/zephyr.h>
    #include <helpers/nrfx_reset_reason.h>
    
    void main(void)
    {
    	uint32_t reason;
    
    	reason = nrfx_reset_reason_get();
    
    	while (true)
    	{
    		printk("RESETREAS: 0x%08x\n", reason);
    		k_sleep(K_SECONDS(2));
    	}
    }

    If you press the reset button on the DK, you will see that bit A (the least significant bit) is set. If you power-cycle the DK, you will see that all bits are 0.

Reply
  • Hi Erwin,

    The reset pin has an internal pull-up, so it is not needed to pull it up externally.

    What you describe is sensible, and is a major reason for having the RESETREAS (the ability to act differently based on what triggered the reset).

    If bit A is set in RESETREAS, then there has been a pin reset. You should not get this set after a power-cycle like you describe. You can test this simply with this modified hello world sample on a nRF5340 DK, built for the app core:

    #include <zephyr/zephyr.h>
    #include <helpers/nrfx_reset_reason.h>
    
    void main(void)
    {
    	uint32_t reason;
    
    	reason = nrfx_reset_reason_get();
    
    	while (true)
    	{
    		printk("RESETREAS: 0x%08x\n", reason);
    		k_sleep(K_SECONDS(2));
    	}
    }

    If you press the reset button on the DK, you will see that bit A (the least significant bit) is set. If you power-cycle the DK, you will see that all bits are 0.

Children
No Data
Related