2026-05-28 1:01 AM - last edited on 2026-06-02 1:59 AM by mƎALLEm
I have a STM32F427 bootloader code, the jump from bootloader to application is working before enabled IWDG. The IWDG configuration is as followings: -
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_256;
hiwdg.Init.Reload = 1000; // 8S, 1000*8ms=8000ms=8S
After enable the IWDG, the jump from bootloader to application is failed, and it keep reseting every 8 seconds. There is Watchdog refresh code before and after time consuming functions and the main while loop: -
while (1)
{
...
if (bl_uart_status==BL_NACK)
{
#ifdef ENABLE_WATCHDOG
HAL_IWDG_Refresh(&hiwdg);
#endif
bl_retry_cnt++;
LED0=0;
}else {
#ifdef ENABLE_WATCHDOG
HAL_IWDG_Refresh(&hiwdg);
#endif
...
The bootloader is running with the following clock setting: -
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
Do you have any idea why the watchdog timeout happens even HAL_IWDG_Refresh(&hiwdg) is added?
FYI, I have also added the watchdog refresh at bootloader before jumping and at the application's SystemInit().
Thank you.
Melfice
2026-06-01 12:00 AM
I have modified the .ini file for running bootloader before debug application. And I catch the bug at
2026-06-01 9:01 PM
Google result: "STL_InitClock_Xcross_Measurement() is part of STMicroelectronics’ IEC 60335 Class B Safety Library (often delivered as X-CUBE-CLASSB for STM32 MCUs).
It is used to initialize the clock cross-check measurement mechanism, which is a safety feature that verifies the main system clock against an independent reference clock (usually LSI or HSI) to detect clock failures."
Since it is ST software, you can ask ST for support.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.