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

Current consumption ble

Hi,

I'm using nrf52832 with s132, so I don't find any information about the current consumed by the device when I'm connected by Bluetooth. I use the driver st7735 and an LCD screen. When my phone is not connected by Bluetooth and my device sleep, the current is 0.43mA. When my phone is not connected, and the LCD screen is ON, the current is around 3.4mA. Until then, everything is normal. But when I'm connected and my device is sleeping, the current is 1.5mA, and if the screen is ON the current is 0.7mA. So I don't understand why the current is increased when I'm connected and when my device is sleeping? And why the current decrease when the screen displays something. On online power profiler, the power consumes when there is a connection but the device is asleep is not indicated, so I don't know if it is normal or not. 

Thanks,

Lydie

Parents
  • Hi Lydie, 

    which S132 version and SDK version are you using? 

    All the BLE examples in our nRF5 SDK will go to sleep when the CPU is idling, i.e. in between connection events and advertisment events. Our SoftDevice is 100% event driven so, whenever the nRF is in the main for() loop it will call idle_state_handle(), which in turn calls nrf_pwr_mgmt_run(), which in turn calls sd_app_evt_wait() or __WFE(). These functions will make the CPU sleep until there is an interrupt or event that wakes up the chip, i.e. a timer expiring or a BLE event like advertisment or a connection event. So as long as you're calling idle_state_handle() in the main for loop, the nRF should go to sleep in between connection events. 

    void nrf_pwr_mgmt_run(void)
    {
        PWR_MGMT_FPU_SLEEP_PREPARE();
        PWR_MGMT_SLEEP_LOCK_ACQUIRE();
        PWR_MGMT_CPU_USAGE_MONITOR_SECTION_ENTER();
        PWR_MGMT_DEBUG_PIN_SET();
    
        // Wait for an event.
    #ifdef SOFTDEVICE_PRESENT
        if (nrf_sdh_is_enabled())
        {
            ret_code_t ret_code = sd_app_evt_wait();
            ASSERT((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED));
            UNUSED_VARIABLE(ret_code);
        }
        else
    #endif // SOFTDEVICE_PRESENT
        {
            // Wait for an event.
            __WFE();
            // Clear the internal event register.
            __SEV();
            __WFE();
        }
    
        PWR_MGMT_DEBUG_PIN_CLEAR();
        PWR_MGMT_CPU_USAGE_MONITOR_SECTION_EXIT();
        PWR_MGMT_SLEEP_LOCK_RELEASE();
    }
    
    static void idle_state_handle(void)
    {
        if (NRF_LOG_PROCESS() == false)
        {
            nrf_pwr_mgmt_run();
        }
    }
    
    
    /**@brief Function for application main entry.
     */
    int main(void)
    {
        // Initialize.
        log_init();
        leds_init();
        timers_init();
        buttons_init();
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
        // Start execution.
        NRF_LOG_INFO("Blinky example started.");
        advertising_start();
    
        // Enter main loop.
        for (;;)
        {
            idle_state_handle();
        }
    }

    If its not going to sleep, then there must be a pending event/interrupt that keeps the CPU from sleeping, i.e. causes sd_app_evt_wait() or __WFE() to return immediately. 

    On online power profiler, the power consumes when there is a connection but the device is asleep is not indicated, so I don't know if it is normal or not. 

     The online power profiler will calculate the average current consumption with the assumption that the CPU goes to sleep inbetween connection and/or advertisment events. 

    Best regards

    Bjørn

Reply
  • Hi Lydie, 

    which S132 version and SDK version are you using? 

    All the BLE examples in our nRF5 SDK will go to sleep when the CPU is idling, i.e. in between connection events and advertisment events. Our SoftDevice is 100% event driven so, whenever the nRF is in the main for() loop it will call idle_state_handle(), which in turn calls nrf_pwr_mgmt_run(), which in turn calls sd_app_evt_wait() or __WFE(). These functions will make the CPU sleep until there is an interrupt or event that wakes up the chip, i.e. a timer expiring or a BLE event like advertisment or a connection event. So as long as you're calling idle_state_handle() in the main for loop, the nRF should go to sleep in between connection events. 

    void nrf_pwr_mgmt_run(void)
    {
        PWR_MGMT_FPU_SLEEP_PREPARE();
        PWR_MGMT_SLEEP_LOCK_ACQUIRE();
        PWR_MGMT_CPU_USAGE_MONITOR_SECTION_ENTER();
        PWR_MGMT_DEBUG_PIN_SET();
    
        // Wait for an event.
    #ifdef SOFTDEVICE_PRESENT
        if (nrf_sdh_is_enabled())
        {
            ret_code_t ret_code = sd_app_evt_wait();
            ASSERT((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED));
            UNUSED_VARIABLE(ret_code);
        }
        else
    #endif // SOFTDEVICE_PRESENT
        {
            // Wait for an event.
            __WFE();
            // Clear the internal event register.
            __SEV();
            __WFE();
        }
    
        PWR_MGMT_DEBUG_PIN_CLEAR();
        PWR_MGMT_CPU_USAGE_MONITOR_SECTION_EXIT();
        PWR_MGMT_SLEEP_LOCK_RELEASE();
    }
    
    static void idle_state_handle(void)
    {
        if (NRF_LOG_PROCESS() == false)
        {
            nrf_pwr_mgmt_run();
        }
    }
    
    
    /**@brief Function for application main entry.
     */
    int main(void)
    {
        // Initialize.
        log_init();
        leds_init();
        timers_init();
        buttons_init();
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
        // Start execution.
        NRF_LOG_INFO("Blinky example started.");
        advertising_start();
    
        // Enter main loop.
        for (;;)
        {
            idle_state_handle();
        }
    }

    If its not going to sleep, then there must be a pending event/interrupt that keeps the CPU from sleeping, i.e. causes sd_app_evt_wait() or __WFE() to return immediately. 

    On online power profiler, the power consumes when there is a connection but the device is asleep is not indicated, so I don't know if it is normal or not. 

     The online power profiler will calculate the average current consumption with the assumption that the CPU goes to sleep inbetween connection and/or advertisment events. 

    Best regards

    Bjørn

Children
Related