You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In stm32h7xx_hal_timebase_tim.c, the HAL_InitTick() function enables the selected timer's IRQ before initialization the timer handle. When a software reset occurs (under debug), this results in the interrupt firing as soon as it is enabled, resulting in a HardFault because the handle has not been initialized. The htim6.Instance is equal to 0 when the interrupt occurs.
How to reproduce the bug (skip if none)
In CubeMX, select TIM6 source for SysTick
Build, load and run project under debug
Restart program (still under debug)
HardFault occurs within HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
Describe the set-up
Describe the bug
In stm32h7xx_hal_timebase_tim.c, the
HAL_InitTick()
function enables the selected timer's IRQ before initialization the timer handle. When a software reset occurs (under debug), this results in the interrupt firing as soon as it is enabled, resulting in a HardFault because the handle has not been initialized. Thehtim6.Instance
is equal to 0 when the interrupt occurs.How to reproduce the bug (skip if none)
HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
Additional context
A simple solution would be to move the IRQ enable after the timer initialization. For example:
stm32h7xx_hal_timebase_tim.c.patch
Screenshots
The text was updated successfully, but these errors were encountered: