I have problem with wakeup of Low Power Node from System ON sleep mode. In debug session code works as expected, however outside the session something gets wrong.
The node is put to sleep in infinite loop of main using sd_app_evt_wait() function (after that function application code is placed).
Several wakeup sources are set - GPIO, RTC and APP_Timer. When GPIO is triggered, power consumption rises corresponding to MCU active state, however code after the sd_app_evt_wait is not processed properly (it looks like code after the sleep function is skipped).
GPIO is configured to be used with GPIOTE, code of initialization below:
err_code = nrfx_gpiote_init(); APP_ERROR_CHECK(err_code); nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true); in_config.pull = NRF_GPIO_PIN_NOPULL; err_code = nrf_drv_gpiote_in_init(BUTTON_PIN, &in_config, in_pin_handler); APP_ERROR_CHECK(err_code); nrf_drv_gpiote_in_event_enable(BUTTON_PIN, true);
Pin is pulled low with external pull-down, and in_pin_handler is called (checked by lighting up the led). Handler checks the pin state and starts polling timer. Code in main checks for polling result (state of the button). However outside the debug session changes in button state are rarely detected. Button is debounced during polling and that part looks working fine.
Build configuration set same for debugger and no-debugger. I assume that problem relies in sd_app_evt_wait call as in debugger session MCU is always active?