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

Current consumptio measurement while device is in System Off mode gives very unusual results

Dear All,

I am trying to measure the current consumption for an application I am developing on the nRF52833 DK.

The code that I am running is the following:

int main(void)
{
    // Configure UICR_REGOUT0 register only if it is set to default value.
    if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) != (UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos)) {
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}

        NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) | (UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos);

        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}

        // System reset is needed to update UICR registers.
        NVIC_SystemReset();
    }

#if defined(CONFIG_NFCT_PINS_AS_GPIOS)
    if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)) {
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; // Write Enable
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
        NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; // Read-only Enable
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
        // UICR changes require a reset to be effective
        NVIC_SystemReset();
    }
#endif
    bool erase_bonds;

    // Initialize.
    lfclk_config();
    log_init();
    timers_init();
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();
    peer_manager_init();
    flash_init();
    gpio_init();
    initialize_leds();
    wdt_init(WATCHDOG_TIMEOUT);
    sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
    sd_power_mode_set(NRF_POWER_MODE_LOWPWR);

    sleep_mode_enter();
}


static void sleep_mode_enter(void)
{
    ret_code_t err_code;

    // Go to system-off mode (this function will not return; wakeup will cause a reset).
    err_code = sd_power_system_off();
    APP_ERROR_CHECK(err_code);
}


Based on the product specification, I should be measuring something like 0.6uA (link).

Instead what I am measuring, using the Nordic PPK is 0.2uA. So I am really puzzled whether the measurement is accurate or not and what am I missing.

In order to perform the measurement, I prepared the DK, by cutting the SB40 trace and I set the 2 switches of the PPK to the DK.

So the question is why do I measure completely different values than the ones expected?

  • Hi,

    The PPK is only specified between 1 uA and 70 mA. Measurement of currents below 1 uA may give incorrect readings. Note that the accuracy is also +/- 20% in this range. There may also be small leakage currents to the Segger debugger power domain on the DK, which will impact the measurements of such low currents.

    Best regards,
    Jørgen

  • Hi ,

    I believe that I had some issues with my code previously (mostly pin assignments that were reserved by the DK for NFC and such). At the moment I am running this code:

    static void sleep_mode_enter(void)
    {
        ret_code_t err_code;
    
        sd_ble_gap_adv_stop(NULL);
        // Go to system-off mode (this function will not return; wakeup will cause a reset).
        err_code = sd_power_system_off();
        APP_ERROR_CHECK(err_code);
    }
    
    
    int main(void)
    {
        // Configure UICR_REGOUT0 register only if it is set to default value.
        if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) != (UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos)) {
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
    
            NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) | (UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos);
    
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
    
            // System reset is needed to update UICR registers.
            NVIC_SystemReset();
        }
    
    #if defined(CONFIG_NFCT_PINS_AS_GPIOS)
        if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)) {
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; // Write Enable
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
            NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; // Read-only Enable
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
            // UICR changes require a reset to be effective
            NVIC_SystemReset();
        }
    #endif
        bool erase_bonds;
        sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
        // Initialize.
        lfclk_config();
        rtc_config();
        log_init();
        timers_init();
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
        peer_manager_init();
        flash_init();
        gpio_init();
        initialize_leds();
        wdt_init(WATCHDOG_TIMEOUT);
        set_color(ORANGE);
        nrf_gpio_pin_clear(NTC_FEED_PIN);
    
        uint32_t reset_reason = get_reset_reason();
    
        advertising_start(erase_bonds);
        app_timer_start(sleep_id, SYSTEM_OFF_TIMEOUT, NULL);
    
        // Enter main loop.
        for (;;) {
            idle_state_handle();
        }
    }


    And what I am measuring after the time-out is about 2uA on PPK.

    I have also a custom board that I can feed power to via an OTII and do my measurements there, but my issue is that I am not sure if the custom board works well, so I wonder if it is possible to have a baseline sample code that has a known low current consumption that I can put on the DK, measure it and then put it on the custom board and compare the results.

    On the custom board the same code consumes, according to the OTII 49.8uA. VDD and VDDH of the schematic are connected externaly.

    This is the compiled hex: sample.hex

    I am using softdevice s113_nrf52_7.0.1_softdevice.hex

    Could you perhaps provide me with a sample code that has a known current consumption in order to use on the DK and my custom board to compare the 2?

  • This hex-file will enter SYSTEM OFF sleep mode after a delay of 10 seconds. I did not measure the current, only verified that System OFF mode is entered after 10 seconds.

    1122.systemoff_enter_pca10100.hex

Related