PDA

View Full Version : Fast ADC reading


sobyrne
10-06-07, 02:46 AM
I would like to acquire data with the Servopod USB faster than the ANALOGIN word allows. I need 100 000 samples per second, which is possible for the chip.

This will probably require me to write machine code for the DSP56F807. I don't know too much about machine code for these machines, except that I can write the hex directly in a forth CODE word using P, . I want the acquisitions to be at regular intervals, and looking at the Freescale 807 manual it seems like one of the counters can be configured to set a sync pulse to the ADC. Can someone point me to any example assembly code or forth code for reading the ADC input in this way at high rates?

Thanks,

Sean

nmitech
10-09-07, 10:45 PM
A similar question/answer for fast ADC sampling rate is posted here,
http://www.newmicros.com/discussion/showthread.php?t=3602



Originally Posted by pokoRanger

my hope this do the AD conversion of audio sound at a sufficient rate (maybe around 20khz) with Minpod and send the result to MATLAB using serial communication interface.

Replied by RMD

Let's think about this a moment and see if it even possible. First we need to consider the serial channel. If we assume 115200 BAUD and using 1 start 8 data and 1 stop, it takes 10 bits to send a byte. So our maximum character rate is 11520 per second. If your readings were just 8 bits, a single character, you couldn't get half as many characters out the serial channel as you wished. Plus, the PC's are usually hard pressed to capture data coming that fast. It's just the overhead of windows that tends to get in the way.

The 'Pod is fast enough to take A/D data, up to about 200K. But the problem is the speed of the serial. You could send it out faster via SPI or CAN. Or perhaps capture it in internal memory, or on a SPI based SD/MMC card.

Please advise if you have another idea, however, 20K on the serial port is not practical.


With a sampling rate at 100,000 samples per second. Hardware wise, I don't think CAN port (1Mbps max), nor Serial (2.5 Mbps max), nor Internal memmory storage can handle. Maybe SPI port (20Mbps max), or SPI based SD/MMC card uses for storage application is possible, and most likely machine language must be used in this case.

For your reference, there are couple machine code examples available on this appnote,
http://www.newmicros.com/store/product_manual/asmprog.pdf

and Machine language is described in this reference manual,
http://www.freescale.com/files/dsp/doc/ref_manual/DSP56800FM.pdf

RMDumse
10-14-07, 10:44 PM
You could get an additional level of speed by going directly to the A/D registers, rather than using the OO based words like ANALOGIN, however, the bottle neck would continue to be how fast you could get data up throught the serial to USB connection, limited to 115200. Other "off" bauds might be possible, but they wouldn't be the standard rates the PC normally uses.

sobyrne
11-06-07, 06:40 AM
Thank you for your reply. We don't need to send the data quickly to the computer, but I do need to acquire it quickly, about 1000 samples at a time. We then process that data on the Servopod and send the result of the calculation (much slower, and only about 8 bytes) via the USB port, before the next burst of data is acquired. So data transfer rate should not be a problem for this application. Looks like we'll need to investigate the inline code words and program the registers directly, as you suggest.

Sean

nmitech
11-06-07, 12:19 PM
You still can get more than 1000 samples per second using the ANALOGIN word and save data to memory. For your convinience, here is an example to program the ADC registers directly,

http://www.newmicros.com/isopod/appnotes/ADC.txt

sreeja
11-07-07, 01:12 AM
I want to know about this ADC reading

RMDumse
11-07-07, 05:11 PM
Could you explain a bit more on what you don't know about the A/D reading you are interested in knowing?