cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G4 Interrupt not working. The program always run default handler.

FCHEN.2
Associate

The code is generated by CubeMX. And every time program run into HAL_TIM_Base_Start_IT() like the figure below, the system will block in Default Handler. 0693W00000YALAhQAP.pngHowever, the TIM2_IRQHandler is defined in stm32g4xx_it.c.

0693W00000YALBaQAP.pngDoes anyone have idea why it doesn't work? I also attach the code.

1 ACCEPTED SOLUTION

Accepted Solutions

Code looks OK.

Check if the user FLASH is mapped to 0x00000000; in other words, check, if you don't boot into the default bootloader in System Memory.

Also check SCB_ICSR.VECTACTIVE value.

JW

View solution in original post

3 REPLIES 3
KnarfB
Principal III

Your project works on my B-G431B-ESC1, tim_ticker incrementing as expected. STM32CubeIDE asked for migrating to the latest revision, what I did.

STMicroelectronics   STM32CubeMX   6.7.0.202211181646   com.st.stm32cube.common.feature.mx

STM32CubeIDE Version: 1.11.0 Build: 13638_20221122_1308 (UTC)

hth

KnarfB

Code looks OK.

Check if the user FLASH is mapped to 0x00000000; in other words, check, if you don't boot into the default bootloader in System Memory.

Also check SCB_ICSR.VECTACTIVE value.

JW

Thanks! The problem is the boot mode. When I set boot from System memory, the program works well.