2
\$\begingroup\$

I am making a simple 1MHz oscilloscope with an embebbed system based on ARM and Android. I have an ADC with a speed of 12MSa/s that takes the samples. I need it to send the samples to a PIC microcontroller, to send them via USB to my Android system.

I cannot send 12MSa/s of data through USB so I investigated and I think I have to use a RAM buffer. I have done some research on the internet, but I can't understand how they work.

As far as I can understand: Lets suppose I have 2 RAM ICs. I start filling RAM 1 with samples from my ADC, then, when it is filled, I start filling RAM 2. My microcontroller will start reading data from RAM 1. The USB transfer speed is not fast enough to read all the RAM content before RAM 2 is filled, so the ADC will have to wait until RAM 1 is empty, thus I will loose samples from my ADC.

Is there any way to prevent this? My development board is a PandaBoard. I am running Android 4 on it and it is working perfectly, but I have this problem regarding hardware buffering.

\$\endgroup\$
  • 2
    \$\begingroup\$ Sorry, my native language is not English I made some corrections and formated the text :) Thanks for the advice :) \$\endgroup\$ – Andres Jun 17 '12 at 22:57
  • 1
    \$\begingroup\$ @pipe - please don't make trivial edits to ancient already resolved questions - it just bumps them to the top of the main page for no real purpose, distracting from questions that deserve current attention. \$\endgroup\$ – Chris Stratton Jun 6 '16 at 19:10
  • \$\begingroup\$ @ChrisStratton If you have a problem with the fact that edited questions bubble to the top - take it to the site designers, it's nothing a user can prevent. If you have a problem with me editing old questions, please see the answers to this meta question. As long as old questions are searchable and pop up in the side bar, they deserve to be edited in the same way as any other question. \$\endgroup\$ – pipe Jun 6 '16 at 19:21
  • \$\begingroup\$ The ability to perform a cost-benefit analysis is a key engineering skill. \$\endgroup\$ – Chris Stratton Jun 6 '16 at 19:28
1
\$\begingroup\$

You can't sample continuously.
However, this isn't too much of an issue usually with scopes as most don't do this (at least at the higher speeds) Even an analogue scope does not display continuous information as you have the beam sweep back period.

A typical digital storage scope waits for a trigger, fills it's buffer at high speed, then sends the data at a lower speed to the microcontroller (or android in your case) for display. As Photon mentions, this happens fast enough (e.g. above 15 frames of data a second) for it to look continuous to the user.

Obviously the larger RAM buffer, the more samples(time) can be captured. This is why you will see DSOs advertising large capture buffers. At high speed this can make a big difference - at 2 Gigasamples per second and a 10KB capture buffer you are only going to get 5us of information. Some with larger buffers can only use part of it at the highest speed - for instance my DSO has 10MB of buffer up to 1 Gsps, but can only use 10KB at 2Gsps.

In your case you could switch to continuous capture at speeds the USB is capable of (e.g. < 1 Msps) You could maybe look at using compression also.
Either that or look at using high/super speed USB.

\$\endgroup\$
  • \$\begingroup\$ Nice, didn't know that :) So, what is the advantage of using a buffer ? Isn't it the same taking the samples and send them directly through USB ? How does the USB oscilloscopes do for example ? \$\endgroup\$ – Andres Jun 18 '12 at 1:21
  • \$\begingroup\$ @Andres: You cannot expect to send 400Mb/s USB speeds with a PIC clocked at, what, 16MHz? :-) \$\endgroup\$ – Kenny Robinson Jun 18 '12 at 1:31
  • \$\begingroup\$ @Andres, without some kind of buffer, you could only sample as fast as you could send the data to the display. Any "extra" data you captured, you'd have no where to put it, and you'd have to discard it. With a buffer, you can fill up the buffer very fast, and then transfer to the display at a slower rate...which can still be so fast the user doesn't notice any delay. \$\endgroup\$ – The Photon Jun 18 '12 at 1:32
  • \$\begingroup\$ Exactly, I have a reception buffer on my Android system for USB reception but i tought that whit a RAM buffer in my ADC I could have a high sample rate whit a not so high transfer speed to display, but now I understand this about buffer size, the trick is to have a large buffer so I can continously sample for some time, lets say my screen width depending on time/div :) \$\endgroup\$ – Andres Jun 18 '12 at 1:54
  • \$\begingroup\$ Yes, you want at least your screen widths worth of buffering, more if you wish to scroll left/right through the waveform. \$\endgroup\$ – Oli Glaser Jun 18 '12 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.