cancel
Showing results for 
Search instead for 
Did you mean: 

RTC SubSeconds gets in count down mode

Sachin Gole
Associate II
Posted on April 10, 2018 at 14:50

Following is GetTime function, It always give SubSeconds from 255 to 0 in count down mode. Values read in few ms interval. 

static void RTC_GetTime(void)

{

RTC_DateTypeDef sdatestructureget;

RTC_TimeTypeDef stimestructureget;

HAL_RTC_GetTime(&hrtc, &stimestructureget, RTC_FORMAT_BIN);

HAL_RTC_GetDate(&hrtc, &sdatestructureget, RTC_FORMAT_BIN);

printf('\r\n%0.2d:%0.2d:%0.2d:%0.2d', stimestructureget.Hours, stimestructureget.Minutes, stimestructureget.Seconds, stimestructureget.SubSeconds);

}

logs are :-

05:34:35:149

05:34:35:99

05:34:35:48

05:34:36:254

05:34:36:203

05:34:36:153

05:34:36:103

05:34:36:52

05:34:36:02

05:34:37:208

05:34:37:157

05:34:37:107

05:34:37:57

05:34:37:06

05:34:38:212

05:34:38:161

05:34:38:111

05:34:38:61

05:34:38:10

05:34:39:216

05:34:39:166

05:34:39:115

05:34:39:65

05:34:39:15

05:34:40:220

05:34:40:170

05:34:40:120

05:34:40:69

05:34:40:19

05:34:41:225

Any suggestion ?

#stm32l4 #rtc
3 REPLIES 3
AvaTar
Lead
Posted on April 10, 2018 at 14:58

Values read in 400 ms interval. 

...

05:34:38:212

05:34:38:161

05:34:38:111

05:34:38:61

05:34:38:10

5 x 400ms equals 2000ms.

There could not be more than 3 readings per second in the worst case, if that was true.

Something is wrong here ...

Posted on April 10, 2018 at 15:14

uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content. This parameter corresponds to a time unit range between [0-1] Secondwith [1 Sec / SecondFraction +1] granularity */

[1 Sec / SecondFraction +1]

SecondFraction = 255

granularity = 

1 Sec / (255 + 1) = 0.00390625

SubSeconds = 212 read value 

real value in sub second  = 

SubSeconds *  

granularity = 0.828125 sec = 828 ms

So output values are correct only in reverse order, why its in reverse order its problem ?

Posted on April 10, 2018 at 23:25

0690X0000060AWuQAM.png