2013-03-15 06:29 AM
Hi,
I am trying to do 256pt-FFT on Audio data. The data is in stereo( LR) format. When I am doing FFT on only 1 channel data i.e Left then my system is running fine but as soon as I apply FFT on Right channel the system enters hard fault state. What seems to be the problem ? Here is the code/*ARM CMSIS variables*/arm_status armstatus;
arm_cfft_radix4_instance_f32 cfft_instance1; /* CFFT Structure instance */
arm_cfft_radix4_instance_f32 cfft_instance2; /* CFFT Structure instance */
/* CFFT Structure instance pointer */
arm_cfft_radix4_instance_f32 *cfft_instance_ptr1 = (arm_cfft_radix4_instance_f32*) &cfft_instance1;
arm_cfft_radix4_instance_f32 *cfft_instance_ptr2 = (arm_cfft_radix4_instance_f32*) &cfft_instance2;
/* Initialize the CFFT function to compute 256 point fft */
armstatus = arm_cfft_radix4_init_f32(cfft_instance_ptr1, _MAX_SS/2, 0, 1);
armstatus = arm_cfft_radix4_init_f32(cfft_instance_ptr2, _MAX_SS/2, 0, 1);
/*Separate Right and Left Channels*/
chan_sep(R_buffer2,L_buffer2,buffer2,_MAX_SS);
/* Transform input a[n] from time domain to frequency domain A[k] */
arm_cfft_radix4_f32(cfft_instance_ptr1, (float32_t*)L_buffer2);
//arm_cfft_radix4_f32(cfft_instance_ptr2, (float32_t*)R_buffer2);<-- Hard Fault occurs
#fft #hardfault #stm32f4-discovery #-
2013-03-15 06:51 AM
Well the most likely is you have some data structure that is being touched out of bounds, or corrupting the stack or heap.
The general way to solve this is to use a proper hard fault handler, identify the CPU context/state and registers at the fault, identify the faulting instruction, and determine why it faulted. The memory it is touching should give you some indication of what it was attempting to do, or which structure it was addressing. Work backward from the fault, and pin point where the real cause might be, do a bisection of the problem as required. If you want others to debug, please provide a complete free standing example that others can compile and test quickly.