2025-08-05 8:02 PM
Hello everyone!
We are trying to enable the RTC with FreeRTOS on the STM32U575AII6. The settings are as follows:
1.RCC
2.RTC
3.Clock
4.freeRTOS
Code
void Debug_Printf(char *format, ...)
{
char buf[128];
va_list args;
va_start(args, format);
uint16_t len = vsnprintf((char *)buf, sizeof(buf), (char *)format, args);
va_end(args);
HAL_UART_Transmit(&huart1 ,(uint8_t *)buf,len,150);
}
void RTCTask(void *argument)
{
/* USER CODE BEGIN RTC_TASK */
RTC_DateTypeDef Date;
RTC_TimeTypeDef Time;
/* Infinite loop */
for(;;)
{
HAL_RTC_GetTime(&hrtc, &Time, RTC_FORMAT_BIN);
HAL_RTC_GetDate(&hrtc, &Date, RTC_FORMAT_BIN);
Debug_Printf("%02d:%02d:%02d\n",Time.Hours, Time.Minutes, Time.Seconds);
osDelay(1000);
}
/* USER CODE END RTC_TASK */
}
and the result output
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:01\n"
"10:10:02\n"
"10:10:02\n"
"10:10:02\n"
"10:10:02\n"
"10:10:02\n"
The seconds displayed above are wrong.
Any suggestions would be greatly appreciated. Thanks in advance!
2025-08-05 8:56 PM
Is the rate of printing (once per second) correct?
If you clock it with LSI, does it work as expected? If so, LSE isn't working right.