cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 HAL RTC Library Output

KKobe.1
Associate

It appears that if the output bit is set (RTC_CR_COE) it doesn't get cleared when the RTC is initialized.

In the library code:

HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc)

{

...

 else

 {

   /* Clear RTC_CR FMT, OSEL and POL Bits */

   hrtc->Instance->CR &= ((uint32_t)~(RTC_CR_FMT | RTC_CR_OSEL | RTC_CR_POL));

   /* Set RTC_CR register */

   hrtc->Instance->CR |= (uint32_t)(hrtc->Init.HourFormat | hrtc->Init.OutPut | hrtc->Init.OutPutPolarity);

   /* Configure the RTC PRER */

   hrtc->Instance->PRER = (uint32_t)(hrtc->Init.SynchPrediv);

   hrtc->Instance->PRER |= (uint32_t)(hrtc->Init.AsynchPrediv << 16U);

   /* Exit Initialization mode */

   hrtc->Instance->ISR &= (uint32_t)~RTC_ISR_INIT;

...

}

Should the above line be:

   hrtc->Instance->CR &= ((uint32_t)~(RTC_CR_FMT | RTC_CR_OSEL | RTC_CR_POL | RTC_CR_COE));

Karl

2 REPLIES 2
Pavel A.
Evangelist III

If you believe it is a bug, you can report it here.

-- pa

KKobe.1
Associate

Thanks, I didn't know where to do that

Karl