AnsweredAssumed Answered

STM32L432KC RTC Init Fails after DFU

Question asked by riggs.rob on Feb 15, 2017
Latest reply on Feb 14, 2018 by Gasper Korinsek

I created a PCB based on the STM32L432KC.  It uses an LSE for the RTC.  I am using STMCubeMX 4.19.0 to create the initialization code with version 1.6.0 of the STM32L4 HAL library.

 

The system starts up fine from a reset, but when exiting the DFU, it ends up calling the error handler in MX_RTC_Init().  I've tried disabling the LSE in the clock configuration (using LSI).  The results do not change.

 

This is the initialization code (from STM32CubeMX -- I only updated the error handler).

/* RTC init function */
static void MX_RTC_Init(void)
{
    /**Initialize RTC Only
    */

  hrtc.Instance = RTC;
  hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
  hrtc.Init.AsynchPrediv = 127;
  hrtc.Init.SynchPrediv = 255;
  hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
  hrtc.Init.OutPutRemap = RTC_OUTPUT_REMAP_NONE;
  hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
  hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
  if (HAL_RTC_Init(&hrtc) != HAL_OK)
  {
    My_Error_Handler(2, 0);
  }
}

If I avoid using the RTC, the system starts up just fine after the DFU.

 

I suspect that something is not being reset properly (maybe in RCC) after DFU, but I'm not sure what that is.

 

I have read through the errata and through AN2606.  I do have the buggy bootloader in the chips I have (Version Information ID = 0xFF) but this issue is not mentioned.

 

Is this a known issue?  Did I miss some note about this behavior in an application note somewhere?

 

Thanks for any light you can shed on this issue.

Outcomes