This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pin config maintained through reset? (NRF51)

Hi,

I am trying to maintain a single bit of information through a power-on reset event (sd_nvic_SystemReset();). I am trying to do this through the configuration of an unused I/O pin. I am setting the pin to be an output before the reset and then reading the pin-configuration after the reset:

nrf_gpio_cfg_output(23); //set pin 23 to output

sd_nvic_SystemReset();  // reset

//this appears after the reset:
SEGGER_RTT_printf(0, "pin_test = %d\n", NRF_GPIO->PIN_CNF[23]&0x01);  //print direction bit for pin 23

The output of this operation is always zero (I have printed the value of the direction before the reset and it is 1). Am I correct in my understanding that the pin configuration bits should be maintained through a power-on reset? Also, I am open to other methods of carrying 1 bit of information through a reset (I would prefer to avoid the gpregret register if possible, as it is already used for a bootloader with various options).

Thanks in advance, Dave

Related