最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

stm32 - Window Watchdog (WWDG) wakeup interrupt doesn't work - STM32H7 - Stack Overflow

programmeradmin3浏览0评论

I have 2 questions for window watchdog:

  1. I have an STM32 micro and I want to just check my window watchdog and use the wakeup interrupt for write some code before the system reset, But the interrupt doesn't occur as I know.

  2. In my configuration setting window value < counter value didn't work at all
    and the micro seems even not working(which it says window can be less and equal to the counter value).

But my main question is 1, and 2 might just show some hints about my configurations.

This is my configurations for WWDG:

hwwdg1.Instance = WWDG1;
hwwdg1.Init.Prescaler = WWDG_PRESCALER_128;
hwwdg1.Init.Window = 127;
hwwdg1.Init.Counter = 127;
hwwdg1.Init.EWIMode = WWDG_EWI_ENABLE;
if (HAL_WWDG_Init(&hwwdg1) != HAL_OK)
{
  Error_Handler();
}

and this is my main code which I just turn on a yellow LED at first and when the counter reach over the 500, the delay is more than the watchdog refresh time and it will eventually trigger watchdog to reset the micro after about 4-5 seconds(it is for my test and during this 4-5s LED should be yellow):

int main(void)
{

  MPU_Config();
  HAL_Init();

  SystemClock_Config();


  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_CRC_Init();
  MX_RTC_Init();
  MX_WWDG1_Init();

HAL_WWDG_Refresh(&hwwdg1);
    
HAL_GPIO_WritePin(AlarmLEDsVDD_GPIO_Port, AlarmLEDsVDD_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(YellowLEDs_GPIO_Port, YellowLEDs_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(RedLEDs_GPIO_Port, RedLEDs_Pin, GPIO_PIN_RESET);

HAL_GPIO_WritePin(AlarmLEDsVDD_GPIO_Port, AlarmLEDsVDD_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(YellowLEDs_GPIO_Port, YellowLEDs_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(RedLEDs_GPIO_Port, RedLEDs_Pin, GPIO_PIN_RESET);

int counter = 490;
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
        HAL_WWDG_Refresh(&hwwdg1);
        HAL_Delay(counter++); // limit is about 507-510 delay
  }
  /* USER CODE END 3 */
}

and my interrupt is here which never triggered(in stm32h7xx_it.c):

void WWDG_IRQHandler(void)
{
  /* USER CODE BEGIN WWDG_IRQn 0 */
    
  /* USER CODE END WWDG_IRQn 0 */
  HAL_WWDG_IRQHandler(&hwwdg1);
  /* USER CODE BEGIN WWDG_IRQn 1 */

  /* USER CODE END WWDG_IRQn 1 */
}
发布评论

评论列表(0)

  1. 暂无评论