This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28335: f28335 adc and rfft

Part Number: TMS320F28335
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Hello, I want to use the F28335 ADC module and fpu/dsp/rfft function to do real-time time-frequency analysis for the sampled data. But in practice, following the example ti\controlSUITE\libs\dsp\FPU\v1_40_00_00\ ccsv5\2833x_rfft_adc_rt, sampling 512 data takes too much time and it did not meet the time-criteria requirement .Meanwhile, I don't want to decrease the FFT points to ensure the frequency resolution. Therefore, I want to remove the earliest 128-point data in the AdcBuf  and use the latest 128-point sample data to fill the AdcBuf, so that the interval between each FFT is the time required to sample 128 points. But I don't know how to modify the adc isr, which can make the array update run efficiently. I just used 1 channel sample.

here is the original Adc isr:

interrupt void adc_isr(void)
{
static uint16_t *AdcBufPtr = AdcBuf; // Pointer to ADC data buffer
static volatile uint16_t GPIO34_count = 0; // Counter for pin toggle

PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Must acknowledge the PIE group

//--- Manage the ADC registers
AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1; // Reset SEQ1 to CONV00 state
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1; // Clear ADC SEQ1 interrupt flag

//--- Read the ADC result
*AdcBufPtr++ = AdcMirror.ADCRESULT0; // Read the result

//--- Brute-force the circular buffer
if( AdcBufPtr == (AdcBuf + ADC_BUF_LEN) )
{
AdcBufPtr = AdcBuf; // Rewind the pointer to the beginning
FFTStartFlag = 1; // One frame data ready
}

//--- Example: Toggle GPIO18 so we can read it with the ADC
if(DEBUG_TOGGLE == 1)
{
GpioDataRegs.GPATOGGLE.bit.GPIO18 = 1; // Toggle the pin
}

//--- Example: Toggle GPIO34 at a 0.5 sec rate (connected to the LED on the ControlCARD).
// (1/48000 sec/sample)*(1 samples/int)*(x interrupts/toggle) = (0.5 sec/toggle)
// ==> x = 24000
if(GPIO34_count++ > 24000) // Toggle slowly to see the LED blink
{
GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1; // Toggle the pin
GPIO34_count = 0; // Reset the counter
}

return;
} //end of main()

I hope that when finish sampling 128 datas, the oldest 128 elements in AdcBuf(index 0-127)will be removed, and the elements (index 128-511) will move to index 0-383, the latest 128 data will occupy the position(384-511)

data update sketch diagram:

                                                                                                   AdcBuf  0-511

                                             original  index        0-127              128-511            

                                                                      | oldest data | preserved data | new 128 data | 

                                             desire index          removed          0-383                384-511

so, would you please give me some advice  to handle this problem? thank you