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
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 »

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
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 »

Giovanni wrote:but we should ask the author anyway

Could you do that as an author of ChibioOS.
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 »

I'll try, have to find contact info first.

Giovanni
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: The RTC driver topic

Post by DeusExMachina »

I found that RTCD is not implemented on stm32F0xx platform. Support for this MCU is planned?
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 »

It should work, it is matter of testing it on HW.

Giovanni
VVo
Posts: 7
Joined: Thu Sep 18, 2014 7:56 am

Re: The RTC driver topic

Post 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:
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 »

@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.
VVo
Posts: 7
Joined: Thu Sep 18, 2014 7:56 am

Re: The RTC driver topic

Post 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.
Last edited by VVo on Thu Sep 18, 2014 11:28 am, edited 1 time in total.
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 »

What you use to measure slowerness?
VVo
Posts: 7
Joined: Thu Sep 18, 2014 7:56 am

Re: The RTC driver topic

Post 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.
Last edited by VVo on Thu Sep 18, 2014 11:50 am, edited 1 time in total.
Post Reply