AnsweredAssumed Answered

RTC subseconds issue

Question asked by mangraviti.giova.001 on Jun 16, 2014
Latest reply on Jun 16, 2014 by mangraviti.giova.001
Hi,


I am working on STM32F303VCT6.
The source clock is a cristal of 32.768Khz.
I need to have a time resolution on the RTC of 1ms. So I have arranged the prescalers as follow:


SynchPrediv = 0x3E7; 
 AsynchPrediv = 0x21;


My idea is to have a frequency on the second counter (Synchronous prescaler) of about 1khz. Doing this I should have the possibility to have a value on the RTC_SS register from 0 to 999, that means 1ms for each steps.


the time in msec = (Prediv_Sync - SS)/(Prediv_Sync + 1) (Ref. Manual pag.643)


If I put a function GetSubseconds() inside an external interrupt routine ( external pin ) that is connected to an external source ( 100hz) I should have a difference of the two value read by the function GetSubseconds() of about 10. Am I right?
( I am sure that the time intervall between the two consequenzial GetSubseconds() function call is really 10ms, because I have put a logic toggle on a pin and show it on my oscilloscope)
Instead I read about 3, 4 steps...


The RTC works fine, If I try to read the time each 1sec, the time is correct, 1sec of increment...


I don't understand

Outcomes