Hi Everyone,
I have a program that contains two functions. Whenever I run both functions, the program would crash and enter the PE_ISR(Unhandled_ivINT_Hard_Fault) error. Function A reads temperature from a temperature sensor via the I2C bus every 3 seconds. Function B returns a sensor status via the UART whenever the user requests the function to send the status.
The main issue is when both functions are allowed to run, if the user calls function B 5-6 times the program crashes and enters the PE_ISR(Unhandled_ivINT_Hard_Fault). Once the program crashed and restarted. Any subsequent call to function B will make the program to crash.
However, if each function runs independently (commented one function, and allowed the other function to run) I won’t get any ivINT_Hard_Fault error at all.
I’m using Kinetis K64 microcontroller, and I’ve tried to increase the stack size but that didn’t prevent the program from crashing.
Based on the below report I think the crash is within the I2C, but don’t know what causes to crash.
Report:

Disassembly view @ address 0x25CA:

I’ve been working on this issue for about 3 days without any luck. Does anyone have any suggestions that I can try/test?
Sincerely,
Vu