2026-05-28 1:01 AM
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-05-28 1:32 AM - edited 2026-05-28 1:34 AM
@melfice wrote:There is Watchdog refresh code before and after time consuming functions
And you're certain that these "time consuming functions" complete within the WD timeout period?
PS:
@melfice wrote:After enable the IWDG, the jump from bootloader to application is failed, and it keep reseting every 8 seconds.
How do you know that it's the jump from bootloader which fails ?
Does the main application run correctly without the bootloader?
2026-05-28 1:35 AM - edited 2026-05-28 1:40 AM
Yes, its timeout value is 1.5 Seconds. And if performing flash section erase, it is about Max 4 seconds.
There is LED blinking in bootloader, the first reset at the 3rd time and then it reset at the 2nd time. The jump happens after the 3rd time. Observing the second time reset, it is in bootloader.