Is there a secret code required to read and write the RTC value in a STM32H7A3RIT chip?
Hi Folks,
I'm having an issue with just reading and writing new values to the RTC. I'm using a custom board that contains a 32.786Khz crystal and in CubeIDE the LSE is setup properly. I also have a battery connected to Vbatt,
I'm using the following to read the RTC values:
if (HAL_RTC_GetTime(&hrtc, &rtcTime, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
if (HAL_RTC_GetDate(&hrtc, &rtcDate, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
And to write the RTC values:
if (HAL_RTC_SetTime(&hrtc, &rtcTime, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
if (HAL_RTC_SetDate(&hrtc, &rtcDate, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
This code seems to work as long as I don't hit the reset button or turn off the power.
Why wouldn't the Vbatt voltage keep the values as set? Is there something else I need to do to
write the values into memory?
Thanks,
Richard
