Solved
Why RTC backup register write fails? (STM32F446)
Posted on January 02, 2018 at 21:01
(this is re-post because of the 'forums issue')
I have the following function to write a RTC backup register of 446ZCT:
All RTC initialization code is generated by CubeMX.
void put_backup_num(uint8_t num)
{ __HAL_RTC_WRITEPROTECTION_DISABLE(&hrtc); HAL_PWR_EnableBkUpAccess(); __HAL_RTC_WRITEPROTECTION_DISABLE(&hrtc);HAL_RTCEx_BKUPWrite(&hrtc, RTC_BKP_DR18, num);
uint32_t d = HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR18);
if (num != (d & 0xFF) ) { printf('backup write failed!\n'); }}and read-back always fails. Read values are always 0.
What is missing?
Thanks,
Pavel
#stm32f446 #rtc-backup