2025-09-26 7:49 AM
Hi
I am working on an STM32U585 microcontroller with TrustZone enabled and I need to update the RTC time with the HAL_RTC_SetTime function. During the execution of that function, the line
status = RTC_EnterInitMode(hrtc); //stm32u5xx_hal_rtc.c
returns HAL_TIMEOUT, so I am unable to update the RTC values.
I have attached several screenshots that show the microcontroller configuration The Project Manager generates both MX_RTC_Init functions for the Secure and NonSecure zones.
The main files of both Secure and NonSecure zone execute the MX_RTC_Init function without any errors, the software starts up correctly, but at some point I am not able to set the RTC Time.
Upon debugging, I noticed that during the execution of RTC_EnterInitMode, the line
SET_BIT(RTC->ICSR, RTC_ICSR_INIT);
does not set the INIT bit, which remains at 0.
Thank you in advance for your support. Please let me know if you need any further information.
Best regards,
Eros