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

  • Hi,

    I'm using sdk15.3. Ok I understand, so to decrease the current, I have to find which event or advertisement prevent the CPU from sleeping. But I haven't found any events. I tried with cts example, but the current neved decreases when I'm connected.

    Thanks for your reply.

    Lydie

  • Ok, so when you print you're not using the nRF_LOG API? Or do you mean that you tested bot with log enabled and with logging disabled?

    If none of the event handlers below are called then I would check the peripherals that you are using in your application, i.e. see if any of the EVENTS_xxxx registers are set to 1 prior to calling sd_app_evt_wait().

    Best regards

    Bjørn

  • No I’m not using Log API. What do you mean by EVENTS_xxxx

  • Ok, so you are using the UART to print log statements? By EVENTS_xxxx I mean the EVENTS registers for each of the peripherals, e.g. the UART event registers listed here: UART Registers

    EVENTS_CTS 0x100

    CTS is activated (set low). Clear To Send.

    EVENTS_NCTS 0x104

    CTS is deactivated (set high). Not Clear To Send.

    EVENTS_RXDRDY 0x108

    Data received in RXD

    EVENTS_TXDRDY 0x11C

    Data sent from TXD

    EVENTS_ERROR 0x124

    Error detected

    EVENTS_RXTO 0x144

    Receiver timeout

    If any of these registers are set to 1, i.e. there is a pending event, then sd_app_evt_wait will return immediatly.

    Best regards

    Bjørn

  • Yes! Ok, and how can I know if any of EVENTS_xxxx are set to 1?

  • Well, you could print the values with the UART interface or monitor the registers of the peripherals in debug session.

Reply Children
Related