cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to HAL_RTC_SetTime in STM32U585 with TrustZone enabled

erosghignoni
Associate

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. 

erosghignoni_0-1758896897230.png

erosghignoni_1-1758896908409.png

erosghignoni_2-1758896915497.png

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

 

0 REPLIES 0