2021-06-24 05:14 AM
I have written a routine to exchange a struct of struct data between2 Nucleo F767ZI Boards via SPI. To check the data integrity of transmission, I am using the CRC unit. Before implementing the CRC unit, Never faced any issues, data exchange happened flawlessly. But After a few successful transmission, my slave Nucleo board goes into hard fault. This is my first time facing a hard fault error and I am kind of stuck on how to proceed.
I am actually adding Master and Slave file for your reference.
I really appreciate good guidance on how to proceed further.
Thank You !
2021-06-24 06:45 AM
> I am kind of stuck on how to proceed.
Examine the SCB registers to determine the source of the hard fault and go from there.
It seems like you have quite a scheme which completes when you receive something other than HAL_OK. You really should always get HAL_OK and if not, it suggests there's an error in your program logic or master/slave synchronization somewhere.
2021-06-24 06:58 AM
Have an effective Hard Fault Handler (not a while loop) that outputs actionable data about the state and context of the micro-controller.
Use the .MAP and listing files to inspect the instruction(s) around the fault in the context of the registers reported.
Once you understand WHAT the MCU has an issue with you can work that backward and into your top level code.
Perhaps stack or structure corruption, accessing arrays out-of-bounds, errant pointers or alignment issues.