cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f4 hardfault

jhasa.2
Associate III

hi

I use stm32f4 micro but an external interrupt pin

when i increase frequency of the external signal connected to interrupt pin, the micro jump to hardfault

why? how I can detect the solution?

jhasa2_0-1697953350580.png

jhasa2_1-1697953356273.pngjhasa2_2-1697953358673.png

 

35 REPLIES 35
SRedd.5
Senior III

At what frequency of the external signal it goes to hardware fault? Below this frequency which function you are calling when interrupt happens?

the interrupt routine is free and i commented all the code in it.

the frequency above 3khz will be Hard Fault.

how i can see the problem detail in hard fault?

 

SRedd5_0-1697956208078.png

The sequence is step1: HAL_GPIO_EXTI_IRQHandler function is called and after that some issue happened and the hardfault handler is called. Can you show your code? In the interrupt handler can you toggle a port based on the external input signal, so both shall match for debugging purpose.

I attached my code.

Maybe something in get_sample() is causing an issue? 

Have you tried commenting out adc_read_value[adc_read_index]=get_sample(); to see if it still goes to hardfault?

If you find my answers useful, click the accept button so that way others can see the solution.

i remove all of the interrupt routine but it crashes.

only when i remove external interrupt it will be ok

why?

 

>>why?

These things don't need to be guessing games. Go identify what's actually faulting and work backward from there.

If you don't service interrupts in handlers, they'll keep entering.

Have a Hard Fault Handler that does something more useful that while(1), I've posted examples on multiple occasions on.

https://github.com/cturvey/RandomNinjaChef/blob/main/KeilHardFault.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

this data is displayed on stm32cubeide

what i should with this data?

 

What data?