robomon 0 Posted May 14, 2014 Share Posted May 14, 2014 I want to implement a USB oscilloscope using my TIVA launchpad http://www.ti.com/tool/ek-tm4c123gxl It has a 12bit ADC with sampling rate of 1million samples per second(MSPS). It also has a full speed (FS) USB. If I set my sampling rate of ADC to 1MSPS with 12bit resolution, one second will have 1MSPS * 12 bits = 12 million bits (12 mega bits) But USB full speed only has a transfer rate of 12Mbps(12 mega bits per second). So transferring these ADC samples via USB is not possible. My questions 1) Other than using high speed (HS) USB, is there a way send these ADC samples? (i.e are there any compression techniques or any other methods to send data via USB ?) 2) Is my above calculation wrong ? Quote Link to post Share on other sites
igor 163 Posted May 14, 2014 Share Posted May 14, 2014 Consider that the TM4C123gxl has a cpu clock top speed of 80MHz (and the flash memory operates at half that speed). So you have about 80 clock cycles to process each sample. Quote Link to post Share on other sites
Lyon 3 Posted May 14, 2014 Share Posted May 14, 2014 Hi, Please see this package: http://www.ti.com/tool/sw-ek-lm3s3748 has a nice oscilloscope implementation, with USB. Maybe not the fastest in the world, but could be a good starting point for improving. Full code available, drivers... L bluehash 1 Quote Link to post Share on other sites
jazz 209 Posted May 31, 2014 Share Posted May 31, 2014 I want to implement a USB oscilloscope using my TIVA launchpad http://www.ti.com/tool/ek-tm4c123gxl It has a 12bit ADC with sampling rate of 1million samples per second(MSPS). It also has a full speed (FS) USB. If I set my sampling rate of ADC to 1MSPS with 12bit resolution, one second will have 1MSPS * 12 bits = 12 million bits (12 mega bits) But USB full speed only has a transfer rate of 12Mbps(12 mega bits per second). So transferring these ADC samples via USB is not possible. ADC will collecting data with 1.4 MByte/s, and max USB FS rate (practical, not theoretical) is 1 MByte/s, so it is not possible. robomon 1 Quote Link to post Share on other sites
pabigot 355 Posted May 31, 2014 Share Posted May 31, 2014 Also note the 12-bit samples are packed into 16-bit half-words, so unless you have the MCU intervene to pack them tighter you're actually talking a data rate of 2 MiBy/s. robomon 1 Quote Link to post Share on other sites
Lyon 3 Posted May 31, 2014 Share Posted May 31, 2014 Hi, But take into account you do not need too many samples to take - depending on your viewport, 100 points (samples) may be enough. You cannot compress pixels/points - this is usual the limit of eye resolution (although you may protest to this assertion…) and while you transmit a buffer with 100 samples, another one is to be acquired, so some hardware/software parallel processing. Tektronix used (at the beginning of DSO era) to take such amount of samples and then to interpolate between points to give some extra resolution. This was until someone developed the 1Gs/s sampler and this is the stage today (interpolation was with problems, many people unhappy with waveform displayed). L robomon 1 Quote Link to post Share on other sites
robomon 0 Posted June 1, 2014 Author Share Posted June 1, 2014 @Lyon: Could you let me know how this can be done ? If we do 100 samples then when we try to reconstruct the signal, it will be very bad - right ? Or do you mean that at out of 1MSPS take only 100 samples and send it to PC ? But this method will definitly have some data lost. Am I correct ? Quote Link to post Share on other sites
jazz 209 Posted June 2, 2014 Share Posted June 2, 2014 Consider that the TM4C123gxl has a cpu clock top speed of 80MHz (and the flash memory operates at half that speed). So you have about 80 clock cycles to process each sample. and while you transmit a buffer with 100 samples, another one is to be acquired, so some hardware/software parallel processing. Didn't done anything with ARM, so can't be 100% sure, but from MSP430F5xx world, there is no problem at all, working with ADC/USB together or any other hardware module on high rate, in parallel, without (almost) any CPU intervention. ADC write samples directly to USB endpoint buffer (without any memory coping), and when endpoint buffer become full, flush it (one assembler instruction), playing only with pointers (on the fly) to endpoint buffer. MSP430F5xx USB endpoint is limited to 64 bytes, and if I remember right ARM endpoint can be up to 1024 bytes, so even less CPU activity is needed. At transfer start USB need some time to speed-up, so there must some buffering on the transfer begin, and collected data can be ignored on PC side. If only one device is connected to USB port, and PC side is not busy, close to 1 MByte/s is possible, but of course only for personal use, not commercial. Quote Link to post Share on other sites
Lyon 3 Posted June 2, 2014 Share Posted June 2, 2014 Hi, @@jayfree - usually the sampling at very precise defined time should be performed - it is not needed to get 1Ms and then try to display them - you have no physical media to display and refresh that, either PC, either paper - so the signal is sampled at defined interval and for display it is reconstructed - there is a reconstruction theory behind that (sinc function is ideal, but not used, so linear interpolators can be used instead since the mathematics involved is simple, operating only on adjacent samples). If you take 1Ms, then anyway you must discard many samples (or select from this huge number) in order to have something intelligible for the eye( you want on-two-several signal periods on screen). A minimal number of samples can be calculated, depends on several factors, including the bandwidth of the analog circuits involved. You maybe have used an DSO, so for instance, if you have a 1KHz sine and set the time base at 20ms/div, you will see something weird... An operating mode (single shot) should use big number of samples and then present on media what was before trigger (pre-trigger) and after. The package made by TI is a good one to hack - at that time the ADC had 500Ks/s, so with this new micro, some improvement could be made. Don't know if I was sufficiently clear. @@jazz, saw you are a genius on MSP430 forum - good for you and congratulations - only thing to note is the Cortex-M4 is somewhat more limited for peripherals than 430 - due to different approach - for 430 some hidden hardware may be in-place to compensate the limitations due to 16MHz clock, while for Cortex now running at 120MHz, some peripherals had odds in use (but here we have a DMA). I had no experience with 430, although I have an F2013 stick ready to be pushed into computer (and waiting for several years) but life says to go other directions... Regards, Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.