cancel
Showing results for 
Search instead for 
Did you mean: 

RTC TimeStamp

Abdelmalek BELLOULA
Associate III

I use:
STM32Cube_FW_F4_V1.27.1
and CubeMx 6.9.0
I have a problem with the function HAL_RTCEx_GetTimeStamp(&hrtc, &RtcTimeTimeStamp, &RtcDateTimeStamp,RTC_FORMAT_BIN); it always returns the value 0 for the year, the other values are correct.

In the function I find:
/* Fill the Date structure fields with the read parameters */
sTimeStampDate->Year = 0U;
sTimeStampDate->Month = (uint8_t)((tmpdate & (RTC_TSDR_MT | RTC_TSDR_MU)) >> RTC_TSDR_MU_Pos);

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The HAL_RTCEx_GetTimeStamp function reads the TSDR register as part of the time stamp feature. The TSDR register doesn't have a field for the year.

This is different functionality than simply reading the date, which you can do with HAL_RTC_GetDate.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

The HAL_RTCEx_GetTimeStamp function reads the TSDR register as part of the time stamp feature. The TSDR register doesn't have a field for the year.

This is different functionality than simply reading the date, which you can do with HAL_RTC_GetDate.

If you feel a post has answered your question, please click "Accept as Solution".

THANKS