STM32L010RB_NUCLEO_PWR_STANDBY
Hello,
I have tested the kit discovery NUCLEO-L010RB and the program PWR STANDBY(mcu STM32L010RB), this work fine. I would like do exactly the same test with the mcu STM32L010K8 (so the same family like STM32L010RB), but I have a problem, the program run well but the current consumption is always at about 2mA instead 1.8uA in standby mode.
I use the KEIL for the development. Nothing else is connected in the STM32L010KB, just VDD, VSS and VDDA like the picture in attachment.
Have you an example with KEIL to test the STM32L010KB in standby mode please?
Below my current program.
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
HAL_Init();
/* Configure the system clock to 2 MHz */
SystemClock_Config();
/* Configure LED2 */
// BSP_LED_Init(LED2);
/* Enable Power Control clock */
__HAL_RCC_PWR_CLK_ENABLE();
/* Check if the system was resumed from Standby mode */
if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
{
/* Clear Standby flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
/* Wait that user release the User push-button */
// BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO);
// while(BSP_PB_GetState(BUTTON_KEY) == GPIO_PIN_RESET){}
}
/* Insert 5 seconds delay */
HAL_Delay(5000);
/* The Following Wakeup sequence is highly recommended prior to each Standby mode entry
mainly when using more than one wakeup source this is to not miss any wakeup event.
- Disable all used wakeup sources,
- Clear all related wakeup flags,
- Re-enable all used wakeup sources,
- Enter the Standby mode.
*/
/* Disable all used wakeup sources: PWR_WAKEUP_PIN1 */
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
/* Clear all related wakeup flags*/
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* Enable WakeUp Pin PWR_WAKEUP_PIN1 connected to PA.00 */
//HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
/* Enter the Standby mode */
HAL_PWR_EnterSTANDBYMode();
/* This code will never be reached! */
while (1)
{
}
/* USER CODE END 3 */
}
/**
* @brief System Clock Configuration
* @retval None
*/
void SystemClock_Config(void)
{
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
/* Enable MSI Oscillator */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5;
RCC_OscInitStruct.MSICalibrationValue=0x00;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK)
{
/* Initialization Error */
while(1);
}
/* Select MSI as system clock source and configure the HCLK, PCLK1 and PCLK2
clocks dividers */
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0)!= HAL_OK)
{
/* Initialization Error */
while(1);
}
/* Enable Power Control clock */
__HAL_RCC_PWR_CLK_ENABLE();
/* 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. */
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
}
Thanks
