Hallo liebe Forenuser!
ich habe ein eigenartiges Problem mit der RTC eines STM32F030
Mikrocontrollers.
Die RTC und deren Alarm funktioniert soweit. Aber..
Wenn ich den Alarm der RTC auf wenige Minuten stelle (bis ca. 20) wird
ein Alarm ausgelöst.
Wenn ich darüber, also 25, 30 oder 59 einstelle, wird keiner mehr
ausgelöst!
Wisst ihr warum?
Der Alarm mit zB: 1h und 1min funktioniert.
Initialisiert wird der Alarm folgendermaßen:
1 | // invert "don't care" RTC_AlarmMask to care for minutes
|
2 | #define RTC_AlarmMask_DETECT_MINUTES ((RTC_AlarmMask_All) & (~(RTC_AlarmMask_Minutes)))
|
3 |
|
4 |
|
5 | RTC_AlarmInitStructure.RTC_AlarmTime.RTC_Hours = 0;
|
6 | RTC_AlarmInitStructure.RTC_AlarmTime.RTC_Minutes = 29
|
7 | RTC_AlarmInitStructure.RTC_AlarmTime.RTC_Seconds = 0;
|
8 | RTC_AlarmInitStructure.RTC_AlarmTime.RTC_H12 = RTC_H12_AM;
|
9 | RTC_AlarmInitStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
|
10 | RTC_AlarmInitStructure.RTC_AlarmDateWeekDay = 1;
|
11 | RTC_AlarmInitStructure.RTC_AlarmMask = RTC_AlarmMask_DETECT_MINUTES;
|
Danach setze ich die RTC-Zeit zurück:
1 | RTC_TimeTypeDef resetTime = { 0, 0, 0, RTC_H12_AM };
|
2 |
|
3 | RTC_SetTime(RTC_Format_BCD, &resetTime);
|
Die RTC wird zu Beginn mit den STM32F0-Library Default-Werten
initialisiert und dem LSI betrieben:
1 | void RTC_StructInit(RTC_InitTypeDef* RTC_InitStruct)
|
2 | {
|
3 | /* Initialize the RTC_HourFormat member */
|
4 | RTC_InitStruct->RTC_HourFormat = RTC_HourFormat_24;
|
5 |
|
6 | /* Initialize the RTC_AsynchPrediv member */
|
7 | RTC_InitStruct->RTC_AsynchPrediv = (uint32_t)0x7F;
|
8 |
|
9 | /* Initialize the RTC_SynchPrediv member */
|
10 | RTC_InitStruct->RTC_SynchPrediv = (uint32_t)0xFF;
|
11 | }
|