cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L073: RTC Wakeup event not exiting STANDBY mode

conner
Associate II
Posted on September 22, 2016 at 20:33

I have the development board for the STM32L073 and have been testing the functionality of the board regarding waking up from STANDBY mode. I have been able to get it to wakeup only use the IWTG funcitonality. I have NOT been able to get it to wakeup from a WKUP pin rising edge or an RTC wakeup event. I believe that I have it configured properly:

- System Wakeup 1 is being used (pin PA0)

- RTC Wakeup clock is set to RTCCLK / 16 (using 37k LSI oscillator)

--> Wakeup counter set to 11563 (approx. 5 seconds)

--> RTC global interrupt enabled

Am I missing something in the configuration using CubeMX? Is there some code that I need to write in addition to what is generated?

The only code the I have in the USER CODE BEGIN 2 section is the following:

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);

HAL_Delay(2000u);

HAL_PWR_EnterSTANDBYMode();

So I am expecting the green LED to come on for 2 seconds, off for 3 seconds, and keep repeating, but the green LED just stays off. IOC file attached.

#!stm32-!cubemx-!rtc
1 ACCEPTED SOLUTION

Accepted Solutions
conner
Associate II
Posted on October 03, 2016 at 17:32

--------------!!!!!UPDATE WITH FIX!!!!!------------------

So I think the issue I was having was related to having the RVU and PVU flags set in the IWDG Status Register before going into STANDBY mode. For some reason this was causing issues with waking up from GPIO or RTC.

When initializing the IWDG peripheral, these flags remain set until you call the HAL_IWDG_Start() function. In my 'problem' code, I did not call this function before going into STANDBY mode.

I can see this problem affecting more than just myself as it is not readily apparent that low-power modes and the IWDG have this contingency in order to wake up from a low power mode.

View solution in original post

4 REPLIES 4
Nesrine M_O
Lead II
Posted on September 23, 2016 at 10:05

Hi howell.conner,

I suggest you to have a look to these examples under the STM32L0 cube firmware package:

  • STM32Cube_FW_L0_V1.7.0\Projects\STM32L073RZ-Nucleo\Examples\PWR\PWR_STANDBY
  • STM32Cube_FW_L0_V1.7.0\Projects\STM32L073RZ-Nucleo\Examples\PWR\PWR_STANDBY_RTC
These examples shows how to enter the system to STANDBY mode and wake-up from this mode using: external RESET, RTC Wakeup Timer Event or WKUP pin.

-Syrine-
conner
Associate II
Posted on September 26, 2016 at 22:45

Thanks for the initial help Syrine.

I have done some further debugging into this issue and it seems that something in the generated code for the MX_IWDG_Init(); function is causing issues with the RTC waking up from Standby mode. When this piece of code is commented out, the RTC wakeup function works as expected. Any thoughts as to why initializing the IWDG peripheral would cause this issue?

conner
Associate II
Posted on September 27, 2016 at 16:20

It also looks like the MX_IWDG_Init() function blocks System Wake-up 1 from working properly as well. As long as the IWDG peripheral is initialized, both the RTC Wake-up and GPIO Wake-up functionalities do not work properly in getting the system from going from STANDBY mode to RUN mode.

conner
Associate II
Posted on October 03, 2016 at 17:32

--------------!!!!!UPDATE WITH FIX!!!!!------------------

So I think the issue I was having was related to having the RVU and PVU flags set in the IWDG Status Register before going into STANDBY mode. For some reason this was causing issues with waking up from GPIO or RTC.

When initializing the IWDG peripheral, these flags remain set until you call the HAL_IWDG_Start() function. In my 'problem' code, I did not call this function before going into STANDBY mode.

I can see this problem affecting more than just myself as it is not readily apparent that low-power modes and the IWDG have this contingency in order to wake up from a low power mode.