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

UART current consumption

Hello,

I developed an application for a custom nrf52832 board. It uses the Nordic UART Service (NUS) to transmit data over BLE. This works fine.

At the moment I am trying to optimize the current consumtion of this application on the custom nrf52832 board. I have already made some measurements and I figured out the following:

If I initialize the UART by calling the uart_init() function, my current consumption increases by 1,35mA (V_cc = 1.8V). This looks a bit too high for me.

Can you please answer my following questions:

1. Is this the normal current consumption of the UART?

2. Are there any ways to lower the current consumption of the UART?

Thank you very much in advance.

Parents
  • Hi,

    1. Is this the normal current consumption of the UART?

    This depends a bit on which UART are used. Both the UART and the UARTE peripherals has a run current of 55 uA, but in addition, both requires the HFCLK to run, which is about 400 uA. The UARTE peripheral also adds the EasyDMA current of about 1.2 mA to the current, when the UART is active. These are numbers for 3.0V supply, I would expect them to be higher at 1.8V.

    2. Are there any ways to lower the current consumption of the UART?

    You can try to for the UART library to use the legacy UART peripheral, by setting the following configs in your sdk_config.h file:

    #ifndef UART_LEGACY_SUPPORT
    #define UART_LEGACY_SUPPORT 0
    #endif
    
    
    #ifndef UART0_CONFIG_USE_EASY_DMA
    #define UART0_CONFIG_USE_EASY_DMA 0
    #endif

    With these configs, I measure about 450 uA base current.

    Another option is to disable the RX part of the UART if you do not need this in your application. We have implemented this in NRF_LOG, and I measure 4 uA base current with this, as the UART peripheral is only active when a TX operation is happening. Since UART is asynchronous, there is no way to achieve this for RX, except having RX enabled at all times, or use additional control-signals to notify the chip in advance that a transfer will happen, to make it enable the RX mode.

    Best regards,
    Jørgen

Reply
  • Hi,

    1. Is this the normal current consumption of the UART?

    This depends a bit on which UART are used. Both the UART and the UARTE peripherals has a run current of 55 uA, but in addition, both requires the HFCLK to run, which is about 400 uA. The UARTE peripheral also adds the EasyDMA current of about 1.2 mA to the current, when the UART is active. These are numbers for 3.0V supply, I would expect them to be higher at 1.8V.

    2. Are there any ways to lower the current consumption of the UART?

    You can try to for the UART library to use the legacy UART peripheral, by setting the following configs in your sdk_config.h file:

    #ifndef UART_LEGACY_SUPPORT
    #define UART_LEGACY_SUPPORT 0
    #endif
    
    
    #ifndef UART0_CONFIG_USE_EASY_DMA
    #define UART0_CONFIG_USE_EASY_DMA 0
    #endif

    With these configs, I measure about 450 uA base current.

    Another option is to disable the RX part of the UART if you do not need this in your application. We have implemented this in NRF_LOG, and I measure 4 uA base current with this, as the UART peripheral is only active when a TX operation is happening. Since UART is asynchronous, there is no way to achieve this for RX, except having RX enabled at all times, or use additional control-signals to notify the chip in advance that a transfer will happen, to make it enable the RX mode.

    Best regards,
    Jørgen

Children
  • Hello,

    thank you very much for your response.

    With these configs, I measure about 450 uA base current.

    I applied these changes to my sdk_config.h in my project, unfortunaly the current consumption is still at 1.35mA. Did you made more changes in the sdk_config.h?

    Another option is to disable the RX part of the UART

    I don´t need the RX part of the UART for my application. Where can I find this implementation for disabling the RX part of the UART in NRF_LOG?

    Thank you very much in advance.

  • I did my testing with ble_app_uart from SDK 17.0.2 on a nRF52 DK (PCA10040).

    Starting with unmodified example, I measure this current (1.875 mA):

    By adding the two changes to the sdk_config.h file I posted in my previous post (458 uA):

    Without adding the two previous changes, but setting the RX pin to UART_PIN_DISCONNECTED in comm_params passed to APP_UART_FIFO_INIT, the current is reduced to ~4 uA:

    Best regards,
    Jørgen

  • Hello,

    thank you very much for your response.

    I was able to disable the RX part of the UART by setting the RX pin to UART_PIN_DISCONNECTED. After I call the uart_init() function my increase in current consumption is far lower than 1.35mA.

    However, when my device is connected to the central and data is sent over NUS, the overall current consumption is the same as before.

    It looks like, that this change is revoked at some point when the SoftDevice starts.

    1. Do you have any suggestions what could cause this behaviour?

    2. Do you have an idea how to solve this issue?

    Thank you so much in advance.

  • I'm not able to reproduce this behavior. I'm still seeing low current consumption after connection as long as the RX pin is set to disconnected.

    You say "when my device is connected to the central and data is sent over NUS", can you describe exactly at what point the current increases? What steps did you do after establishing the connection to the device?

  • Hello,

    thank you very much for your reply.

    Sorry for my inaccurate description in my previous reply to you.

    I start with initializing log, timers, buttons_leds and power_managment:

            log_init();
            timers_init();
            buttons_leds_init(&erase_bonds);
            power_management_init();

    Current consumption: 0.391mA

    If I initialize uart after that with RX_PIN_NUMBER, my current increases to 1.768mA. (Case 1)

    If I initialize uart after that with UART_PIN_DISCONNECTED, my current increases to 0.392mA (Case 2)

    ----------------------------------------

    Case 1:

    After Initialize ble_stack, gap_param, gatt, services, advertising, conn_param:

        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();

    Current while advertising: 2.03mA

    Current while connected (no data transfer): 1.85mA

    After intializing SAADC and start using NUS:

              saadc_sampling_event_init();
              saadc_init();
              saadc_sampling_event_enable(){
                    ...
                    nrf_drv_clock_hfclk_request(NULL); 
                    ...
              };

    Current: 2.84mA

    -----------------------------------------

    Case 2:

    After Initialize ble_stack, gap_param, gatt, services, advertising, conn_param:

        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();

    Current while advertising: 0.377mA

    Current while connected (no data transfer): 0.144mA

    After intializing SAADC and start using NUS:

              saadc_sampling_event_init();
              saadc_init();
              saadc_sampling_event_enable(){
                    ...
                    nrf_drv_clock_hfclk_request(NULL); 
                    ...
              };

    Current: 2.81mA

    ----------------------------------------

    Do you know why my overall current consumption is finally the same?

Related