cancel
Showing results for 
Search instead for 
Did you mean: 

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

JWieb
Associate III

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

1 REPLY 1

> 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