cancel
Showing results for 
Search instead for 
Did you mean: 

STM32C071 LL RTC Deinit error when BYPSHAD enabled

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áš

5 REPLIES 5
Saket_Om
ST Employee

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?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om

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áš

 

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).

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om

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áš

waclawek.jan
Super User

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