cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 RTC miliseconds set

priven
Associate II
Posted on May 14, 2018 at 19:40

Hi,

I would like to set the milliseconds in the STM32 RTC, the function hal_rtc_settime doesn't change the milliseconds (subseconds) value.

I tried be setting hrtc->instance->rtc_ssr but it doesnt change its value

Help would be appritiated

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on May 14, 2018 at 22:07

You can't. The subsecond register is read-only.

You can use the 'shift' feature, though, to manipulate the subsecond register.

Read the RTC chapter in the reference manual (RM), focus on RTC synchronization chapter and description of the RTC_SHIFTR register.

JW

View solution in original post

8 REPLIES 8
Posted on May 14, 2018 at 20:08

Which STM32, there are a few, and the designs of the RTC are different on several families?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 14, 2018 at 22:07

You can't. The subsecond register is read-only.

You can use the 'shift' feature, though, to manipulate the subsecond register.

Read the RTC chapter in the reference manual (RM), focus on RTC synchronization chapter and description of the RTC_SHIFTR register.

JW

Posted on May 14, 2018 at 20:21

My bad, STM32L452

henry.dick
Senior II
Posted on May 14, 2018 at 23:16

It may help every once in a while to read the datasheet to see how the device you are trying to click-and-program works.

Posted on May 15, 2018 at 08:30

Thank you, I didn't noticed that it was read only

Posted on May 15, 2018 at 08:31

I have read the datasheet, I have missed the 'r' letter in the register

Tomohiro Shirane
Associate II
Posted on June 05, 2018 at 12:12

Hello,

I'm trying to set the milliseconds with STM32 H753-Eval board.

If I want to set the 400 millisenconds value(for example), should I set the 0x190(=400 decimal) into SUBFS field in RTC_SHIFTR and set the 0x3E7(= 999 decimal) into PREDIV_S field in RTC_PRER ?

Is my understanding correct ?

Posted on June 07, 2018 at 09:09

https://community.st.com/0D50X00009XkWK4SAN