cancel
Showing results for 
Search instead for 
Did you mean: 

RTC with Free Running Binary Mode and Calendar Mode STM32WBA65

dxxx0001
Associate II

I have question on STM32WBA65RI uC we are using it for our products TEK923/926.

 

It seem to me that BLE stack doesn’t allow to use Free Running Binary mode and Calendar Mode.

There is option of MIX Mode in CubeMX but doesn’t seem working. Causing not to allow Alarm/Timer to configure and giving below error:

 

dxxx0001_0-1772028217108.png

 

sAlarm->AlarmSubSecondMask

               Details:1056964608

               Default:1056964608

               Decimal:1056964608

               Hex:0x3f000000

ICSR

               Details:519

               Default:519

               Decimal:519

               Hex:0x207

 

 

RTC Config:

 

dxxx0001_1-1772028217117.png

BLE Router Example code was used to modify above.

 

------------------------------------------------------------------------------------------------------------------------

I can see similar questions on ST Forum with no answer for STM32WBA65

https://community.st.com/t5/stm32-mcus-wireless/util-timer-create-with-rtc-in-mixed-binary-amp-bcd-mode/m-p/870305

https://community.st.com/t5/stm32-mcus-wireless/stm32wba65-ble-and-rtc-timer-not-firing/m-p/853213

----------------------------------------------------------------------------------------------------------------------

Ideally what we want is RTC with full date and time running  with BLE using  UTIL_TIMER drivers for others tasks.

 

Kind Regards,

Dhaval

 

1 ACCEPTED SOLUTION

Accepted Solutions
_Joe_
ST Employee

Hi,
On STM32WBA, it is possible to use both the RTC calendar and the binary down-counter.
RTC should be configured in Mixed Mode.

Here is an example to use the BLE UTIL_Timer and the Calendar a the same time.
Then, separate the alarms:

  • Alarm A is reserved for the timer server (UTIL_Timer / BLE stack).
  • Alarm B is used for the calendar functions.

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é

View solution in original post

2 REPLIES 2
Cake
Associate

Bumping. I'm also curious about that assert and if anyone knows if its intended or if its an actual issue with the assert check itself. From my understanding, you should be allowed to use the entire sub-second register for alarms in mix mode as long as you mask all the calendar items? Maybe I'm incorrect, but i can't find anything about such a restriction in the RTC documentation. This assert should not trigger if you have masked all the calendar items?

_Joe_
ST Employee

Hi,
On STM32WBA, it is possible to use both the RTC calendar and the binary down-counter.
RTC should be configured in Mixed Mode.

Here is an example to use the BLE UTIL_Timer and the Calendar a the same time.
Then, separate the alarms:

  • Alarm A is reserved for the timer server (UTIL_Timer / BLE stack).
  • Alarm B is used for the calendar functions.

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é