nRF52840: How do I read the "Event Register"?

nRF52840, SDK 17.0.2, SD140 v7.0.1

My firmware application is happily sleeping via calls to nrf_pwr_mgmt_run(), waking up to service interrupts and do work, then going to back to sleep.

Sometimes, something happens shortly after a BLE central connects to my device- for some reason, my calls to nrf_pwr_mgmt_run() immediately return, and the nRF52840 spins in the main loop instead of sleeping. This causes a large amount of energy from the battery to be wasted doing nothing, and the product does not last as long.

I'm trying to trace down the source of what's immediately waking the nRF52840 back up, so I can fix it.

I would like to know if SoftDevice is constantly waking up my application, or if I'm calling something like app_timer_start / app_timer_stop that fires a software interrupt, which sets the event flag.

For logging purposes, how do I read the "Event Register" that WFE and SEV operate on? I don't want to set it, but I do want to read it. If it's set before I call into nrf_pwr_mgmt_run(), then I know it's something I did in my loop.

Thanks,

Charles Nicholson

Related