Page 17 of 23

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 11:42 am
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.

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 11:58 am
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 ;)

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 12:03 pm
by barthess
barthess wrote:Use RTC_DIVH / RTC_DIVL instead

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 12:16 pm
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.

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 12:27 pm
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?

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 12:50 pm
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.

Re: The RTC driver topic

Posted: Mon Sep 22, 2014 9:11 am
by barthess
I can not reproduce bug on my STM32F103-STK board using RTC application from testhal. Please check your RTC battery setup.

Re: The RTC driver topic

Posted: Mon Sep 22, 2014 6:12 pm
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.

Re: The RTC driver topic

Posted: Fri Sep 26, 2014 7:03 pm
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?

Re: The RTC driver topic

Posted: Fri Sep 26, 2014 7:39 pm
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