unable to debugg Hardfault error on STM32F412ZG
Hello community,
I am trying to write time critical code which involves an STM32f412ZG Nucleo 144 board and a RPi communicating over SPI protocol. I have an IMU sensor communicating to STM32 board via I2C interface.
I have 3 tasks, which function as follows,
- Task 1 - Keep reading data from RPi via SPI 4 (DMA enabled). This task has been scheduled for 1 KHz , with Highest priority
- Task 2 - Read a certain flag which when true should execute a certain function and delete the task. This task has been scheduled for 25Hz, with lowest priority.
- Task 3 - Read the data from IMU sensor and find the Orientation. Task is scheduled for 100 Hz, with in medium priority.
The tasks 1 & 3 when executed, run smoothly and outputs expected behavior. The task 2 when executed individually also runs smoothly and outputs expected data. However, when these tasks are integrated, there is a hardfault error which occurs as soon as the code is executed.
I am new to this kind of programming and finding it very hard time to debug the issue.
I suspect that the DMA is causing the issue after looking in to the call graph of stack analyzer.
Below is the call graph snapshots.


I request the community to help me debug the issue. Please let me know if more details are required.
Thanks,
Ashish Kumar
