HardFault after EXTI and starting & resetting timer SOLVED
Hi
I get a hardfault as soon as the HALL sensor (which is connected & set up using CubeMX & EXTI GPI(O)) gets an interrupt.
I have debugged the code to the part where I can safely say that the hard fault only occurs when the " __HAL_TIM_SET_COUNTER(&htim2, 0);" is involved.
EXTI is working properly, that's not my problem, my problem is the hardfault I get when trying to reset the timer / do anything with the timer.
My Question now is, do you spot any mistake in the code below that could cause the Hard Fault?
If no, how could I debug this?
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if ((GPIO_Pin == (Hall1_IN_Pin || Hall2_IN_Pin)) && e_ProgramState == Menu)
{
HAL_TIM_Base_Start(&htim2);
}
if(GPIO_Pin == Hall2_IN_Pin)
{
__HAL_TIM_SET_COUNTER(&htim2, 0);
}
}Best regards
edit
Problem was solved using the Fault Analyzer in CubeIDE where I found out I had a division by Zero which caused the HardFault, nothing to do with the EXTI or Timer
