cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F1 Clock/Calendar BUG

tetj
Associate II
Posted on April 24, 2014 at 15:08

Hello, I noticed a problem in the software implementation of STM32F1 's clock/calendar. If the device is switched off for a long time (>= 255 days) it will enter infinite loop inside  CheckForDaysElapsed() (which is inside RTC_Configuration() function) because the for(;;) loop variable is only 8bits in size. I replaced several microcontrollers before finding this as I thought they were faulty.

Has anyone encountered this issue ?

4 REPLIES 4
Amel NASRI
ST Employee
Posted on April 28, 2014 at 16:03

Which software implementation are you speaking about?

-Mayla-

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.

tetj
Associate II
Posted on April 28, 2014 at 22:08

The one from

http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF257855

. It is for STM32F1 series only.

Posted on April 28, 2014 at 23:21

Yes, there appear to be issues with that, and frankly I don't care for that approach to calendering. I built a scheme using a 32-bit second value from epoch (136 years), and computed the date/time when required. A linear view of time is best expressed in seconds, not human centric dates.

Rule#1 For Third-Party calendering solutions : They are usually broken in subtle ways, and the time required to validate them would exceed the time to write correctly from scratch.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tetj
Associate II
Posted on April 29, 2014 at 00:05

Couldn't agree more Clive, good thing I only used the lib for one project. I then switched to UNIX time format too. As you said it is pretty straightforward.