Hi,
I put my NRF52 to sleep (POWER OFF mode) and configure it to wake on GPIO port event like so:
//set up reed switch to wake up from System Off nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false); in_config.pull = NRF_GPIO_PIN_NOPULL; //hardware pull up resistor. err_code = nrf_drv_gpiote_in_init(REED_SWITCH_PIN, &in_config, wake_handler); APP_ERROR_CHECK(err_code); nrf_drv_gpiote_in_event_enable(REED_SWITCH_PIN, true); SEGGER_RTT_printf(0, "Powering Down!\r\n"); sd_power_system_off();
This GPIO is set up on a reed switch. Occasionally, the NRF52 will try to sleep whilst the magnet is resting next to the reed switch. I.e REED_SWITCH_PIN is at a steady state low.
Problem:
- When REED_SWITCH_PIN is a steady state low, the interrupt fires straight away and wakes up my sensor unexpectedly.
- From reading the documentation I would expect that the PORT event can detect an edge change? Is this true, or am I seeing something weird?
I do have a work around which involves using a GPIOTE in event, and sending the device into System-on sleep mode, however power consumption is obviously higher - so not ideal.