cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F051 LSE Clock accuracy

sylvain535
Associate II
Posted on May 06, 2014 at 16:31

hello,

I am in the

development of a new

application with a

STM32F051R8

.

I have a big

problem with

the accuracy of the

RTC:

I

used both

the

quartz

advocate

in the

note

AN2867

application.

I initialize

the

RTC

well

with clock

LSE

I

check

the integrity

of the signal

source

to the oscilloscope

, however

I see

some

burst

even

changing

repeatedly

torque

quartz

/

capacitor

I have

the same problem

on the prototype board

made

​​for our

machine

on the

evaluation board

is

why I

excluded

a problem of

PCB

design

After

24 hours

I

observed

a

deviation

which varies

from 60 to

90 seconds

.

This deviation

is even more important

if I use

the

timer

2

to generate an interrupt

every

0.1

ms

.

I do not see

what can

interfere with

the oscillation of the

quartz

or registers

of the

RTC

, did

you

meet with a

similar case

?

Thank you

for your help.

8 REPLIES 8
chen
Associate II
Posted on May 06, 2014 at 16:47

Hi

''

I initialize

the

RTC

well

with clock

LSE

I

check

the integrity

of the signal

source

to the oscilloscope

''

The capacitance of the scope probe may affect the Xtal oscillations.

If the device has the functionality - get he device to output the LSE on an IO pin and check that with the scope.

''

After

24 hours

I

observed

a

deviation

which varies

from 60 to

90 seconds

. ''

That is an enormous error!

The last time I worked on a RTC - I got around 1 second/month error before correction.

I think something else must be wrong.

Posted on May 06, 2014 at 16:54

Observe the LSE indirectly, either via the MCO (PA8) pin, or measure the period via one of the TIM with the LSE clock routed to it. I'd have to check the manual as to which TIM that is.

The loading of the crystal will change it's performance, also the STM32 expects 6-7pF crystals, so make sure you are not using 9 or 12pF ones.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
sylvain535
Associate II
Posted on May 06, 2014 at 17:15

thanks for your reply 🙂

yes ocscilloscope is a bad thing to measure signal, it s just for check the frequency, but level is bas, sure.

I use 6,8 pf +/- 0.25 pf , perhaps i buy in other distributor

because

there

may

be an error

...

Before i'm used DS1340, very good RTC IC with best accuracy.

For me is the first use of RTC in STM32

0690X0000060556QAA.png

________________

Attachments :

scope_4.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0qu&d=%2Fa%2F0X0000000bfE%2FYyNh4SF6So1vE3BMZFAHCbcEWG3sum9sXQOrIwPXSGM&asPdf=false
Posted on May 06, 2014 at 17:25

Check what prescaler you are using for the LSE, the LSI is around 40 KHz

Observe LSE via MCO pin

RM0091, search on ''Clock-out capability'', and ''Internal/external clock measurement with TIM14''
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
sylvain535
Associate II
Posted on May 06, 2014 at 17:40

i rewrite the code for tomorrow, i'm post result soon as possible

thanks

sylvain535
Associate II
Posted on May 06, 2014 at 17:41

i rewrite the code for tomorrow, i'm post result soon as possible

thanks

sylvain535
Associate II
Posted on May 09, 2014 at 10:18

I give you

some

news about

the problem of

stability

:

First

I rewrite

my code for

just use

the

RTC

péripheral

to

make sure

there

was

no

interference

with other peripheral.

I activated

the

512

HZ

output

to measure the

signal

:

I bought

high-precision

6.2

Pf

capacitors,

the

measured frequency

was 404

Hz:

even worse than before

.

Capacitors

with

6.8

pf

I have

a frequency of

520

Hz

...

In any

case

the

two

signal

as

very

unstable.

I said that

I use

quartz

with

capacity of 6

Pf

as recommended by

ST.

And

I

test

the 12

pf,

and:

0690X00000604ujQAA.png

Very stable and good frequency.

In conclusion

:

no

software

problem

but I

'll order

the exact reference of

quartz

in  BOM of

discovery

noard, and I

redo the

test.

I

keep you informed

.

Sorry for my english.

sylvain535
Associate II
Posted on May 27, 2014 at 08:33

finally to close the post,

and after much

trial

, the best accuracy was found whith 12 pf quartz and 12 pf capacitor.

thanks.