Alarm B on Systime #1034
-
Hi, I really like the staks implementation of the timeserver with the alarm A functionality. For an application with an STM32L433, I need information about the current (real) time. I already implemented this by using the Systime module. I also like this idea. For the same application I also need to use the alarm B to trigger some events. For example, send a LoRa message every Monday on 12 o’clock. I already implemented this while having the real time in the calendar registers of the RTC. Now I’m having a really hard time by trying to set the alarm on systime. There is no API function for doing that. As said before, using the alarm A for the timeserver is great but one should also provide functionalities for using alarm B at the same time on systime as there is no way to change the calendar register as soon the stack is running. Anyone already did this? Thank you very much! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@xExecutioner I think you should have a look into the rtc-board.c file, where RTC HAL manipulations are done. You can take RtcStartAlarm() function as a starting point - just omit the reverse calculations from ticks into RTC_ structures, use your own conversions from SysTime structure, if you are using it. Don't forget to modify RTC_IRQHandler() in the same file to call your alarm function on ALARMB execution. It should be a separate function, not the one called HAL_RTC_AlarmAEventCallback() (calls TimerIrqHandler()) or bad things will happen. |
Beta Was this translation helpful? Give feedback.
@xExecutioner I think you should have a look into the rtc-board.c file, where RTC HAL manipulations are done. You can take RtcStartAlarm() function as a starting point - just omit the reverse calculations from ticks into RTC_ structures, use your own conversions from SysTime structure, if you are using it. Don't forget to modify RTC_IRQHandler() in the same file to call your alarm function on ALARMB execution. It should be a separate function, not the one called HAL_RTC_AlarmAEventCallback() (calls TimerIrqHandler()) or bad things will happen.
And of course you can modify the registers on the fly, but you don't want that, really.