0

I've been given the task of getting ADC samples onto an embedded linux computer at the highest rate I can (up to about 300kSPS). I am playing with several different platforms (odroid, edison) but easrly on I realized the limitations of using the build in ADCs from within linux and timing (I am relativly new to this).

Right now I am reliably getting 150kSPS using a teensy 3.2 with a very basic swapping buffer, a PDB, and the USB connection. USB writes take 2.5usec no matter my buffer size so any faster and the ADC read interrupt collides with the USB and I get nothing.

My question is: Would using an external ADC chip enable faster speeds? I see chips on Digikey and Mouser advertising 600kSPS and higher with SPI and even parallel outputs... but I fell like the bottleneck is the teensy with USB writes. Even if it could (and I am sure it could) read values 600k times a second how do you get it onto the computer without falling behind?

also, it is for long term collection so I can't just store everything and write it once the collection is over. The edison has a built in microcontroller, but no SPI implemented yet.

Edit: To clarify, my question is weather there is any way to get large amounts of data very fast into my embedded linux device programmatically or is there some layer between a fast SPI device and the comptuer that I don't know about. So far my mentors have suggested I 1) learn to write a device driver for the SPI device or 2) recompile an image with RT_PREEMPT.

CrustyAuklet
  • 357
  • 3
  • 16
  • 1
    I'm voting to close this question as off-topic because this is not about programming or software within the rules of this site. – too honest for this site Jul 12 '16 at 04:33
  • The question is how to get decent throughput in a linux environment. It's tagged as embedded-linux and seems completely appropriate. – Russ Schultz Jul 12 '16 at 04:40
  • FWIW, a teensy appears to only be able to do full speed USB. Getting 600K samples/s through that seems improbable. You need to find a device that can do USB-2.0 HS and implement an isochronous mode ADC-USB bridge on that. On the edison, your linux app should be able to use standard libusb application code to consume that much data and keep up. You'll need to have a separate thread for reading the USB vs. writing to the disk, but nothing too crazy. – Russ Schultz Jul 12 '16 at 05:01
  • 1
    @RussSchultz: (Learn to address your comments properly. I just saw it by chance.) No, it is about the hardware. We don't even know if the ADC is fast enough. Also OP asks about attaching an external device. Anyway, please read my comment again. I intentionally added "within the rules of this site.". Feel free to read [ask]. (oh, and FS-USB very well can handle that rate e.g. for an 6 or 8 bit ADC). – too honest for this site Jul 12 '16 at 11:33
  • @Olaf perhaps I can edit my question for clarity but I am asking about the software interface to theoretical hardware and possibly system design. Given any external device that supposidly can send data very fast over SPI or parallel, how does one program something to catch that data in an embedded linux environment without missing samples? – CrustyAuklet Jul 12 '16 at 20:49
  • @RussSchultz thanks for the advice. the teensy USB speed is not really the issue right now, but rather the fact that the teensy USB library blocks for 2.5us every write, making me miss samples if I go above 160ksps. – CrustyAuklet Jul 12 '16 at 21:16
  • @CrustyAuklet are you using DMA? With DMA & double buffering, you should have a lot more than 2.5uS before data is lost. Try googling for teensy adc dma for examples. – Russ Schultz Jul 12 '16 at 21:24
  • @RussSchultz I am not using DMA right now, but after reading more it seems like a good direction to go. Still wondering if it can be done without a microcontroller, since that is what people want to see here. I get the feeling that it is not really possible though? – CrustyAuklet Jul 13 '16 at 01:00

0 Answers0