2026-01-19 6:55 AM
I work on the STM32U5G9J-DK2 and what I noticed, the RTC doesn't accepted properly hour value which is greater than 12. Than calendar doesn't work, don't actuallize and the hours going UP for example from 23 to 24 and from 24 to 25 and so on... It's really strange bcos on the STM32F407 it work flawlesly without any problem. The solution is using 12 hour format write and sign AM/PM by RTC_TimeTypeDef.TimeFormat value 0 = AM, 1 = PM. Then calendar is properly running and if anyone like me want use 24 hour time format it need realised by software.
Or if anyone know for this MCU other method to use 24H format by hardware you could be posting below.
2026-01-19 7:07 AM
Read out and check/post content of RTC registers.
Quite likely, you have inadvertently set the 12-hour mode, i.e. RTC_CR.FMT = 1. This often happens by not initializing properly the struct used to set time in Cube/HAL.
JW
2026-01-19 7:22 AM
@waclawek.jan wrote:This often happens by not initializing properly the struct used to set time in Cube/HAL.
Indeed.
@wegi01 See, for example, this - which @waclawek.jan posted only the other week.