Bus fault when running ARM DSP functions
1. I am implementing a custom extended kalman filter function. The program on running hits HardFault handler on the 4th iteration (prediction function).
2. Cortex-M4->CFSR = 0x8200 (BFARVALID=1)
3. BFAR holds : 0xa5a5a5a5
I am not able to understand where the issue lies. Whether this issue is caused by using the ARM's CMSIS-DSP module or whether it is a program logic issue, though I am inclined that the latter is more likely the issue.
How do I proceed to debug this?
Board details: STM32F429ZiT6-Discovery board with STMCUBEide running with FreeRTOS.
Since there is a lot of code, I am proceeding with adding a snippet, please ping me for more details.
typedef struct
{
arm_matrix_instance_f32 QV;
arm_matrix_instance_f32 RV;
arm_matrix_instance_f32 P;
arm_matrix_instance_f32 Q;
arm_matrix_instance_f32 R1;
arm_matrix_instance_f32 poseUpdate;
arm_matrix_instance_f32 posePred;
float32_t _QV[3];
float32_t _RV[3];
float32_t _P[3][3];
float32_t _Q[3][3];
float32_t _R1[3][3];
float32_t _poseUpdate[3];
float32_t _posePred[3];
float32_t imu_theta;
int32_t isInitialized;
float32_t wheel_radius;
float32_t wheel_base;
} KalmanFilter_t;
typedef struct
{
float32_t left_omega;
float32_t right_omega;
} sensor_data_t;
sensor_data_t testData[40] = {...};
void ekfTestFn(void *args)
{
float32_t dt = 10.0f;
KalmanFilter_t k;
ekf_init(&k);
for(int i=0; i<40; i++)
{
ekf_predict(&k, dt, &testData[i]);
ekf_update(&k, dt, testDataIMU[i], &op_estimate[i]);
}
while(1) //test complete!
{
HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_13);
osDelay(150);
}
}
