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.
Tool/software: Code Composer Studio
I am trying to implement FFT on the F28m36x board I am using. I have used the 2837x_vcu0_rfft_512 example as a template. I have configured vcu0 unit on my board properly I believe. After compilation, I looked at the memory and see functions defined in vcu0_cfft_utils.asm and vcu0_cfft_256.asm are written to memory. I took example input from rfft_512_data.asm and pointed the fft input pointer to the data and ran the code to see if the output from the fft matched the expected output. When I looked at the disassembly I see the function label is loaded into the working registers but I don't see the assembly code for the functions within the disassembly window. I continue to step through code and see the work buffer is filled with new data but after finishing the code I look at the contents of the input buffer and the data hasn't changed. It believe that the assembly functions are supposed to write back to the input buffer if the number of points are even, in which case they are. I'm a tad bit stumped
cfft16_t fft = rfft16_512P_DEFAULTS;
ComplexShort fft_work_buffer[256];
void rfft16(cfft16_t *fft_hnd);
void main(void){
fft.ipcbptr = (int *)RFFT16_512p_in_data + 0;
fft.workptr = (int *)fft_work_buffer + 0;
fft.init(&fft);
rfft16(&fft);
int k;
int s,t,v;
for (k = 0; k<DATA_LENGTH; k++){
if(abs(RFFT16_512p_out_data[k] - RFFT16_512p_in_data[k]) > EPSILON){
s = RFFT16_512p_out_data[k];
t = RFFT16_512p_in_data[k];
v = abs(s-t);
fail++;
}
else{
pass++;
}
}
After iterating through the for loop I have 512 fails. the fft structure and functions are included in the vc0_fft.h/vcu_types.h files from the dsp library under v2_10_00_00/include/vcu0
Hi Sira,
So I was able to figure out how to step through the assembly and look at assembly code. The problem now seems to be related to this section of code from the function _cfft16_flip_re_img found in vcu0_cfft_utils.asm
RPTB FLIP_LOOP, AR1
MOV AH, *+XAR2[0];
MOV AL, *+XAR2[1];
MOVL *XAR2++, ACC
I can see in the registers the correct values from memory loaded into the accumulator, but on the store step the memory doesn't seem to change.
For example:
@0x0013250A 0xFA60
@0x0013250B 0xF876
AH: 0xFA60, AL: 0xF876, XAR2: 0x0013250A
On write back to XAR2 the contents never change. I'm not sure what the problem is.
Thanks,
Josh
Hi Sira,
Sorry to keep hitting you with questions, but I'm curious about the disassembly window. Some of the code appears like:
1293c5: 761F002B MOVW DP, #0x2b
1293c7: 4A2F TBIT @0x2f, #0xa
1293c8: 6C07 SB C$L18, NTC
1293c9: 482F TBIT @0x2f, #0x8
1293ca: 6D03 SB C$L17, TC
1293cb: 492F TBIT @0x2f, #0x9
1293cc: 6C03 SB C$L18, NTC
417 return(0);
and other parts of it look like
1293d2: FE02 ADDB SP, #2
140 MOVL *-SP[2],XAR4
1293d3: A842 MOVL *-SP[2], XAR4
141 LCR _rfft_f32_Stages1and2and3andBitReverse
1293d4: 765293DB LCR $C:/ti/controlSUITE/libs/dsp/FPU/v131/source/C28x_FPU_LIB/RFFT_f32.asm:192:356$
142 MOVL XAR4,*-SP[2]
1293d6: 8A42 MOVL XAR4, *-SP[2]
143 LCR _rfft_f32_Stages4andUp
1293d7: 76529447 LCR $C:/ti/controlSUITE/libs/dsp/FPU/v131/source/C28x_FPU_LIB/RFFT_f32.asm:363:590$
144 SUBB SP,#2
1293d9: FE82 SUBB SP, #2
145 LRETR
1293da: 0006 LRETR
192 PUSH XAR1
I can see that they are referring to the lines from the assembly file. Does the difference stem from assembly in an .asm file vs. assembly generated from the C code?
Also some of the labels for the functions are written as a directory pathing and others are basic labels. Could that be the reason I'm hard faulting?
ex:
0x1293DB: $C:/ti/controlSUITE/libs/dsp/FPU/v131/source/C28x_FPU_LIB/RFFT_f32.asm:192:356$, rfft_f32_Stages1and2and3andBitReverse
0x12943A: rfft_32_Last
Both functions are written in the same file so it seems weird that they are displayed differently.
Thanks,
Josh
Joshua,
Have you been able to successfully run the TI provided 2833x_RFFT example project from C2000Ware without any modifications? That would be the first step.
Then we can discuss what is happening in your project. What's the difference between your project the 2833x_RFFT project? I presume your project is your specific application where you want to implement FFT functionality, and you are bringing in the pieces from the 2833x_RFFT project?
Things to check in your project would be the Linker command file, libraries linked to in the project (see picture below), header files to include (math.h), and pay attention to any Warnings generated after the build.
Hi,
So what I ended up doing to test whether or not the functions were working I created a new function called float sinf_new(void)/cosf_new and copied over the code from sinf()/cosf() defined in s_cosf.c and s_sinf.c and ran my code. It appears to be working. So what I'm seeing is when I run the original code, I'm taken inside the function but the function background is greyed out and where I've seen that before is when I didn't have a preprocessor symbol defined.
#if __TI_HAS_F32_HARDWARE && !__TI_HAS_F64_HARDWARE is included above the function definition. Should I be placing this in my predefined symbols?
Right now I removed all the 2833x_RFFT code and I'm replacing it with the 2837x_RFFT code and I'm inserting code sections one at a time to see where any errors occur, while using the redefinition of the sin and cos functions.
Thanks
Josh
Hi Sira,
So I started with the adc_soc f28m36x project on the c28x side and the UART project on the arm side. I was able to correctly implement the functionality that I was looking to achieve. That's when I started trying to port over the fft algorithms from the examples provided in the control suite. Right now I have the FPU working and I'm populating the FFT arrays properly after calls to the sin cos function. I believe I have my linker properly setup because I ran what I have and looked at how the program executes in the disassembly and memory viewers. The only issue I'm seeing right now is in the call to the sin and cos in the sinf.c and cosf.c. The whole block defining both functions are grayed out so I believe that means that the functions aren't included during compilation, since the code executes when I remove it from the #ifdef FPU32 && !FPU64 block. The reason I believe its a preprocessor symbol issue is because when I add the USE_TABLES statement I see the sections of code that were greyed out under that label become white.
Thanks,
Josh
Hi Sira,
I was finally able to get the project running. The only remaining issue I have involves calls to sin and cos. As I was previously saying I've had to define a new function to implement the cos and sin functions. When I add the statement __TI_HAS_F32_HARDWARE && !__TI_HAS_F64_HARDWARE to my predefined symbols the compiler tells me that I have an error which states that there are no source codes and it has nothing to do. But outside that everything else works perfect.
Thanks,
Josh
Hi Sira,
Thanks for the response. I have a few things I need to work on before getting back to the project. I will try to run it in real time when I get the opportunity and I will let you know what happens.
Thanks,
Josh
Hi Sira,
Is there a tool in code composer to measure the execution time of the fft?
Thanks,
Josh
Hi Sira,
My issues have been resolved and just wanna say thanks for all the help.
Thanks,
Josh