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.

28335 ADCs, DSPs, and FFTs.

Other Parts Discussed in Thread: TMS320F28335

Hi,

 We are working on a 28335 with the ezdsp kit, with the ultimate goal of running a 4096pt FFT to essentially work as a frequency counter. We wish to determine the frequency of a few pulsing signals that are in the range of 150MHz-152MHz. We have mixed the signal to 0-2MHz (baseband). We need to sample at 4MHz minimum (Nyquist). To get started we are using some of the example ADC codes from the library we do get some results but upon attempting to plat these resutls we get values such as 4.3 x 10^43 on both axes, which are just ridiculous numbers. We arent sure if there is a problem with our setup our simply with our graph display parameters. We also have the FFT library but would love some more info/code to help move us along, we are just students however with little to no background in any of this and are struggling to say the least. Any potential aid would be greatly appreciated if anyone has any thoughts/ideas/code/samples that could be beneficial.

Please and Thanks you,

Chris & Trent

  • You mention already having the FFT library, so I presume you are using the C2000 Signal Processing Libraries found here?

    Firstly, I would suggest making sure the ADC samples in memory look to be correct.  If you generate a known sine wave into your setup, do you see appropriate values in memory?  You should be able to plot these using a graphing window in CCS using a TIme/Frequency Graph.  You will need to adjust the resoultion appropriately and indicate the number of samples in the buffer to graph.

    Assuming this is correct and looks appropriate to scale, then I believe you can start looking at the FFT libraries and how you are interacting with them.

    Do you have access to other tools for comparison of the FFT running on the F28335?

  • Yeah those are the libraries we have bookmarked but have yet to use any of those as we were using the dsp2833x_examples bundle and trying to get certain things working individually first. We have been trying to use several of the adc examples given but were unable to achieve sensible results. When we plot our sampled data, the auto scale would place values like 7.3x10^43 on the axis. Not sure what the problem is there. We can change it to plot the samples and get a reasonable number on the x axis but the y axis is still a ridiculous number. So we have yet to get beyond that to begin using the FFT librarires.

    No other tools are coming to mind that we have for comparisons. Any suggestions?

  • The default setting for the graph is 32-bit signed integer, make sure you change this to 16-bit unsigned integer.  Also, if you are reading the ADC results from 0x7108-0x7117 these are left justified, so you'll to shift them back to the right by 4(or move the radix when you view the data), otherwise the values will be too big.  Another alternative is to use the result registers at 0xB00-0xB0F, these are already right justified, for 12-bit data.  Another option would be to export the data and load it into Excel, just to make sure the graph tool is/is not the problem.

     

    Best,

    Matthew

  • After a few days of toying around, we are no further now then we were. We were already changing to 16 bit unsigned, our data is from 0x7108-0x7117 and we are shifting by 4. We are actually using the example codes given. We have also tried taking the hex value date from our buffer and plotted it in excel. It looks nowhere near the sine wave we are putting into it. If we convert the radix to decimal/float/scientific, they all show our readings as the same numbers we were getting, which is something along the lines of 3.9xe-39 give or take 5xe-/+4. Our ultimate goal is to perform an fft on the 0-2MHz spectrum to detect a pinging transmitter for tagging to endangered animals and display its frequency. We are nowhere near accomplishing this goal. Also, to achieve the frequency within our desired accuracy of 1KHz (They are 150-152MHz signals that we mix to 0-2MHz before using our ezdsp) we were informed we need to perform a 4092pt fft but the buffer size seems to be limited to a slight smaller size of around 3966-3970. Any thoughts or suggestions would be greatly appreciated, we are at a loss and have a deadline approaching. Any further details required from us to answer any questions would gladly be provided.

    Thank you,

    Chris

  • Chris,

    I'd take a step back to debug the ADC values, without worrying about the FTT, or even a frequency into the ADC.  Just convert a DC voltage like 1.5V(mid range).   You should be getting close to 2048.  I'm not sure how you are translating the ADC results to get such extreme float values.  The ADC gives a 12-bit integer results from 0- 4095, or 0 - 0x0FFF(right justified).

    I believe you mentioned you have the header file examples, you can use Example_2833xAdcSeqModeTest example which will convert channel A0 2048 times.  The setup used for the ADC will be similar to what you will need for FFT later; but I want to make sure the ADC is converting properly. 

    Externally, the only gotcha with the ADC is that pin ADCLO is connected to VSSA(analog ground).  This is the ground reference for the ADC, if left floating ADC will give garbage values.

    Best,

    Matthew

  • Hi guys,

    Some progress it seems. Our graphs look visually appropriate, but we still have the extremely large or extremely small float values on our x axis. An RF engineer we've been consulting has suggested that the values given are memory locations and we need to translate them into real values by using an offset. Any suggestions on how to do that? Also, we are unable to run a 4092 pt fft as there is not enough memory allocation to create buffers of that size, but I am absolutely certain that our ezdsp has enough memory to perform this task. Upon inspection it seems that our memory being used is in L4 SARAM, there are other levels but it doesn't seem to automatically access these, any advice on how to allow it to use more of the available memory? Thanks for the help thus far, you guys are life savers.

  • Open a memory window in CCS and point the starting address to the first address of your buffer variable.  Select a convenient point in your code to set a break point and run.  The memory window should refresh (changed values highlighted in red) with values that are 12-bits.  I would suggest changing the memory view to be 16-bit data and therefore you should see the bottom 3 nibbles change.  The most significant nibble should be 0.

    The TMS320F28335 12-bit ADC does not generate float numbers, but 12-bit data with a dynamic range of -2048 to +2047, if read from Peripheral Frame 0 which right justifies the 12-bit data.

    You may have read the ADC values from Peripheral Frame 2 which left justifies the 12-bit value to the most significant bits of a 16-bit value.

  • When graphed using single time and 32 bit floating point our sine wave signal (20KHz), sampled at 50KHz, is almost perfectly replicated when we graph the values in InBuffer[ ] which I think would be the values that came out of our ADC that have yet to have our FFT ran on them?  InBuffer[ ] is a float32. The Y  axis scale is -4096 to 4096 but of course all of our data is positive. We've read in the data sheet that any negative voltages are represented as 0 and voltages above 3v are clipped to 4096. Meaning our ADC displays a dynamic range of 0 to 4096 as opposed to the -2048 to 2047 you suggested. That gives me the impression our ADC is working fine, agree? Eventually we want to sample at 4MHz but at 150MHz speed the divisions to determine sample rate do not divide to 4 easily. Are there any side effects from changing our system speed to 120MHz in "DSP2833x_examples.h" a pre-built file we've incorporated. I guess at this point I should mention that we have mainly just combined the ADC_seqmodetest and rfft_f32u packages to generate the code we are using. Any potential conflicts there? Also, if we graph the fft magnitude of InBuffer as above we get a reasonable looking fft graph as well but still with outlandish x axis values. Is there an issue with the way we are taking the adc values and graphing them as f32 with some degree of success just a fluke? Are major changes necessary?

    After writing the above I tried to view the InBuffer values in memory as 16bit values and the MSB was rarely 0 as expected. I have no idea which Peripheral Frame (if any) I was viewing or how to determine so.

    Struggling away,

    Chris

  • Quick update:

    We are in cascaded mode and are reading from peripheral frame 2, andare shifting right 4 as per the code from adcseqmodetest. So that shouldnt be a problem. Also, we created a duplicate of InBuffer as an Uint16 and viewed its data in memory as described above, 16 bit with the MSB as 0.

  • Hi guys, been a few days, deadline is tomorrow, we are painfully close. We got it running, we can determine our incoming frequencies, and we are now trying to output our results serially. We incorporated the echoback example and manage to get it to output the Hello World message. All we need to accomplish now is to output our float32 value. We cant seem to get the conversion done properly as the msg outputted is a char *. We tried using the SYS_sprintf function as well but got errors with our  .out file not building.  We had

    SYS_sprintf(result,"%3f3", frequency);

     where result is a char[10] and frequency is a float32. Is there an easy conversion to be done to output our float32 value or a fix for the build error?

    Thanks again, the help has been fantastic,

    Chris

  • Got it all completed, working to an acceptable standard, there is certainly room for improvements but that will have to come later.

    Thanks for all the help here, you uys were great!

  • Hey Chris, Which FFT library did you use for 28335? the sprc081 from TI is for 28xx, I was wondering are there any FFT libs provided by TI for 28335? Appreciate your help.

    regards,

    Nams

     

  • The C28x Floating-Point Unit Library (sprc624) has a real FFT optimized for the floating point unit on the 28335

    http://focus.ti.com/docs/toolsw/folders/print/sprc624.html

    -Lori