Hallo,
ich habe das Problem, dass meine MCU nach einem RTC Wakeup Timer
Interrupt nicht mehr aufwacht.
RTC und Wakeup Timer Interrupt ohne sleep mode funktionierten.
Die Routine für den Wakeup Timer Interrupt befindet sich in der Datei
stm32l0xx_hal_rtc_ex.c. Hier setze ich ein Flag wie folgt:
1 | void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc)
|
2 | {
|
3 | /* Get the pending status of the WAKEUPTIMER Interrupt */
|
4 | if (__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTF) != 0U)
|
5 | {
|
6 | wakeupFlag = 1; // set the Flag if a wakeup event occours
|
7 | }
|
8 | ...
|
9 | ...
|
10 | ...
|
Unter main() bzw. in while(1) lege ich die MCU schlafen und arbeite - so
der Plan - meine Routinen ab sobald die RTC ein Wakeup Event generiert.
1 | while (1)
|
2 | {
|
3 | if(wakeupFlag == 0)
|
4 | {
|
5 | HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
|
6 | __WFI();
|
7 | }
|
8 |
|
9 | if(wakeupFlag == 1)
|
10 | {
|
11 | if(sensorFlag == 1)
|
12 | {
|
13 | sensorFlag = 2;
|
14 | // read Sensor 1
|
15 | }
|
16 | else if(sensorFlag == 2)
|
17 | {
|
18 | sensorFlag = 3;
|
19 | // read Sensor 2
|
20 | }
|
21 | else if(sensorFlag == 3)
|
22 | {
|
23 | sensorFlag = 1;
|
24 | // read Sensor 3
|
25 | }
|
26 | }
|
27 | }
|