2021-02-08 05:01 AM
2021-02-12 01:53 AM
Hello
I found, certainly related to updating the HAL layers and the configuration of the watchdog IWDG.
it works with:
hiwdg.Init.Prescaler = IWDG_PRESCALER_32;
hiwdg.Init.Window = IWDG_WINDOW;
hiwdg.Init.Reload = 1000;
it does not work with:
hiwdg.Init.Prescaler = IWDG_PRESCALER_4;
hiwdg.Init.Window = IWDG_WINDOW;
hiwdg.Init.Reload = 259;
For infomormation
#define IWDG_WINDOW IWDG_WINDOW_DISABLE
I wished to have a watchdog at 500ms. i
In the good configuration , it is 1s .
2021-02-08 05:10 AM
205 / 5000
Hello
I want to use the IWDG component.
I activated the module with HAL_IWDG_MODULE_ENABLED and configure the clocks (LSI):
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV4;
RCC_OscInitStruct.PLL.PLLN = 70;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV10;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV5;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
Here is my source code to initialize the watchdog:
IWDG_HandleTypeDef hiwdg;
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_32;
hiwdg.Init.Window = IWDG_WINDOW;
hiwdg.Init.Reload = IWDG_RELOAD;
if (HAL_IWDG_Init(&hiwdg) != HAL_OK)
{
Error_Handler();
}
with :
#define IWDG_WINDOW IWDG_WINDOW_DISABLE
#define IWDG_RELOAD 1500
When the HAL_IWDG_Init function is executed, the microcontroller arrives in HardFault_Handler
The following operation goes wrong: IWDG_ENABLE_WRITE_ACCESS (hiwdg);
Do you have any ideas ?
Thank you in advance.
2021-02-08 11:32 PM
Hello @pierre-yves ,
Which STM32CubeG0 MCU package are you using?
Please make sure to use the latest release of CubeG0 package as contains a fix in HAL_IWDG_DEFAULT_TIMEOUT define related to IWDG start-up timeout insufficiently low issue.
Imen
2021-02-10 01:17 AM
Hello
To test, I modified the define:
#define HAL_IWDG_DEFAULT_TIMEOUT 2000
it is indeed the macro IWDG_ENABLE_WRITE_ACCESS (hiwdg) which generates an error (HardFault_Handler).
I also changed the values
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_128;
hiwdg.Init.Window = IWDG_WINDOW;
hiwdg.Init.Reload = 4095;
Not easy .... any ideas? .. I block
Thnak you
2021-02-10 06:40 AM
In fact it is indeed a timeout error made by the HAL_IWDG_Init function. But I don't know what to do.
I am in version 1.3.0 at the HAL software
2021-02-10 07:03 AM
Hi @pierre-yves ,
I advise you use the latest release of STM32CubeG0 MCU package (version 1.4.0) as contains a fix in IWDG driver.
Then, please keep me updated on your progress on this issue.
Imen
2021-02-12 01:06 AM
Hello
Thank you for your comeback.
I updated the HAL layers to version 1.4.0.
I have the same problem.
it is this operation that goes wrong: IWDG_ENABLE_WRITE_ACCESS (hiwdg); i.e. hiwdg-> Instance-> KR = IWDG_KEY_WRITE_ACCESS_ENABLE,
Can you help me ?
2021-02-12 01:53 AM
Hello
I found, certainly related to updating the HAL layers and the configuration of the watchdog IWDG.
it works with:
hiwdg.Init.Prescaler = IWDG_PRESCALER_32;
hiwdg.Init.Window = IWDG_WINDOW;
hiwdg.Init.Reload = 1000;
it does not work with:
hiwdg.Init.Prescaler = IWDG_PRESCALER_4;
hiwdg.Init.Window = IWDG_WINDOW;
hiwdg.Init.Reload = 259;
For infomormation
#define IWDG_WINDOW IWDG_WINDOW_DISABLE
I wished to have a watchdog at 500ms. i
In the good configuration , it is 1s .