AnsweredAssumed Answered

Why RTC backup register write fails? (STM32F446)

Question asked by pavel a on Jan 2, 2018
Latest reply on Jan 3, 2018 by pavel a

(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

Outcomes