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

Periodic current spikes on sleep

I'm measuring the current of the following code:

int main( void )
{
 while( 1 )
 {
 __SEV();
 __WFE();
 __WFE();
 }
}

I'm not using softdevices.

I have nothing more connected to the board than the power.

I measure about 0.320 uA which is good, I think... but I got periodic 100uA current spikes every 70ms which gives the average of 0.861 uA

Is it expected?

  • It might be about skipping .. since you didn't enable the DCDC the LDO is the default:

    "Refresh mode is not the same as DCDC. The refresh mode is only in use when the device is on it's lowest power state and barely "kept alive". The way it works is that you have a capacitor that is charged quickly with a short pulse. The regulator senses the voltage on the cap and gives another pulse when the voltage drops below the threshold. This gives quite a lot of ripple on the regulator output but that doesn't matter as none of the power critical parts are on anyway. So you sacrifice ripple and load regulation for better efficiency."

    Have a look at this thread: low-power-pulses

    This is slightly unusual behaviour for an LDO regulator; I wasn't expecting it either but it is beneficial in terms of overall battery life

  • I understand, thanks!
    However, I've now added RTC to wakeup from sleep, and the frequency of the spikes increased, so it gets one 100uA spike every 8ms .. 10ms.
    That gives me an average current of 5.7uA, that is much more than the 1.5uA from the datasheet (1.5uA)for RTC enabled.
    I'm using 3.3V and internal LFRC
    Any idea what is giving me higher current?

  • Well .. two things; first running any additional code means that capacitor on the LDO discharges quicker so pulse rate increases and second .. hmm, you might not want this but:

    Try replacing the WFE stuff you have with this:

        // Errata 220: CPU: RAM is not ready when written - Disable IRQ while using WFE
        // Symptoms - Memory is not written in the first cycle after wake-up
        // Consequences - The address of the next instruction is not written to the stack. In stack frame, the link register is corrupted
        // Workaround
        // ==========
        // Enable SEVONPEND to disable interrupts so the internal events that generate the interrupt cause wakeuup in __WFE context and not in interrupt context
        // Before: ENABLE_WAKEUP_SOURCE -> __WFE -> WAKEUP_SOURCE_ISR -> CONTINUE_FROM_ISR  next line of __WFE
        // After:  ENABLE_WAKEUP_SOURCE -> SEVONPEND -> DISABLE_INTERRUPTS -> __WFE -> WAKEUP inside __WFE -> ENABLE_interrupts -> WAKEUP_SOURCE_ISR
        // Applications must not modify the SEVONPEND flag in the SCR register when running in priority levels higher than 6 (priority level numerical
        // values lower than 6) as this can lead to undefined behavior with SoftDevice enabled
        //
        // Errata 75: MWU: Increased current consumption
        // This has to be handled by turning off MWU but it is used in SoftDevice
        // see https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52832_EngB%2FERR%2FnRF52832%2FEngineeringB%2Flatest%2Fanomaly_832_75.html
        //
        // Errata 220: Enable SEVONPEND
        SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
        __disable_irq();
        // Errata 75: MWU Disable
        uint32_t MWU_AccessWatchMask = NRF_MWU->REGIONEN & MWU_ACCESS_WATCH_MASK;
        // Handle MNU if any areas are enabled
        if (MWU_AccessWatchMask)
        {
            NRF_MWU->REGIONENCLR = MWU_AccessWatchMask; // Disable write access watch in region[0] and PREGION[0]
            __WFE();
            __NOP(); __NOP(); __NOP(); __NOP();
            // Errata 75: MWU Enable
            NRF_MWU->REGIONENSET = MWU_AccessWatchMask;
        }
        else
        {
            __WFE();
            __NOP(); __NOP(); __NOP(); __NOP();
        }
        __enable_irq();
    

    One assumes nothing is connected to any of the output pins? And yes I know you are not setting them in main() above. What type of capacitors are on the board?

  • I tried it but it looks to be to other nRF52 version? this one does not has NRF_MWU
    Mine is nRF52810 using a module from Nordicsemi's 3rd part list. I have nothing more conected.

    I tried some lines from your code, except what was inside the MWU_AccessWatchMask

    This 5.8uA average I'm getting, are just because I enabled the lfclk by calling the nrfx_clock_lfclk_start

    I just found something, if I call this function
    nrfx_clock_lfclk_start();  <- this consumes 5.8uA average

    if instead I call this function to active the LFCLK 
    nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART); <-- this works and only consumes 1.48uA average, so, match the datasheet

    The problem is on nrfx_clock_lfclk_start why?!Slight smile

Related