cancel
Showing results for 
Search instead for 
Did you mean: 

Hardfault and NMI interrupts issue

usama.s
Associate

Softwares Details:

µVision IDE : version 5.31.0.0

STM32CubeMx : version 5.4.0

Hardware Details:

Mcu: STM32G030K6T6

Programmer : STLink-V3Mini

Work Description:

I configured 3 pins of mcu as external interrupts triggering on both rising and falling edges from STM32cubeMx. Now when i press buttons interrupts and every thing is working fine in code but sometimes it mess up.

Problem:

The issue iam currently facing is sometimes when i press buttons due to some reason NMI or HardFault interrupts occur and code stuck into NMI_Handler or HardFault_Handler functions in the c file stm32g0xx_it.c.

I spent hours on debugging but couldn't figure out the problem. Any help would be appreciated!

Attached is .rar file of complete project.

2 REPLIES 2
TDK
Guru

No need to double post:

https://community.st.com/s/question/0D53W00000KF4KRSA1/nmi-and-hardfault-interrupt-issue

If you feel a post has answered your question, please click "Accept as Solution".
alister
Lead

I'd try to help if I might know the answer. But time's short. Try posting a snippet of the part that's failing. Shorter the better.

BTW Google switch debounce. It's one of the most discussed topics for students. Also check you've a good grasp of interrupts, and edge interrupts, and check you've considered that edges may occur faster than your core can interrupt, and check how you're state-machining the debounce and signalling the app of your integrated button-press events.