DPScope - Low-Cost USB Oscilloscopes
The Microcontroller is the heart of the DPScope. It is a 16-bit Microchip dsPIC30F2020 which has a lot of
desirable features: Not only is it blazingly fast (it runs 32 MIPS on a 128 MHz clock - this is very slightly
outside spec - max. 120 MHz - but works perfectly fine) and comes in a hobbyist-friendly DIP package;
since it is geared towards digital signal processing or DSP (that's where the "ds" in the name comes
from) it also has a bunch of useful mixed-signal periphery already built in:
MSamples/sec. At least that's what the spec seems to say at first glance. The reality is - it can acquire two
First and most important, it has an analog-to-digital converter that can acquire samples at 2 channels
simultaneously at 1 MSample/sec each, and the Microchip marketing guys simply added those two
numbers... anyway, that's perfectly fine for us because we need two channels anyway. The ADC has a
First and most important, it has an analog-to-digital converter that can acquire samples at 2 resolution of
10 bits, but in order to maximize acquisition speed and reduce memory requirements only the upper 8 bits
get used (i.e. one byte per sample). The reason for using a 128 MHz clock is the same - at that speed the
dsPIC is just barely fast enough to repeatedly sample two channels and store the data into internal
memory at 1 MHz sample rate.
The analog bandwidth of the ADC is well above 1 MHz, so it's not a limiting factor in the signal chain. For
sample rates faster than 1 MSample/sec - up to 20 MSamples/sec - the DPScope employs a technique
called "equivalent time sampling" - basically it runs at 1 MSample/sec real sample rate and acquires only
a subset of the data points at each sweep, and then overlays two or more subsequent sweeps (each with
resolution. You can read more details about this technique in the Tektronix application note "The XYZ of
oscillscopes" in the download section of this webpage.
The second great feature of this microcontroller is a set of comparators with finely controllable threshold
(10 bit resolution); most other Microchip devices have only very coarse compare threshold steps. These
comparators are all we need to implement a full-blown scope trigger with adjustable threshold and
selectable edge polarity (rising or falling edge, respectively), which cuts down on overall component count
and thus cost and complexity.
The only sore point with this dsPIC is its small RAM size - just 512 bytes. Some of that is taken up by
program overhead (e.g. global variables, parameter stack and so on), and it was a challenge to get at
least 200 bytes per channel (actually 205, since this works out to 410 points for FFT - where only one
channel as acquired at a time - and 410 is 4/5 of the 512 points needed for the FFT, which makes
interpolating it to 512 points fairly straightforward); a future version of the scope may use a different dsPIC
device (but right now there isn't any that has all the other features, runs at 5V, and is available in DIP
package). Adding external RAM is not an option either - first, it would add cost and complexity, second, the
dpPIC does not have enough output pins to control it, and third, at maximum sample rate there is no time
for additional control tasks anyway. But 200 points is good enough for a full display, and in most
applications the DPScope's delayed trigger capability provides exactly the same functionality that a longer
capture memory would.
Finally, the dsPIC supports SPI and USART communication, which it uses to control the other devices in
the DPScope (adjustable gain amplifiers, offset DAC) and communicate with the PC, respectively.