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

Call to sd_softdevice_disable() causes current increase

nRF52832-QFAA-0E, S132

With DCDC, UART and SoftDeivce enabled my ammeter shows 1.3 mA, but when app calls sd_softdevice_disable() current actually increases to ~4 mA

The test sequence is the following:

sd_softdevice_disable();
NRF_P0->LATCH = -1;
for(int i = 10000000; i && NRF_P0->LATCH == 0; --i) nrf_pwr_mgmt_run();

I expected current to decrease. What could be wrong?

  • I think the problem here is what happens in your code after you disable the softdevice. The nrf_pwr_mgmt_run() function is checking whether the softdevice is running or not. It is checking using the SDK softdevice-handler library: nrf_sdh_is_enabled(). If you disable the softdevice with sd_softdevice_disable() you are using the SD API directly, bypassing the SDK library, and it thinks the SD is still running, leading to the wrong sleep functions being used.

    Try to swap the nrf_pwr_mgmt_run() function with this loop:
        for(;;)__WFE();

    When that is said, there's not really any reason for the current consumption to go down when you disable the softdevice. Just enabeling the softdevice does not consume any current (except for the current consumed by the LF clock and RTC which must be running, which is about 1 µA).
    I'm pretty sure that the 1.3mA is consumed by the UARTE peripheral in RX mode.

  • I think I've found the cause:

    nrf_pwr_mgmt.c @ 357

        {
            // Wait for an event.
            __WFE();
            // Clear the internal event register.
            __SEV();
            __WFE();
        }
    

    This code does not enter sleep. As it was posted by some other users here, the right sequence is

        __SEV(); // Set the internal event register.
        __WFE(); // Clear the internal event register    
        __WFE(); // Actually wait for an event.
    

Related