2025-08-28 9:14 AM - edited 2025-08-28 9:14 AM
Hello,
In the STM32CubeC0 v1.4.0, when I enable the BYPSHAD bit in the CR register and later try to deinit the device, I get an ERROR. It does not happen if I disable it before deinitialising. Should I disable it by hand, or is it a mistake and should be cleared as in other families? HAL version is clearing the whole register to the reset value when deinitialising.
Best regards,
Tomáš
2025-08-29 3:15 AM
Hello @Tomáš Juřena
The RTC Control Register (CR) is cleared at the beginning of the HAL_DeInit() function.
What type of error are you encountering, and which instruction is returning this error?
2025-08-29 3:39 AM
Hi,
I have noticed that I mentioned I use LL libraries only in the post subject. Let me try to clarify this.
The function call LL_RTC_DeInit returns an ERROR value when I enable the BYPSHAD bit beforehand. If I do not enable the bypass function or disable it before calling the LL_RTC_DeInit function, the SUCCESS value is returned.
I got the timeout in LL_RTC_WaitForSynchro at stm32c0xx_ll_rtc.c:682.
Best regards,
Tomáš
2025-08-29 7:28 AM
Hello @Tomáš Juřena
Thank you for bringing this issue to our attention.
I reported this internally.
Internal ticket number: 216570 (This is an internal tracking number and is not accessible or usable by customers).
2025-09-03 11:29 PM
Hello @Saket_Om
thanks for creating a ticket for this. Does it mean it is a bug? Will it be resolved in the near future?
Best wishes,
Tomáš
2025-09-04 12:03 AM - edited 2025-09-04 12:13 AM
Looking at stm32c0xx_ll_rtc.c, in LL_RTC_DeInit(), LL_RTC_WaitForSynchro() is called "unconditionally", whereas all other calls of LL_RTC_WaitForSynchro() (in LL_RTC_TIME_Init() and in LL_RTC_DATE_Init()) are guarded by LL_RTC_IsShadowRegBypassEnabled().
So yes, I'd call it a bug, and I'd expect it to go across all STM32 families' Cube/LL.
As Cube is open source, you can fix it yourself, by adding the same guard to LL_RTC_DeInit().[EDIT] On second thought, IMO the guard should be moved into LL_RTC_WaitForSynchro() itself. [/EDIT]
Another solution may be to avoid calling LL_RTC_DeInit() and resetting the whole backup domain through RCC_BDCR.BDRST. I don't use Cube so don't know if there's any ready-made function for that.
JW