STM32F4 - HardFault_Handler / HAL_TIMEOUT errors
- September 23, 2022
- 5 replies
- 6180 views
Hello!
We have 2 identical custom PCB using STM32F446RE MCU, we encounter the following issues and we can't find out what is happening.
I'll try to explain the best I can such problem, testing boards with simple LED blinking program:
while (1)
{
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_10);
HAL_Delay(500);
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_9);
HAL_Delay(500);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}board 1:
Program sometimes goes to HardFault with:
- HCLK Clock = 82 Mhz
- HSI RC = 16 Mhz
Program stops at HardFault_Handler with:
- HCLK Clock >= 83 Mhz
- HSI RC = 16 Mhz
Same happens with HSE = 16 Mhz
board 2:
Program sometimes goes to HardFault with:
- HCLK Clock = 75 Mhz
- HSI RC = 16 Mhz
Program stops at HardFault_Handler with:
- HCLK Clock >= 76 Mhz
- HSI RC = 16 Mhz
Here with HSE it gives HAL_TIMEOUT error when calling SystemClock_Config(), with the following values when debugging inside HAL_RCC_OscConfig:
- tickstart = 101
- HAL_GetTick() -> uwTick freezes at 101
External crystal is connected with 26pF caps
I add .ioc, main.c and pictures of front and back copper layer for the PCB as well as schematics.
We would greatly appreciate your thoughts.
Thanks in advance!