AnsweredAssumed Answered

stm32f4xx RTC peripheral subseconds for precise timestamp

Question asked by Reddy.Harinadha on May 28, 2014
Latest reply on Jul 17, 2014 by Clive One
Hello everyone,
I have ported the following RTC_Calender example to STM32F4-Discovery board.
STM32Cube_FW_F4_V1.1.0\Projects\STM324xG_EVAL\Examples\RTC

I was logging the date & time along with subseconds feature ( as mentioned in stm32f4xx_hal_rtc.h file, its range is 0 to 59). But this value range depends on AsynchPredivSynchPrediv of RTC_InitTypeDef structure. I'm using LSI as RTC clock.

Page 782 of stm32f4 Reference manual RM0090 says:
rtc_subsec.png
 where AsynchPrediv is PREDIV_A and SynchPrediv is PREDIV_S. 
currently I configured AsynchPrediv = 0x7F and SynchPrediv = 0xFF

I log the date, time in a while(1) loop :
/* Time Format : hh:mm:ss:ss */
 buffsize = sprintf((char*)aShowTime,"%0.2d:%0.2d:%0.2d:%0.2d\r\n"
            stimestruct.Hours, stimestruct.Minutes, stimestruct.Seconds, stimestruct.SubSeconds);
The output is as follows(mm-dd-yy hr:mm:ss:ss):
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:255
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:254
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:253
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:252
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:251
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250
05-28-2014 01:42:11:250

After subseconds reaches to 0, then starts from 255. 
I'm looking for a precise timestamp for logging data, could anyone here suggest please.
Thanks in advance.

Outcomes