Skip to main content
bee2
Associate III
Mar 17, 2013 2:31 PM UTC
Question

STM32F4 RTC and LSI question

Posted on March 17, 2013 at 15:31

Hi

I'm just wondering why the LSI on the STM32F4 Discovery board has inaccuracy's, I've searched the internet and application notes but can't seem to find the answer? My seconds on LCD jumps several times between 0-60, the time also counts up to 100 on seconds and what look likes 999 on mins and hours even though I've set 24 hour format as below:

 RTC_InitStruct.RTC_HourFormat = RTC_HourFormat_24;

Any help appreciated.

#lsi-rtc
This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
Mar 17, 2013 2:43 PM UTC
Posted on March 17, 2013 at 15:43

It uses an RC (resistor capacitor) network fabricated in polysilicon and metal layers on the die. It is effected by voltage, temperature, and fabrication process variations. ie as the values of V, T, R and C change, so does the frequency.

It also consumes more power, and it's speed will change as voltage drops and thresholds change, it is not usable to clock the RTC via battery in standby.

Your issues with the minutes or seconds exceeding 0-59 sound more like coding errors, than subtle frequency anomalies with the LSI.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
bee2
bee2Author
Associate III
Mar 17, 2013 4:08 PM UTC
Posted on March 17, 2013 at 17:08

Ok, thanks for info Clive, I'm hoping to change to LSE soon as I can I just need to get the required components as the device will hopefully be mobile at its final stage. I've just noticed using the software debugger the time (seconds) does count from 0-60 but the LCD display jumps values but changes 60 times as the debugger value changes. I'm just using the RTC_GetTime function, sprintf and then display to LCD??

RTC_GetTime(RTC_Format_BCD, &RTC_TimeStruct);

  sprintf((char*)time_display,''Time = %0.2d:%0.2d:%0.2d'', RTC_TimeStruct.RTC_Hours, RTC_TimeStruct.RTC_Minutes,RTC_TimeStruct.RTC_Seconds);

LCD_DisplayStringLine(LINE(8),0,(unsigned char*)time_display);

Tesla DeLorean
Guru
Mar 17, 2013 4:32 PM UTC
Posted on March 17, 2013 at 17:32

BCD is more akin to hexadecimal than decimal, ie 0x59 -> 89, so use %02X

If you want decimal 0..59 perhaps BIN format would be a better choice?
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
bee2
bee2Author
Associate III
Mar 17, 2013 5:01 PM UTC
Posted on March 17, 2013 at 18:01

Great stuff, Many thanks Clive