Skip to main content
Fabien LETORT
Associate II
November 8, 2017
Question

How update RTC in lrwan library ?

  • November 8, 2017
  • 2 replies
  • 1772 views
Posted on November 08, 2017 at 15:48

I don't understand how rtc library work in lrwan module.

Some code (as the Utilities/timeServer.c) use tick (from rtc) value to get elapsed time.

By using TimerGetCurrentTime then a little bit letter TimerGetElapsedTime we can have elapsed time in ms.

But if we update the rtc betwwen this two call.... this does not work....

So my question is : How rtc can be update in this library ? To put it at the correct current datetime.

#rtc #murata-cmwx1zzabz-lrwan1-(ver1.1.1)
This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
November 8, 2017
Posted on November 08, 2017 at 16:56

Well they seem to have chosen to use the RTC instead of the SysTick for the software time base, I'd assume because it is lower power or some CM0 don't have SysTick.

Personally, I'd refactor the thing, and use SysTick for the time base and free the RTC up to do Time/Date

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Andrew Neil
Super User
November 8, 2017
Posted on November 08, 2017 at 19:08

Could also be because they are timing across low-power 'sleeps' - and RTC is the most power-efficient way to do this ... ?

EDIT

In which case, changing the RTC time might not matter: because you will only do that while the CPU is awake - so the RTC is not being used for a delay at that time ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
November 8, 2017
Posted on November 08, 2017 at 19:56

I haven't mined that deep into the L0, does it sleep with the WFI in the same way for RTC vs SysTick?

A lot of the timing seems to be at the millisecond level, I could see value at multiple seconds.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Huzaifah Limbada
Associate III
September 5, 2018

Hey @Fabien LETORT​ 

"I found also a bug in the st example project. As the systick is not used,  

HAL_InitTick is redefined locally to do nothing. BUT HAL_GetTick is not redefined anywhere in the code given by st."

I'm also facing this problem which leads to timeout at "SPI_WaitOnFlagUntilTimeout" and even sometimes my systick is stopped,

So i made some changes according to other projects implemented from CubeMx and now i'm facing RxTimeout error because my device is unable to join the networks.

If anyone have idea about this please suggest me.

Thank you!