7 years, 10 months ago.

Nuleo power consumption

Hello, I'm using STM32L053 for my project. Low power is the paramount for my project. My custom board consuming about 1.057mA when i run below empty program.

#include "mbed.h"

/*
DigitalOut myled(PA_13);


Ticker led;

void onled(void){
myled = !myled;
}
*/
int main()
{
  //led.attach(&onled,5);
    while(1) {
     
    }
}

Surprisingly same program with LED (below) consuming about 0.98mA

#include "mbed.h"


DigitalOut myled(PA_13);


Ticker led;

void onled(void){
myled = !myled;
}

int main()
{
  led.attach(&onled,5);
    while(1) {
     
    }
}

most of the pins are unused in my project. Should i make any pins to ground or something to get low poer consumption?.

Or above condition ignorable?. thank you.

1 Answer

7 years, 10 months ago.

Is the LED on but dim in the first case? If the LED is active high and the pin defaults to a pullup then it will be partly on all the time, that could average out to using more power than on fully half the time.

Can you PWM the LED? That will give lower power for the same apparent brightness to the human eye.

What is the power consumption of

int main()
{
  led.attach(&onled,5);
    while(1) {
      sleep();
    }
}

What is the power consumption if you use the WakeUp library and deepsleep() ?

int main()
{
  led.attach(&onled,5);
    while(1) {
      sleep();
    }
}

The current consumption of above program is 0.9mA. almost 0.1mA reduced. I' have reduced system clock to 2MHZ by doing some changes in the library. I changed to MSI clock.

In deepsleep current consumption is 0.75mA. It should be some µA.

This is the change i made

uint8_t SetSysClock_PLL_HSI(void)
{
  RCC_ClkInitTypeDef RCC_ClkInitStruct;
  RCC_OscInitTypeDef RCC_OscInitStruct;

  /* The voltage scaling allows optimizing the power consumption when the device is
     clocked below the maximum system frequency, to update the voltage scaling value
     regarding system frequency refer to product datasheet. */
  __PWR_CLK_ENABLE();
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

  /* Enable HSI and HSI48 oscillators and activate PLL with HSI as source */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
  RCC_OscInitStruct.MSIState = RCC_MSI_ON;
  RCC_OscInitStruct.MSICalibrationValue = 0;
  RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5;
#if !defined (STM32L031xx) && !defined (STM32L041xx) && !defined(STM32L051xx) && !defined(STM32L061xx) && !defined(STM32L071xx)  && !defined(STM32L081xx) && \
  !defined (STM32L011xx) && !defined (STM32L021xx)
  //RCC_OscInitStruct.HSI48State          = RCC_HSI48_ON; /* For USB and RNG clock */
#endif
  // PLLCLK = (16 MHz * 4)/2 = 32 MHz
 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    return 0; // FAIL
  }

  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_PCLK1
                              |RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV2;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
  {
    return 0; // FAIL
  }

  /* Output clock on MCO1 pin(PA8) for debugging purpose */
  //HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); // 16 MHz

  return 1; // OK
}

With the normal library (unchanged library). The deep sleep current consumption is 0.85mA. I think, I must perfectly change the library then i can reduce deepsleep current to some µA.

Thank you.

posted by Mohan gandhi Vinnakota 23 Jun 2016