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

sd_power_system_off causes a 'soft reset' thus immediate wakeup.

I am seemingly haunted by spurious 'soft resets' I cannot seem to find a good explanation.

I have an application that is to be dormant until activated. When waking up I do my stuff and after time out I want to return to sleep so I configure a GPIO to wake up the system and call 'sd_power_system_off()'.

On wake-up I check it the activation GPIO is active before start BLE Adv. If not in activate I go back to sleep. This happens when the system is powered up.

The 'sleep_mode_enter()' call in many builds result in a soft reset - the RESETREAS register containd 0x4 i.e. SREQ.

FLASHing the device will put it in to a mode where it cycles through a wakeup, see that it is not activated try to go to sleep only to get 'soft reset'. If I switch off the device after FLASHing it does not do that.

Well some builds always do soft reset instead of sleep some don't and the difference can be as little as the time out period (there is a 20 minutes time out I like to shorten for debug). Or some times it works one way on GCC builds and the other way on Keil builds.

Acording to nRF52832 - Product Specification v1.0 this can only happen by writing the AIRCR or CTRL-AP registers.

nRF5_SDK_11.0.0_89a8197, nrf52832_xxaa_s132, pca10040.

Related