cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U575 Independent watchdog timer

Kajol
Associate

Hi,

I am using stm32u575 uc trying to use independent watchdog for time 1.2 sec for custom board.

The clock configuration is as follows:

static void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

/** Configure the main internal regulator output voltage
*/
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE4) != HAL_OK)
{
Error_Handler();
}

/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI | RCC_OSCILLATORTYPE_MSIK |RCC_OSCILLATORTYPE_LSI;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_3; // MSIRC0 @ 48MHz -> MSIS @ 12MHz
RCC_OscInitStruct.MSIKClockRange = RCC_MSIKRANGE_4; // MSIRC1 @ 4MHz -> MSIK @ 4MHz
RCC_OscInitStruct.LSIDiv = RCC_LSI_DIV1;
RCC_OscInitStruct.MSIKState = RCC_MSIK_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}

/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
|RCC_CLOCKTYPE_PCLK3;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB3CLKDivider = RCC_HCLK_DIV1;

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
{
Error_Handler();
}

// Enable the cycle count register
// See D1.2.58 in ARM v8-M Architecture Reference Manual (DDI0553B.r)
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;

//Enable the force of MSIK in stop mode
__HAL_RCC_MSIKSTOP_ENABLE();
}

I have defined the Watchdog.c and Watchdog.h files in my project 

#include "Watchdog.h"


void Watchdog_HAL_PreSchedInit(void)
{
m_iwdg.Instance = IWDG;
m_iwdg.Init.Prescaler = IWDG_PRESCALER_16;
m_iwdg.Init.Window = 0;
m_iwdg.Init.Reload = 2400;
m_iwdg.Init.EWI = 0;
if (HAL_IWDG_Init(&m_iwdg) != HAL_OK)
{
assert(false);
}
}

bool HAL_IWDG_Kick(void)
{
HAL_IWDG_Refresh(&m_iwdg);
return true;
}

I am continously calling the HAL_IWDG_Kick function at a duration of 10ms. I am unable to see the board getting reset when HAL_IWDG_Kick is not called.Can you help me with it?

1 REPLY 1
Jacob WOODRUFF
ST Employee

Hi All,

 

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.

 

Regards,
Jake

ST Support