While using a nrf52832 the softdevice/BLE power usage is way higher than expected.
The following tests were done using the ble_bas_peripheral example on an nrf52832.
- Power usage before activating the softdevice: single digit uA, as expected
- Power usage after acting the softdevice (Softdevice::enable), while idle (no BLE): 800 uA. This is unexpected, activating the softdevice without starting BLE shouldn't increase the power draw.
This could be caused by Errata 75 (MWU isn't shut down properly), or a running HF Oscillator (similar Arduino problem: adafruit/Adafruit_nRF52_Arduino#165 (comment))
In theory, this should be fixed by using sd_app_evt_wait instead of wfe.
When I replace https://github.com/embassy-rs/embassy/blob/1e25b2e3a2b3817f5418ee451a3991a044d09a4b/embassy-executor/src/arch/cortex_m.rs#L106 with a call to sd_app_evt_wait (asm!("svc 65", lateout("r0") _, lateout("r1") _, lateout("r2") _, lateout("r3") _, lateout("r12") _, );), the power usage is fixed.
This fix creates a new problem: The future returned by gatt_server::run is completed only on the next unrelated wakeup after disconnection. Inside the portal which handles the BLE events, signal.signal is called
, but signal.await()
is only executed on the next unrelated wakeup.
Do you have any ideas on how to fix this?
While using a nrf52832 the softdevice/BLE power usage is way higher than expected.
The following tests were done using the ble_bas_peripheral example on an nrf52832.
This could be caused by Errata 75 (MWU isn't shut down properly), or a running HF Oscillator (similar Arduino problem: adafruit/Adafruit_nRF52_Arduino#165 (comment))
In theory, this should be fixed by using
sd_app_evt_waitinstead ofwfe.When I replace https://github.com/embassy-rs/embassy/blob/1e25b2e3a2b3817f5418ee451a3991a044d09a4b/embassy-executor/src/arch/cortex_m.rs#L106 with a call to
sd_app_evt_wait(asm!("svc 65", lateout("r0") _, lateout("r1") _, lateout("r2") _, lateout("r3") _, lateout("r12") _, );), the power usage is fixed.This fix creates a new problem: The future returned by gatt_server::run is completed only on the next unrelated wakeup after disconnection. Inside the portal which handles the BLE events,
signal.signalis callednrf-softdevice/nrf-softdevice/src/util/portal.rs
Line 139 in 5949a5b
nrf-softdevice/nrf-softdevice/src/util/portal.rs
Line 153 in 5949a5b
Do you have any ideas on how to fix this?