|
|
high speed ADC sampling and USB
|
|
Date: 2006/04/10 11:10
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |   | |
|
I know a few of you are currently trying to do reasonably high speed ADC sampling with the various usb pics, and was hoping this could be a thread where we can pool our resources. It is something I am about to start work on shortly as well! My current hardware design is to use a PIC18F4550 (as I suspect most of you are!) and an external MAX1270A ADC, however my proposition is to try and make a simple design which can transfer data as quickly as possible to the PC from an internal ADC.
It is probably enevitable that data will have to be buffered as I can only get very low speeds when polling the ADC from the PC, in the order of a few ten's of Hz.
One off the wall idea was to use a similar system to the bootloader code as that is fairly quick at transfering data.
Anyone else got any thoughts, ideas or even code which would speed this up?
Mat
|
|
|
|
|
Re:high speed ADC sampling and USB
|
|
Date: 2006/04/11 14:12
|
By: Chips
|
Status: User
|
|
|
Karma: 2  
|
|
| Posts: 17 |   | |
|
Rummaging through some old electronics magazines today I came across some plans to build a spectrum analyser using a PIC 16F877 and an external ADC.. seems theres nuffin new under the sun :/ The mag is EPE Feb 2002, might be useful for some folk building these things. I would scan the pages but the copyright brigade would probably come and beat me. The source code is downloadable at EPE site, and back issues can be bought for a few quid:
http://www.epemag.wimborne.co.uk/acatalog/EPE_online_catalog_2002_95.html
Wonder if there are any more up-to-date versions of the same thing out there..
 Chips
|
|
|
|
|
Re:high speed ADC sampling and USB
|
|
Date: 2006/04/11 14:18
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |   | |
|
|
I cant see the ADC bit being an issue, the problem will be the getting the data through the USB at a reasonable rate, and how you handle the usb comm's to achieve a high throughput. Mat
|
|
|
|
|
Re:high speed ADC sampling and USB
|
|
Date: 2006/04/11 20:06
|
By: Chips
|
Status: User
|
|
|
Karma: 2  
|
|
| Posts: 17 |   | |
|
I wonder if it would be possible to parallelise the upload, i.e. have two or more PICs on the USB bus uploading different segments of the data from the buffer. I suppose you can open as many devices and pipes as you like at once using MPLABS PIC DLL, then recombining the data in your PC app.
Interesting problem - to try this I have to go buy more PICs.. cool ! Chips
|
|
|
|
|
Re:high speed ADC sampling and USB
|
|
Date: 2006/04/11 20:16
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |   | |
|
I think a better way would be to optimise the USB code at the moment, the method of polling the pic for each sample is the main bottleneck! (Also you can get free PIC's from the microchip website, if you order samples!). You can definately handle multiple devices with the DLL though... so its an idea.. Mat
|
|
|
|
|
Re:high speed ADC sampling and USB
|
|
Date: 2006/04/11 22:39
|
By: dariog
|
Status: User
|
|
|
Karma: 6  
|
|
| Posts: 107 |   | |
|
via simple HID devices, you can get up to 64 bytes @ 1 mSec, with PIC18F4550 (tested and in use by us for an year). Thus, you could, in the worst case, have 1Ksamples/sec, or, with some optimization, have 44 bytes transferred in each transition, so as to have quasi CD-quality audio. (I'm not sure if the 1mSec interval is constant, though, for audio apps).
Using ping-pong and other kind of devices (not HID), you could theoretically reach 1MB/sec (I still have to try this)
|
|
|
|
|
Re:high speed ADC sampling and USB
|
|
Date: 2006/04/11 23:56
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |   | |
|
|
I was thinking of buffering locally and using a ping-pong buffer, however i havnt had time to try it yet either, do you know of any good example coding for it? And do you have any example coding for your hid example? Mat
|
|
|
|
|
Re:high speed ADC sampling and USB
|
|
Date: 2006/04/12 14:33
|
By: dariog
|
Status: User
|
|
|
Karma: 6  
|
|
| Posts: 107 |   | |
|
I only read a few notes about ping pong at forum.microchip.com, but not yet tried or implemented it. I can send you some code for HID: I created a simple PIC programmer in USB (which can anyway program many chips), a pseudo-mp3 reader, I kind of USB/485 (with my proprietary protocol).
may I have your email?
|
|
|
|
|
Re:high speed ADC sampling and USB
|
|
Date: 2006/04/12 15:30
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |   | |
|
Im the same with regards to ping-pong, ive read the various microchip forums on it, however i have had little time to test it yet, some guys are reporting speeds of upto 7mbps which could be useful, althrough no examples of how to achieve this! I'm reread the datasheet again to try and get my head around it all, but this could take a while!
My email is mat at piccoder dot co dot uk, or alternatively you can upload the code to the forum if you zip it all together, for others to look at. Have you got an example pc app to go with it? Thanks Mat
|
|
|
|
|
Re:high speed ADC sampling and USB
|
|
Date: 2006/04/25 13:49
|
By: Chips
|
Status: User
|
|
|
Karma: 2  
|
|
| Posts: 17 |   | |
|
May be of interest, stumbled across this today while rummaging, havent had a chance to look at it yet.. supposed to be working !
http://www.sixca.com/eng/articles/usbdaq/index.html
By the way, could you point me at the data sheet that contains all the stuff on ping pong please ?
Chips
|
|
|
|