• AVR Freaks

Helpful ReplyHot!ADC maximum bandwidth

Page: 123 > Showing page 1 of 3
Author
ctcx
Starting Member
  • Total Posts : 38
  • Reward points : 0
  • Joined: 2013/08/31 21:31:41
  • Location: 0
  • Status: offline
2013/08/31 22:43:15 (permalink)
0

ADC maximum bandwidth

Hello, new here...
I'm using the PIC18F2550, and I'm having doubts about the maximum analog input frequency the PIC can handle.
 
What I'm trying to do is converting analog voltage signals to USB output, so the analog signal must be first converted to digital data through an ADC. But I want to be able to enter signals of 1 MHz without problems, i.e., ADC suffering of amplitude loss because of bandwidth, aliasing, distortion from slew rate...
 
For instance, I first looked on ADC0820 -an external ADC-, but its conversion time is very poor (1.5 us) and its slew rate is nothing but sinful (0.1 V/us). Then I looked into ADC1175, which has a sample rate of 20 MSPS and 120 MHz bandwidth, which look quite very promising, though I couldn't find its slew rate.
 
Then I began reading the ADC section of the PIC datasheet. I still don't get very well what acquisition time or TAD mean, but checking the formulas for Taqc calculation I'm guessing I need an acquisition time much lesser than 1 us in order to be able to handle 1 MHz input signals.
 
Anyway, assuming I configure the PIC to be using the maximum Fosc of 48 MHz (TAD of 64 Tosc according to datasheet), can I reduce conversion times or acquisition times by choosing the right impedance and capacitance values? In order to handle 1 MHz input signals... Or if it's not possible to reach 1 MHz, what would be the maximum input frequency the PIC can handle?
 
I know I'm very lost and I'm badly mistaking terms, I still don't understand how MSPS, conversion time or acquisition time are related. But if you can help, I'll be very grateful. Thanks.
#1
dan1138
Super Member
  • Total Posts : 3194
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 00:13:24 (permalink) ☄ Helpfulby GnUfTw 2015/04/02 05:30:07
+4 (2)
From table 28-29 of my data sheet:
Parameter 130, TAD, A/D Clock period: 0.7us minimum.
Parameter 131, TCNV, Conversion time: 12 TAD periods
Parameter 132, TACQ, Acquisition time: 1.4us
 
Using these parameters the ADC sample rate of TACQ + (TAD * TCVN) = 1.4 + (0.7 * 12) = 9.8us = 102,040 samples per second (theoretical maximum sample rate).
 
With practical choices of crystal frequencies a TAD of 0.8 microseconds can be achieved with a 20MHz crystal and setting the A/D conversion clock to FOSC/16. Next select the A/D Acquisition Time (TACQ) for 2 TAD.
 
This result is an ADC sample rate of 2 * 0.8 + (0.8 * 12) = 11.2us = 89,285  samples per second (practical maximum sample rate).
 
Overall the ADC in the PIC is a poor choice if you are looking for high speed, high input impedance, high resolution, and low noise. For a 10-bit ADC it is not as good as almost any other external 10-bit ADC. If you can live with a 2.5K input impedance, 8 to 9 bits of real dynamic range, 1% accuracy and 1,000 to 2,000 samples per channel per second the ADC in the PIC will do the job.
 
There are a lot of ways to make a very bad design with the PIC ADC. Pay attention to the AVDD and AVSS power pins circuit traces and bypass cap placement. Do not use the AVSS as a ground return path for high current loads or transient switching loads.
 
[EDIT] Forgot to answer your question on maximum AC input frequency for the ADC. It will be in the 8 to 10 KHz range. It depends on the waveform you want to sample. The less like a sine wave to more sample point are needed so the lower the frequency the waveform can be.
post edited by dan1138 - 2013/09/01 00:27:46
#2
maxruben
Super Member
  • Total Posts : 3354
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 03:12:38 (permalink)
+2 (1)
A PIC32 can have a maximum sampling rate of 1000k samples per second and a PIC24 can have 500k samples per second.
 
They can also do automatic successive conversions and store the result in one 16byte (or 2 8byte alternated) buffer(s) and give you an interrupt after up to 16 samplings.
 
The maximum frequency of the input signal is 1/2 the sampling rate.
 
/Ruben
 
#3
MBedder
Circuit breaker
  • Total Posts : 6786
  • Reward points : 0
  • Joined: 2008/05/30 11:24:01
  • Location: Zelenograd, Russia
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 03:27:38 (permalink)
+2 (1)
dsPIC33FJ16GS50x devices (non-USB though) can perform up to 4M samples/sec which is more or less acceptable for 1 MHz input signal bandwidth.
#4
ctcx
Starting Member
  • Total Posts : 38
  • Reward points : 0
  • Joined: 2013/08/31 21:31:41
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 09:19:02 (permalink)
0
Thanks all very much.
Guess I won't be free from getting an external ADC then...
#5
MBedder
Circuit breaker
  • Total Posts : 6786
  • Reward points : 0
  • Joined: 2008/05/30 11:24:01
  • Location: Zelenograd, Russia
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 09:35:54 (permalink)
+4 (2)
Even if you hook up a super-gigasample ADC to your PIC18F2550 you won't be able to do anything practical with its huge data throughput, not even speaking about the USB transfers. First of all the target MCU should be choosen properly.
#6
DarioG
Allmächtig.
  • Total Posts : 54081
  • Reward points : 0
  • Joined: 2006/02/25 08:58:22
  • Location: Oesterreich
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 13:06:03 (permalink)
0
Yeah, as MBedder says!
Moreover, even with a 20MHz SPI interface, an external ADC won't possibly give you more than 1MSamples/sec @16 bit... (maybe 2 if a 10bit mode is available, but that would be non-standard for SPI module)

GENOVA :D :D ! GODO
#7
ctcx
Starting Member
  • Total Posts : 38
  • Reward points : 0
  • Joined: 2013/08/31 21:31:41
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 18:32:35 (permalink)
0
Sorry, but I wasn't expecting the last 2 messages, and I'm having trouble understanding them...
 
I'm not seeking huge frequency signals, just 1 MHz maximum I ask, or even just close, like 900 KHz. What I'm trying to finally do is graphing the analog signal on the PC, and that's made by first converting analog to digital (external ADC), and then the USB interface (PIC18F2550) to be able to connect to the PC. The software used would be LabView, obviously using the Real Time module. Hope I've finally explained myself.
 
But then what are you saying? That USB protocol itself is not able to handle 1 MHz analog signals? That's not PIC-dependant, but USB itself!!
 
Also, I understand if I have an ADC of 20 MSPS I could handle input signals of maximum 5 MHz...
#8
dan1138
Super Member
  • Total Posts : 3194
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 20:06:50 (permalink)
+2 (1)
Lets try an example:
  
Say we want to capture a one time event over a 1 microsecond interval.
We want to resolve this event to an accuracy of 1% in amplitude and time.
How many bits of ADC resolution do we need?
How many ADC samples per second do we need?
 
To get a minimum amplitude accuracy of 1% you need log2(100)  bits of resolution or about  6.64 bits.
To get a minimum resolution in time of 1% you need at least 100 samples in 1 microsecond or about 100 million samples per second.
 
There are many clever ways to get more accuracy in amplitude and time with slower analog to digital converters.
 
The above statements are just the most elementary view of the measurement problem.
post edited by dan1138 - 2013/09/05 11:51:56
#9
ctcx
Starting Member
  • Total Posts : 38
  • Reward points : 0
  • Joined: 2013/08/31 21:31:41
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 21:18:09 (permalink)
0
As you, Dan1138, said, those may be some of the most basic concepts, and I apologize if I'm asking for simple things, but I'm just starting Electronic Engeenering studies and I haven't seen that much until now, just starting with basic science stuff. And all the stuff I came here with I had to look in a book a friend lent me... I'm sailing mostly unknown seas.
 
But, if you're really talking about USB capacities directly, then no matter if I had the fastest ADCs and operational amplifiers, there would be always an ugly bottleneck.
 
The second to last thing you said, do you mean there are ways to achive my desired frequencies even using slower and common chips?
Please tell me, the only thing I'm able to imagine would be kind of a sample & hold circuit, but doesn't many ADCs have one of those already anyway?
#10
dan1138
Super Member
  • Total Posts : 3194
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 22:08:56 (permalink)
+2 (1)
What I am trying to explain is the sampling required to convert an arbitrary waveform from the analog domain to the digital domain.
 
I have not even tried to address the issues of using the USB to transport large amounts of data in a timely way.
 
From:  http://www.usb.org/developers/usbfaq#band1 see:
-----
1. What do actual data rates on USB look like? 
  
A:   USB's actual throughput is a function of many variables. Typically, the most important ones are the target device's ability to source or sink data, the bandwidth consumption of other devices on the bus, and the efficiency of the host's USB software stack. In some cases, PCI latencies and processor loading can also be critical. Assuming only the target endpoint consumes a significant amount of bus bandwidth-and both the target and the host are able to source or sink data as fast as USB can move it-the maximum attainable bandwidth is a function of the transfer type and signaling rate. These bandwidths are given in chapter 5 of the USB Specification. In practice, most hosts can reach the maximum isochronous and interrupt bandwidths with a single target endpoint. With bulk transfers, typical transfer rates are around 900kb/s to a single endpoint, increasing to near ideal transfer rates with multiple endpoints.
-----
 
So it would seem that it may be very tricky to move data fast enough through a USB interface to deliver, in real time, a digital representation of a 1MHz analog waveform with at least a 1% resolution in time and amplitude.
#11
maxruben
Super Member
  • Total Posts : 3354
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re:ADC maximum bandwidth 2013/09/01 23:54:07 (permalink)
+2 (1)
If you move to a PIC32 (or perhaps the dsPIC but I am not familliar with them so I can't comment on that) you can sample at 1Msamples per second for x number of samples, move the sampled data to an internal ram buffer using DMA, and then in your own time move the data in the ram buffer to a PC via USB. The PIC32 has up to 128kB of ram and with 10 bits per sample you could put 3 samples in one 32 bit dword (if you need) or just use one 16 bit word for each sample. One 16 bit word per sample, and a 64k buffer will give you 32ms continuous data at 1Msamples per second.
 
This will not give you a continuously sampling stream but chunks of 32 ms each transfer to the PC. Not sure how long it will be until you can send the next chunk of 32 ms sampling data but probably several seconds.
 
Next problem will be to tell when you should start your sampling. If it is a signal that always looks the same or you don't care then it is no problem but if you want to start the 32 ms sampling at a certain 'look' of the input signal, you also need to handle triggering. If you put the data in a circular buffer and fill this buffer at all time using the DMA when you want to wait for a trigger event in the input signal, you might be able to do that in code and set the trigger pointer either some time before, at, or after the trigger event. You can also use an external analog triggering circuit which will provide you with a digital output.
 
The advantage with using everything in one chip is that there will be no need for external communication to shift large amount of data in to and out of buffers.
 
What type of signal will you be looking at and what is your start sampling triggering needs?
 
/Ruben
 
#12
DarioG
Allmächtig.
  • Total Posts : 54081
  • Reward points : 0
  • Joined: 2006/02/25 08:58:22
  • Location: Oesterreich
  • Status: offline
Re:ADC maximum bandwidth 2013/09/02 01:47:48 (permalink)
0
Yeah, what Ruben says is the way to go in such cases, I'd say.
 
As for USB, Low-Speed could do some 1Mbit/second and Full-Speed (like any PIC at the moment) 12Mbits/second. Considering overhead, hardly more than 500KB/sec (peaking at 900) can be expected from the hardware point of view.

GENOVA :D :D ! GODO
#13
ctcx
Starting Member
  • Total Posts : 38
  • Reward points : 0
  • Joined: 2013/08/31 21:31:41
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/02 09:32:32 (permalink)
0
I expect to enter any kind of signal (sinus, triangle, square...), and the sampling starting point to begin just when I plug it.
 
1. If I decide to stick with more common and slower chips and PIC, what way would you suggest for getting more accuracy in time with slower chips? External ADC and a buffer or sample & hold circuit? Because the idea would be then limiting my direct input signal to, let's say, 100 KHz, and for higher frequency signals apply the trick...
 
2. What PIC32 have USB support like the 2550?
 
Heck, I'm really in trouble......................
#14
DarioG
Allmächtig.
  • Total Posts : 54081
  • Reward points : 0
  • Joined: 2006/02/25 08:58:22
  • Location: Oesterreich
  • Status: offline
Re:ADC maximum bandwidth 2013/09/02 10:29:32 (permalink)
0
2) many of them, I never used them but check Microchip's site Smile
 
1) I still don't think you will get big benefits from an external ADC...

GENOVA :D :D ! GODO
#15
ctcx
Starting Member
  • Total Posts : 38
  • Reward points : 0
  • Joined: 2013/08/31 21:31:41
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/02 12:54:46 (permalink)
0
@Dan1138:
I checked PIC's datasheet directly from the website, lokked into ADC parameters and got this:
Parameter 130, TAD, A/D Clock period: 0.8 us minimum
Parameter 131, TCNV, Conversion time: 11 TAD periods minimum
Parameter 132, TACQ, Acquisition time: 1.4us
Doing your same calculations with practical choices,
Sample rate = 2*0.8 + (0.8*11) = 10.4 us = 96,153 samples per second
According to a sample theorem, which says the maximum frequency is half the sample rate, then I would be getting 48 KHz maximum instead of the 10 KHz you said, wouldn't I?
#16
tom maier
Super Member
  • Total Posts : 2116
  • Reward points : 0
  • Joined: 2013/08/22 15:27:12
  • Location: earth
  • Status: offline
Re:ADC maximum bandwidth 2013/09/02 15:02:56 (permalink)
+4 (2)
ctcx
 
Sample rate = 2*0.8 + (0.8*11) = 10.4 us = 96,153 samples per second
According to a sample theorem, which says the maximum frequency is half the sample rate, then I would be getting 48 KHz maximum instead of the 10 KHz you said, wouldn't I?



What you want to call the bandwidth is dependent on what you intend to do with this data. If you are doing a Fourier on the data, then your maximum spectral bandwidth is 48 KHz, bounded by the Nyquist limit. If you want to see the waveforms in time domain, like an o'scope, then you would want at least 8 data points per wave to see what it is, so then the "bandwidth" falls down to about 10 KHz.
 
The other "bandwidth" to worry about is amplitude flatness. This is heavily influenced by the RC time constant of charging the internal capacitance of the a/d through the source impedance of what is driving it. Going for maximum bandwidth requires good design of the input driver and possibly a filter to remove any frequencies beyond the Nyquist limit are seen at the a/d. Higher frequencies than 48 KHz will show up as false frequencies.
 
Dan covers this all pretty well in his first post, and his post assumes you are making an o'scope.
 
What are you going to do with the data when you get it into the PC?
 
 
#17
ctcx
Starting Member
  • Total Posts : 38
  • Reward points : 0
  • Joined: 2013/08/31 21:31:41
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/02 15:40:02 (permalink)
0
Well, yes, I'm trying to "make" an "osciloscope", in the sense that I need indeed faithful reading of the analog signal on the PC. The final application is a bit different, but this is indeed the core idea, yes. My "bandwidth" concept goes that way.
 
Having said that, and after a bit more research, I'm realizing that there are no "tricks" that could allow me to turn, for example, 50 KHz into 100 or 300 KHz (guess a sample & hold circuit wouldn't do that...), so I'd really need to calculate my maximum "bandwidth" overall and stick with that, and that would the smallest of the PIC, the ADC, or the op amps if I use them.
 
Now that I mention it, I was told more than once here in the thread that even if I had a super fast ADC I could get little to no benefit from it, but I still don't get why. I guess they mean USB limitations (what else if I won't be using the PIC's ADC?).
Regarding USB, can I calculate its maximum "bandwidth" from its transfer rate?
The PIC supports maximum 12 Mb/s, but isn't that USB 1.1 maximum rate anyway? Then why does the datasheet says "USB 2.0 compliant" if the PIC doesn't suppport 480 Mb/s?
#18
tom maier
Super Member
  • Total Posts : 2116
  • Reward points : 0
  • Joined: 2013/08/22 15:27:12
  • Location: earth
  • Status: offline
Re:ADC maximum bandwidth 2013/09/02 16:00:29 (permalink)
+2 (1)
ctcx

Now that I mention it, I was told more than once here in the thread that even if I had a super fast ADC I could get little to no benefit from it, but I still don't get why.


 
What people are saying is that if you decided to go for a kick-ass external ADC then the poor little pic18 will not be able to keep up with it. You need to move the data out as fast as it is being digitized and the pic18 isn't good for that.
 
The bandwidth of the USB is not a big issue. The way you want to do this is to grab a frame of a/d data (like 4K samples, or whatever) and then stop aquiring data, and then send that data frame. I don't think you would want to constantly stream the data, right? that would just make it more difficult to handle in software on the PC side. Grab a frame, show a frame, grab a frame, etc.
 
So the USB bandwidth is irrelevant. You could use RS232 if you don't mind a slow refresh rate.
 
But if you want these high speeds above 10 KHz, you really need to move to a processor with fast adc and big ram, like the pic32.
 
 
#19
ctcx
Starting Member
  • Total Posts : 38
  • Reward points : 0
  • Joined: 2013/08/31 21:31:41
  • Location: 0
  • Status: offline
Re:ADC maximum bandwidth 2013/09/02 16:45:32 (permalink)
0
I thought the frequency limit of 10 KHz from the input signal applied only for the PIC's internal ADC, but then you mean it applies for the PIC overall?
If the answer is positive, what PIC32 would you suggest?
Also, I understand the 18F2550 is an 8-bit PIC. What do you mean with a "PIC32", a 32-bit PIC? I'm barely able to get a 2550 in my country, a 32-bit PIC will never be possible here!!!
post edited by ctcx - 2013/09/02 16:48:19
#20
Page: 123 > Showing page 1 of 3
Jump to:
© 2019 APG vNext Commercial Version 4.5