AnsweredAssumed Answered

STM32L0 Stop Mode Not Working Properly

Question asked by eren eraslan on Sep 23, 2017



Currently, I am working on optimizing current consumption by using STOP Mode of the STM32L053C6T6 processor.

I'm facing a problem that I can not get through, and I'm very happy if you can help.

First of all, I would like to explain the algorithm in a very simplified way.

In the while loop, I print to Pc "STARTED" through the UART-Serial converter. Next, I set the RTC alarm to 10 seconds later. And the finally I sleep the MCU by using  STOP MODE. After 10 seconds, MCU wakes up properly. So far everything is normal. After MCU wake up, I call the System Clock Config function. I print "woken-up" on the PC screen through UART. I can work this way forever But I do not like the current that circuit consume.


To reduce the power consumption, I set all the pins to analog before entering sleep mode. this method worked very well on reducing current consumption. But after all the pins are analog and MCU goes sleep and wake up, the MCU can not send to string to PC. I think UART Module does not work properly...

But I/O's and systick timer are running. I can understand this by toggling the LED in a certain delay(with HAL_DELAY)

Here is my codes 


int main(void)

          for(uint16_t count1 = 0;count1<25;count1++){
          SetAlarm(10);                                   //10sn sonra alarm kuruyor
          EnterStopMode();                              //Uyku modu ayarlamalari

void EnterStopMode(void)
  GPIO_InitTypeDef GPIO_InitStruct;
  //A ve B portlarini kullandigim icin bu portlari analog yaptim

  /* Configure all GPIO port pins in Analog Input mode (floating input trigger OFF) */
  GPIO_InitStruct.Pin = GPIO_PIN_All;
  GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

  /* Disable GPIOs clock */

  // STOP Moda girme komutu