cancel
Showing results for 
Search instead for 
Did you mean: 

Using RTC with LoRa

FPicc.1
Associate III

Hello guys!

I'm working with STM32WL series using the LoRa application, for that the RTC must be in binary mode.

However, I need the calendar and timestamp for my project, which implies that I need to use BCD mode.

I'm aware that the RTC3 has the mixed mode, however, whenever I tried using it, the whole project stopped working.

I've been reading the AN4759, and the posts about it in the community, but I have some doubts about the solution.

LoRa uses the alarm A, which requires the subseconds alarm, and I know that the calendar doesn't work in binary mode, but can I activate somehow by software the calendar and timestamp still in binary mode? (if so, how and where in the code?)

Other thing, while using the mixed mode, what I have to do to make it work like in binary mode but with the calendar? Like, I saw that I might have to transform binary date to BCD, is it necessary? If so, I'm confused how and where in the code I do this. Also I need to adjust the alarm A again, right? What do I have to correct in this case?

Thanks in advance!

3 REPLIES 3
STTwo-32
ST Employee

Hello @FPicc.1 

RTC is indeed reserved for SUBGHz, if you want to get a calendar you can use the time system Offred by the stm32_systime (available in utilities) which provides the time feature based on RTC, please have a look. With it you can dynamically set the time, get the time and maintain it to configure a calendar (main APIs and how to use described in AN5406).

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks for the reply @STTwo-32 , but would I be able to update the timestamp value of the SysTimeMkTime() function, for example, every second?
Can I get a continuous timestamp from these functions?

surumadurum
Associate III

I am stuck with the same situation and the closest I got was to realize that the STM32duino Lorawan wrapper (apparently also provided by ST) seems to use RTC in mixed mode by default and uses Alarm B for the Lorawan stack timing.

There is an example with a calendar alarm and Lorawan, so it seems to work.

Let me know if you got it to work!