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

How to optimize the power consumption of a simple Broadcaster ?

Hello  Nordic support team,

I broadcast data each 1 second and I use the following function (as used in many examples) to manage the power consumption.

while (1){
    power_manage();
}


Unfortunately, I measure a consumption of 3mA between each data packet transmitted. I expected that the sd_app_evt_wait() function manage correctly the power, but apparently not.

Do I need to activate the RTC or LFCLK between the packet emission ? If I try to do that, it the data will be yet transmitted ?

In summary, I would like to go in system ON mode between two radio transmission and then get a wake up on the broadcast transmission event.

Kind regards,
Sylvain.

Specifications:
- nRF52840

- SDK 14.2
- SoftDevice S140 5.0
- Segger Embedded Studio

Parents
  • Hi,

    You do not need to do anything other than calling sd_app_evt_wait() in the main loop, which I assume you do. In that case, the SoftDevice will only keep the 32 kHz clock and RTC active, so you should see a current consumption of approximately 2 μA. However, the SoftDevice will not disable any clocks or peripherals the application has enabled, so if you use other peripherals or have UART logging enabled, you will see a much higher current consumption. Still 3 mA is a bit high, though. Do you have any other components on your PCB that could cause a high current consumption, such as a LED?

  • Hi Einar,

    For now,  I use the PCA10056 and for the current measurement I put the board in nRF only mode. In debug mode, I see that all the ram are activated maybe it's the problem.

    I haven't activated any other peripheral ... I'm asking myself if the softdevice power management works in my code

  • I found the source of the problem ... If I comment that line :

    int int_temperature = (int)(temperature*10);

    The system work correctly with a consumption of around 3 uA.
    This behaviour is very strange. Do you have an explication ?

    typedef struct
    {
        uint8_t  sensor_1;
        uint8_t  humidity_type;
        uint8_t  humidity_data;
        uint8_t  sensor_2;
        uint8_t  temperature_type;       
        uint8_t  temperature_int_data;
        uint8_t  temperature_dec_data;
        uint8_t  sensor_3;
        uint8_t  ANALOG_OUT_1_type;       
        uint8_t  ANALOG_OUT_1_high_data;
        uint8_t  ANALOG_OUT_1_mid_data;
        uint8_t  ANALOG_OUT_1_midlow_data;
        uint8_t  ANALOG_OUT_1_low_data;
    } cayenne_lpp;
    
    cayenne_lpp CAYENNE_LPP_FRAME; 
    
    void initialise_cayenne_lpp_frame(){
    
      CAYENNE_LPP_FRAME.sensor_1 = SENSOR_01;
      CAYENNE_LPP_FRAME.humidity_type = HUMIDITY_TYPE;
      CAYENNE_LPP_FRAME.humidity_data = 0X88;
      CAYENNE_LPP_FRAME.sensor_2 = SENSOR_02;
      CAYENNE_LPP_FRAME.temperature_type = TEMPERATURE_TYPE;
      CAYENNE_LPP_FRAME.temperature_int_data = 0;
      CAYENNE_LPP_FRAME.temperature_dec_data = 0;
      CAYENNE_LPP_FRAME.sensor_3 = SENSOR_03;
      CAYENNE_LPP_FRAME.ANALOG_OUT_1_type = ANALOG_OUTPUT_TYPE;
    }
    
    int main(void)
    {    
      ble_stack_init();
      advertising_init();
      //advertising_start();
        
      initialise_cayenne_lpp_frame();
       
      int int_temperature = (int)(temperature*10); /* THIS VARIABLE DOESN'T ALLOW TO GO IN SYSTEM ON LOW CONSUMPTION. WHY ?*/
    
      CAYENNE_LPP_FRAME.temperature_int_data = (int8_t)((int_temperature>>8)&0xFF);
      CAYENNE_LPP_FRAME.temperature_dec_data = (int8_t)((int_temperature) & 0xFF);
       
    while (1){
            power_manage();
        }
    }

  • *Updated*

    The problem is probably that the multiplication is done by the FPU, which then sets the FPU event that prevents the CPU from going to sleep. You should clear the FPU event immediately before you call sd_app_evt_wait(), as suggested here.

  • I don't use CAYENNE_LPP_FRAME in this code, it can be removed. The only problem is the storage of the float variable "temperature" into the integer variable "int_temperature". That stays very very strange ...

    //Global variable
    float temperature = 24.6;
    
    main
    {
        int int_temperature = (int)(temperature*10);
    }

  • I see. Then this is definitely the due to the FPU event keeping the CPU awake. You need to clear the FPU event before entering sleep, as indicated in my previous (updated) post.

Reply Children
No Data
Related