Page 16 of 23

Re: The RTC driver topic

Posted: Thu Sep 20, 2012 6:20 pm
by Giovanni
Good question, I see a lot of names there, the BSD license is not a problem but we should ask the author anyway. It looks well written too.

Giovanni

Re: The RTC driver topic

Posted: Thu Sep 20, 2012 6:25 pm
by barthess
Giovanni wrote:but we should ask the author anyway

Could you do that as an author of ChibioOS.

Re: The RTC driver topic

Posted: Thu Sep 20, 2012 7:21 pm
by Giovanni
I'll try, have to find contact info first.

Giovanni

Re: The RTC driver topic

Posted: Mon Jan 06, 2014 3:31 am
by DeusExMachina
I found that RTCD is not implemented on stm32F0xx platform. Support for this MCU is planned?

Re: The RTC driver topic

Posted: Mon Jan 06, 2014 9:31 am
by Giovanni
It should work, it is matter of testing it on HW.

Giovanni

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 8:27 am
by VVo
Many thanks for ChibiOS. Made it easy to start using STM32. I found the wrong job for RTCv1 stm32f1.
The initial conditions and settings:
1. stm32f100c8, external crystal resonator 32768 for RTC and has battery backup.
2. settings:

Code: Select all

#define STM32_LSECLK            32770
 #define STM32_HSECLK            8000000

#define STM32_NO_INIT                       FALSE
#define STM32_HSI_ENABLED                   TRUE
#define STM32_LSI_ENABLED                   TRUE
#define STM32_HSE_ENABLED                   TRUE
#define STM32_LSE_ENABLED                   TRUE
#define STM32_SW                            STM32_SW_PLL
#define STM32_PLLSRC                        STM32_PLLSRC_HSE
#define STM32_PLLXTPRE                      STM32_PLLXTPRE_DIV1
#define STM32_PLLMUL_VALUE                  3
#define STM32_HPRE                          STM32_HPRE_DIV1
#define STM32_PPRE1                         STM32_PPRE1_DIV1
#define STM32_PPRE2                         STM32_PPRE2_DIV1
#define STM32_ADCPRE                        STM32_ADCPRE_DIV2
#define STM32_MCOSEL                        STM32_MCOSEL_NOCLOCK
#define STM32_RTCSEL                        STM32_RTCSEL_LSE
#define STM32_PVD_ENABLE                    FALSE
#define STM32_PLS                           STM32_PLS_LEV0


Test 1:
1. connect the battery;
2. connect the main power;
3. read RTC->PRLL(RTC->PRLH), has a value of 32770, all is well;
4. tune time.

Test 2:
1. turning off the main power;
2. Turning on the main power;
3. read RTC->PRLL(RTC->PRLH), has a value of 32768, value is reset to the default value;
4. reading time, time correctly.

Is that correct?
I do not understand why RTC->PRLL(RTC->PRLH) reset to the default value?
Sorry for my bad english :oops:

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 11:06 am
by barthess
@VVo
Because that registers are write only. Sure, you can read them but value will be incorrect. Use RTC_DIVH / RTC_DIVL instead
P.S. welcome to ChibiOS.

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 11:24 am
by VVo
Not so easy. If you do not turn off the main power the clock will go right (divider 32770). After a power off-on the clock runs slower (divider 32768). That is, the clock is correct to the first power outage.

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 11:28 am
by barthess
What you use to measure slowerness?

Re: The RTC driver topic

Posted: Thu Sep 18, 2014 11:33 am
by VVo
What does it matter if, after a power failure the clock starts to go slower? The device operates year. Would like to adjust the accuracy. Compared with the clock on my computer, which is synchronized with the network. 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.