The RTC driver topic

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

1) There are some special mechanisms for adjusting accuracy of RTC in STM32
2) You read written prescaler value from an incorrect place
3) Are you have objective measurement results probative RTC slowering obtained from some laboratory equipment? If so than we need fix current RTC driver.
VVo
Posts: 7
Joined: Thu Sep 18, 2014 7:56 am

Re: The RTC driver topic

Post by VVo »

First, the problem revealed that the clock does not depend on STM32_LSECLK. Then I found out that depends, but after a power reset to 32768 and the clock runs slower.
1. Yes, I used to do that BKP->RTCCR, but the problem is the same as with RTC->PRLL.
2. The value of what I'm reading to a speed of the clock.
3. Well, when I decide the problem, write here ;)
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

barthess wrote:Use RTC_DIVH / RTC_DIVL instead
VVo
Posts: 7
Joined: Thu Sep 18, 2014 7:56 am

Re: The RTC driver topic

Post by VVo »

That does not explain if do:

Code: Select all

#define STM32_LSECLK            65536

Clock runs slower (twice) just before the power failure. This can be seen without equipment.
While it may be you are right. Today, I double-check.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

Ok I will try to reproduce bug this evening myself.
1) Ensure your RTC crystal oscillating in absence of main power supply (with oscilloscope for example)
2) Ensure not other code running in your MCU resets RTC (bootloader for example)
3) What version of Chibios you use?
VVo
Posts: 7
Joined: Thu Sep 18, 2014 7:56 am

Re: The RTC driver topic

Post by VVo »

1) If I turn off the power for 10 seconds after the power is turned on time correctly
2) No boot, only ChibiOS
3) ChibiOS / RT 2.6.4
I was sure. Now I doubt. I also recheck.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

I can not reproduce bug on my STM32F103-STK board using RTC application from testhal. Please check your RTC battery setup.
VVo
Posts: 7
Joined: Thu Sep 18, 2014 7:56 am

Re: The RTC driver topic

Post by VVo »

Operates. This led me astray:
1) To apply the divider is necessary to disable the battery.
2) RTC-> PRLL displayed incorrectly after a power failure.
Time is depending on the the constant STM32_LSEKLK even after a power failure.
Thank you very much for your help.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

hi Giovanni.
I need RTC (and ChibiOS-v3) for my current project and will to work on it. I know you want to design RTC HAL from scratch. Could you explain how do you imagine your dream RTC?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: The RTC driver topic

Post by Giovanni »

Hi,

It is mostly already there, just RTCv1 is missing and the default conversion to DOS time in the high level.

There is no external lib required this time.

Giovanni
Post Reply