cancel
Showing results for 
Search instead for 
Did you mean: 

RTC Calendar STM32WBA65

SLevi.1
Associate III

I am trying to modify the BLE_HeartrateFreeRTOS project. I will set the RTC date/time from a timestamp received over BLE from a PC. I need the RTC calendar to be running, as I need to timestamp data readings with a "Unix" timestamp. I also need to perform a certain action on the hour, 15 mins past, 30 mins past, and 15 mins to the hour

The RTC calendar in the heartrate example is run in free running binary mode. I set the time from the PC time sync using HAL_RTC_SetTime & HAL_RTC_SetDate. When I call HAL_RTC_GetTime & HAL_RTC_GetDate later, the date is correct (still todays date) but the time is always 00:00:00. The "SubSeconds" field of my RTC_TimeTypeDef is being filled with a number which decreases as my program runs, but how do I get from this to a "UNIX" timestamp I can log against my data?

I did manage at one point to set the RTC mode to be "free running BCD calendar & binary", but CubeMX seems to reset this each time the ioc file is saved. When it did get to run in this mode, the time structure was being filled in, but the time was ticking along at roughly 4 times too fast.

I have an external oscillator driving LSE at 32.768KHz, and I am using this as the source for the RTC. The clock config is attached, as is the ioc file. I would really appreciate some help, or a pointer to any relevant docs.

 

 

0 REPLIES 0