2020-10-06 06:39 AM
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.
2020-10-06 08:04 AM
>>I spent hours on debugging but couldn't figure out the problem.
With hard faults you need to look critically at the MCU registers and the code at and approaching the fault. There's usually a pretty distinct reason for a failure.
For Keil make sure the stack size is adequate, check size in startup.s, check usage/depth