Skip to main content
JWieb
Associate III
May 31, 2022 9:02 PM UTC
Question

Trouble setting RTC Hours. Decimal 20 getting written as 28. STM32L031G6U6

Having trouble setting my RTC with a fixed hour of 20.

See image from debugger session.

While attempting to set a fixed value of Decimal 20 to the RTC the register responds with 28.

Edit: STM32L031G6U6

0693W00000NqxmoQAB.png

This topic has been closed for replies.

1 reply

waclawek.jan
Super User
May 31, 2022 10:51 PM UTC

> STM32L0G6U6

I wonder which one is that.

> While attemping to set a fixed value of Decimal 20 to the RTC the register responds with 28.

You have to fill in *all* fields of the structs you are using to call Cube/HAL functions, here, sTime->TimeFormat.

https://github.com/STMicroelectronics/STM32CubeL0/blob/00db5bdf2702687f645b65cd800ddc19c6e55878/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rtc.c#L771

The same with sDate->WeekDay.

JW