2026-01-13 5:36 AM - last edited on 2026-03-02 2:48 AM by Imen.D
My BLE project on stm32wba65 makes use of "UTIL_TIMER_Create" to set a callback. This works ok when the RTC is configured just as free running binary. If I set the rtc mode to mixed binary & bcd, the callback never gets fired. I'm using an LSE to drive the rtc.
Why is this?
I'm trying to base a project off the BLE_Heartrate example. I need the calendar time & date so I can timestamp data. I synch the time over the BLE from a PC.
I suppose I could just use the ms ticks since boot, but how does this survive a reset (but not power outage)? Is the binary counter derived from the rtc sufficiently large enough to hold a date for a year or more?
Any examples using binary RTC and external time synch would be most welcome.
2026-03-19 3:20 AM
Hi,
On STM32WBA, it is possible to use both the RTC calendar and the BLE UTIL_Timer by separating the alarms:
This requires adapting MX_RTC_Init() and TIMER_IF_StartTimer() so that Alarm B is configured and used for calendar operations, while Alarm A remains fully masked (AlarmMask = RTC_ALARMMASK_ALL) for the timer server.
In mixed mode (calendar enabled), you must initialize a valid weekday for the alarm, otherwise the current assert in the RTC code will trigger.
If needed, I am attaching 2 files containing the changes with which we can achieve this.
BR, Joé