I am having an issue where ONLY in release mode.
When charging the device through the USB port, if it is unplugged I want to put the device into sleep mode. Following this the device becomes unresponsive - the power button doesn't work and the only way to get it to wake is by a pin reset.
In debugging I notice that when I call the following function, the log message "Shouldn't get here..." is shown, suggesting the device doesn't shut down immediately on "sd_power_system_off". Why is that? Is the shutdown somehow scheduled through the softdevice?
// NOTE Shutdown handler - called from scheduler to allow shutdown from main context.
static void _shutdown_handler(void * p_event_data, uint16_t event_size)
{
// Flush messages:
NRF_LOG_FLUSH();
// Switch off:
sd_power_system_off();
NRF_LOG_INFO("Shouldnt get here..");
NRF_LOG_FLUSH();
}
NRF52840, SDK17.0.2, SD S340