cancel
Showing results for 
Search instead for 
Did you mean: 

Hard fault for unknown reason

HBesi.1
Associate II

Hello,

this is my function

void process_dds_ext_demod(uint16_t *inbufPtr1, uint16_t *inbufPtr2, float *in_phase_val, float *quadrature_val)

{

/*transfer DMA buffers to local Buffers-------------------*/

//transform values from int to float

float ADC1_Buf[DATASIZE];

float ADC2_Buf[DATASIZE];

arm_q15_to_float((q15_t*)inbufPtr1, ADC1_Buf, DATASIZE);

arm_q15_to_float((q15_t*)inbufPtr2, ADC2_Buf, DATASIZE);

//highpass the reference signal

float reference_i_buf[DATASIZE];

float reference_q_buf[DATASIZE];

arm_biquad_cascade_df2T_f32(&highpass_filter, &ADC2_Buf[0], &reference_i_buf[0], DATASIZE);

arm_fir_f32(&hilbert_filter, &reference_i_buf[0], &reference_q_buf[0], DATASIZE);

//calculate the quadrature buffers

float in_phase_temp_buf[DATASIZE];

float quadrature_temp_buf[DATASIZE];

arm_mult_f32(&ADC1_Buf[0], &reference_i_buf[0], &in_phase_temp_buf[0], DATASIZE);

arm_mult_f32(&ADC1_Buf[0], &reference_q_buf[0], &quadrature_temp_buf[0], DATASIZE);

//calculate mean values

arm_mean_f32(&in_phase_temp_buf[0], DATASIZE, in_phase_val); //this works

arm_mean_f32(&quadrature_temp_buf[0], DATASIZE, &dummy_val);    //this works

arm_mean_f32(&quadrature_temp_buf[0], DATASIZE, quadrature_val); //this doesnt work

}

in the last 3 instrutions is the problem. The first one works with the pointer argument of the function, for some reason the second one doesnt work and a hard fault is triggered and the third one works with an global variable. Does somebody know what the problem might be?

Best regards

1 REPLY 1

>>Does somebody know what the problem might be?

Points to an invalid address

Is misaligned

Stack overflow/corruption

Have a Hard Fault Handler that dumps actionable data and inspect the faulting instruction in the context of the MCU's registers

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..