2023-10-21 10:43 PM
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?
2023-10-23 02:59 AM
registers like r0,r1, ....
2023-10-23 03:13 AM
Hello @jhasa.2
In general, you can use the fault analyzer to dump registers content during the exception.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-10-23 03:28 AM
You're trying to understand what the MCU is objecting too based on instructions and context it is executing in.
Memory issues, alignment, stack corruption, etc. Is it consistently faulting in the same places or after certain events.
The MCU provides a bunch of data, you can use that to find the cause in your code, or significantly narrow the search to specific functions, pointers or structures.
2023-10-25 03:56 AM
most of the time my code faults in EXT Interrupt
but i can not check which section trig this section.
?
this is the fault analyzer.
2023-10-25 04:33 AM
Frankly your code is not organized properly, you have written everything in one main.c file which is not recommended, you can split into multiple files and enable one feature after other. I can see SPI communication, DAC etc. I recommend you disable all features and use verify only external interrupt code and proceed. Once you fix external interrupt you can add the modules step by step.
2023-10-25 01:11 PM
In the stack trace 20011540 is a RAM address. How you've got there? This looks like stack corruption (overwrite).
2023-10-25 08:49 PM
why the stack is corrupted?
is it related to fake micro-controller?
2023-10-26 07:12 PM
you can check the disassembly file or use fromelf tool to analyze the stack data 0x20011540, what data is stored there?
2023-10-26 07:40 PM
char received_string_data[4];
strncpy(received_string_data , RxData,12);
for (int i = 5; i < (5+2); i++) {if(received_string_data[i]!='\0') k = 10 * k + (received_string_data[i]-48);}
for (int i = 8; i < (8+4); i++) {if(received_string_data[i]!=0) k = 10 * k + (received_string_data[i]-48);}
// else k = 10 * k + (received_string_data[i]);
The array size...
2023-10-27 04:15 PM - edited 2023-10-27 04:16 PM
> why the stack is corrupted?
As @Piranha wrote - because someone overwrites an object on stack!