Go Down

Topic: Detect if nano33 ble was reset or powered on (Read 65 times) previous topic - next topic

Micromouse-me-uk

Detect if nano33 ble was reset or powered on

I need to detect if the board was reset using the reset switch or from applying the power, you should be able to do this by using NRF_POWER->RESETREAS but its always returns 1 even after a power reset(could be its changed by the bootloader detecting doble reset presses), I have also tried using the  __attribute__ ((section (".noinit"))) on some variables but this seems not to work, it always initializes them to 0.
Thanks for any help

Code: [Select]
uint32_t resetit = NRF_POWER->RESETREAS;

volatile uint32_t reset1 __attribute__( (section (".noinit")));
volatile uint32_t reset2 __attribute__ ((section (".noinit")));
volatile uint32_t reset3 __attribute__ ((section (".noinit")));

serial.println(resetit);
serial.println(reset1);
serial.println(reset2);
serial.println(reset3);

reset1 = 987654; rteset2 = 2092; reset3 = -8964198;


output is

1
0
0
0

after a reset or power on
If you are intrested in what I do with Arduino and other boards have a look here.
https://www.youtube.com/micromouse

Go Up