Hello,
I'm working on a circuit which has a pin connected to a pull-up resistor, using the nRF52 DK and SEGGER Embedded Studio 5.20 to develop the software.
This pin is configured as output and it manages the power supply unit.
If a watchdog reset condition occurs, I would like this pin to behave like an high impedance input, so the logic status of the PSU is not affected.
This is the code I've written to test this condition:
int main(void) { int32_t reset_reason; reset_reason = NRF_POWER->RESETREAS; NRF_POWER->RESETREAS = NRF_POWER->RESETREAS; nrf_gpio_cfg_output(CLR_PIN_NUMBER); nrf_delay_ms(1); nrf_gpio_pin_set(CLR_PIN_NUMBER); wdt_init(); nrf_gpio_cfg_input(CLR_PIN_NUMBER, NRF_GPIO_PIN_NOPULL); nrf_delay_ms(1); while(true); }
Using an oscilloscope to monitor the circuit, I've seen that on a wdt reset the status of the pin CLR_PIN_NUMBER changes to 0, and this is not desirable because it shuts down the PSU.
If I instead use the following code, just removing the nrf_gpio_cfg_output line:
int main(void) { int32_t reset_reason; reset_reason = NRF_POWER->RESETREAS; NRF_POWER->RESETREAS = NRF_POWER->RESETREAS; nrf_gpio_pin_set(CLR_PIN_NUMBER); wdt_init(); nrf_gpio_cfg_input(CLR_PIN_NUMBER, NRF_GPIO_PIN_NOPULL); nrf_delay_ms(1); while(true); }
...the voltage of the pin remains on high status after the wdt reset, as desired.
I need some advice to correctly configure the pin to make it behave like an high impedance input and prevent the wdt reset to change its status.
Thanks in advance.