Forum: Mikrocontroller und Digitale Elektronik STM32L010K8 - Probleme mit STOP Mode


von M. G. (ixil96)


Lesenswert?

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
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.