The Oscilloscope Watch

advertisement
DesignCon 2014
Oscilloscope Watch Teardown
Gabriel Anzziani, Gabotronics
Email: gabriel@gabotronics.com
Abstract
The Oscilloscope Watch is a small device that has all the features of a digital watch, a
mixed signal oscilloscope, and an arbitrary waveform generator. This paper will explore
every detail of the design of the Oscilloscope Watch.
Hardware design:
Block diagram and general overview
Choice of the microcontroller
Design of the analog frontend
Design of the waveform generator
Design of the power stage
Firmware design:
Maximize use of the peripherals
High speed sampling using the DMA
Low power techniques to maximize the battery life
Using the XMEGA event system to offload the CPU
Author Biography
Gabotronics is a company that designs and manufactures embedded systems, based in
Sarasota, FL and founded by Gabriel Anzziani in 2009. Gabotronics has been recognized
by Atmel as a Third Party Vendor, Gabotronics products are sold worldwide in stores like
SparkFun and SeeedStudio. Gabriel Anzziani is an electronic engineer from Venezuela,
graduated in 2003 from University Simón Bolívar.
The Oscilloscope Watch
The Oscilloscope Watch (OW) is a combination of a digital watch, a mixed signal
oscilloscope, an arbitrary waveform generator, and a protocol sniffer.
Main Features
• Mixed Signal Oscilloscope: Simultaneous sampling of 2 analog and 8 digital signals.
• Arbitrary Waveform Generator with advanced sweep options on all the wave parameters.
• Protocol Sniffer: SPI, I2C, UART
• Advanced Triggering System and ability to view signals prior to the trigger.
• Meter Mode: VDC, VPP and Frequency readout.
• XY Mode: For plotting Lissajous figures, V/I curves or checking the phase differences.
• Spectrum Analyzer with different windowing options, vertical log and IQ visualization.
• Channel Math: add, multiply, invert, and average.
• Horizontal and Vertical Cursors
Hardware design
The OW’s design was based on the Xprotolab, the goal was design an oscilloscope with
as much features as possible, but also making it as small as possible and low cost. Most
of the design is dependent on the firmware, while keeping the hardware relatively simple.
Block diagram and general overview
Figure 1 shows the OW’s block diagram.
Figure 1: Oscilloscope Watch Block Diagram
Choice of the microcontroller
The two most important features when selecting the microcontroller were the sampling
speed of the ADC, and the package size. When the design of the Xprotolab began in
2011, the best choice was the XMEGA microcontroller. This microcontroller also had a
D/A converter, which was a big plus because it allowed the design to have an integrated
waveform generator.
Why not a 32bit controller?
I was tempted to port the design on the OW to a 32bit microcontroller, two chips caught
my attention: the EFM32 from Energy Micro, and the STM32F4 from ST.
The EFM32, besides being a 32bit micro, and aimed at achieving very low power, it only
has a 1MSPS ADC. I decided that the ADC speed was critical to the project, and did not
want to lower it from 2MSPS from the XMEGA.
The STM32F4 with its 3×2.4 MSPS converter looked like a good choice, but ST didn’t
have a small IC package.
Porting the firmware would also be challenging, I have spent years optimizing down to
the assembly level many functions on the Xprotolab, like the triggering and the
acquisition. The XMEGA although being an 8bit processor, it is very deterministic and
easy to work with.
A new microcontroller that just came out recently from Microchip is the
PIC24FJ128GC010, which has a 10MSPS converter. This particular chip may be
considered for a future version of the OW.
Design of the analog front end
The signal conditioning of the input is a simple voltage divider, a non-inverting amplifier,
and a level shifter. The OpAmp selected is a TL064, which has a GBW of 1MHz, a slew
rate of 3.5V/µs, and is low cost. Figure 2 shows the front end circuit.
Figure 2: Analog Frontend
Right on the input there is a spark gap to help keep ESD events out of the amplifier. The
high impedance of the input also helps to keep the circuit protected.
An AC/DC coupling switch is present; the AC path is done with a high voltage 0.1uF
capacitor.
Let’s calculate the transfer function. At the V+ pin of the Opamp, we have:
𝑉 + = 𝑉𝑖𝑛 ∙
180𝑘
9
= 𝑉𝑖𝑛 ∙
820𝑘 + 180𝑘
50
This voltage is amplified by the OpAmp, using the non-inverting amplifier circuit:
𝑉𝑂𝑝 = 𝑉 + ∙ (1 +
20𝑘
1
9 10 𝑉𝑖𝑛
) = 𝑉 + ∙ (1 + ) = 𝑉𝑖𝑛 ∙
∙
=
180𝑘
9
50 9
5
Then, the voltage needs to be shifted so it can be applied to the microcontroller, using the
superposition theorem:
𝑉𝑜𝑢𝑡 =
𝑉𝑖𝑛
3𝑘
3𝑘
∙
+ 2.048𝑉 ∙
5 3𝑘 + 3𝑘
3𝑘 + 3𝑘
And finally:
𝑉𝑜𝑢𝑡 =
𝑉𝑖𝑛
+ 1.024𝑉
10
Figure 3 shows the frequency response of the analog front end.
Figure 3: Front end bandwidth
It can be seen that the bandwidth is about 320kHz, but the microcontroller’s input
capacitance will reduce the bandwidth to about 200kHz.
The XMEGA’s ADC is differential, the positive input is connected to the front end, and
the negative input is connected to 1.024V (generated from a voltage divider).
Design of waveform generator
The DAC’s output is connected to an inverting amplifier as shown in figure 4.
Figure 4: AWG Amplifier
This amplifier needs to remove the offset inherent from the DAC, so the output signal is
centered at 0V. The amplifier is also a low pass filter, so that the discrete steps from the
DAC are smoothed.
The output voltage is calculated using the superposition theorem:
𝑉𝑂𝑈𝑇 = −𝑉𝐷𝐴𝐶 ∙
300𝑘
200𝑘
300𝑘
+ 2.048𝑉 ∙
∙ (1 +
)
75𝑘
200𝑘 + 300𝑘
75𝑘
𝑉𝑂𝑈𝑇 = −4 ∙ 𝑉𝐷𝐴𝐶 + 2.048𝑉 ∙
2
∙5
5
𝑉𝑂𝑈𝑇 = −4 ∙ 𝑉𝐷𝐴𝐶 + 4.096𝑉
VDAC can vary from 0 to 2.048V, so VOUT can vary from -4.096V to +4.096V
Figure 5 shows the AWG’s bandwidth, it is about 50kHz.
Figure 5: AWG Bandwidth
Design of the power stage
The power stage was carefully designed to minimize current consumption. The
oscilloscope’s analog section and the battery monitor can be turned off when not needed.
Figure 6 shows the load sharing system. This circuit was designed using Microchip’s
application note AN1149. The power from the USB should supply the system load and
charge the battery. When the USB power source is removed, the system is supported by
the battery.
Figure 6: OW load sharing
As described in AN1149, a MOSFET switch is used to connect the battery to the load
only when the USB power is not present, figure 7 is taken from AN1149.
Figure 7: AN1149 description of the circuit
The output of the load sharing circuit is called VIN, and it is connected to 3 other parts of
the system, as shown on figures 8, 9 and 10.
Figure 8: Digital Power
As seen on figure 8, the digital section of the system (microcontroller, display, and other
logic) is powered by regulator TPS780180300DRV, which can provide either 3V or
1.8V. The output of this regulator will be called VDD. The OW normally uses 3V, but
when very low power is required (and the display is not used), the system can switch to
1.8V. A VDD of 3V is used instead of the typical 3.3V to reduce the power consumption.
Figure 9: Battery Monitor
The battery can be monitored using the circuit shown in figure 9. The circuit can be
powered off so it is not wasting power when it is not being used.
Figure 10: Analog Power
Figure 10 shows the analog power section. The analog section of the system needs to be
powered by +/- 5V. The analog power is controlled by two MOSFETs, so can be turned
off when not used. The positive 5V is generated with a step-up switching regulator
NCP1402. The negative 5V is generated by a charge pump voltage inverter TPS60403.
Firmware design
Most of the design effort is present in the firmware. The firmware has been in constant
improvement for the last few years.
Maximize use of the peripherals
The OW uses many resources and peripherals of the XMEGA microcontroller. Figure 11
shows the OW’s Architecture block diagram.
Figure 11: Oscilloscope Watch Architecture block diagram
High speed sampling using the DMA
“High Speed” for an 8bit microcontroller running at 32MHz…
Instead of polling or using interrupt handlers to read and process the result registers, the
XMEGA’s DMA is used to move data from the result registers to memory buffers. This
moving of data is done without CPU intervention.
Low power techniques to maximize the battery
life
Minimizing the power consumption is one critical aspect of the design. To reach the
lowest possible power figures there are a few points to pay attention to – it is not only the
sleep mode that defines the power consumption, but also the state of the I/O pins, the
number of enabled peripheral modules and so on. The goal is to keep the current under
100uA when in WATCH mode, and under 32mA when in SCOPE mode.
The processor does not run continuously and peripherals may be idle much of the time.
The overall power consumption can be lowered by taking advantage of various “sleep”
modes. The most common sleep modes are Power Down (PWD), Power Save (PS) and
Idle. In Power Down mode everything is shut down, including the clock source. In Power
Save mode everything is turned off except a 32 kHz clock running from a crystal to keep
track of time. Idle mode is a shallow sleep mode where only parts of the device are shut
down but the main parts of the microcontroller are running.
Figure 12: Microcontroller's Power Budget
-
-
-
Maximize the time spent in Sleep mode
Use the highest CPU clock speed, unless the task requires a specific amount of
time (e.g. serial communication), in which case, avoid using a higher CPU speed
than needed
Turn off unused peripherals
Use the RTC with the 1.024kHz from the 32.768kHz external crystal
Set I/Os at a known state
Disable the digital input buffer on pins that are connected to analog sources
Disable the BOD - or better, disable it while in sleep - to reduce power
consumption. Use sampled mode if only slow changes in operating voltage are
likely.
Disable the On Chip Debugging and the JTAG interface
Enable power reduction mode for EEPROM and Flash to reduce power
consumption in ACTIVE mode
Use page-wise writing to EEPROM rather than byte-wise
Display
The display used in the OW is a Sharp Memory LCD, model number LS013B7DH03.
Memory LCD is a new technology where the pixels do not have to be periodically
refreshed like a regular LCD. Once the pixels have been written to the display they will
keep their configuration, only drawing a small amount of current. The display is a 1.28",
128x128 pixels monochrome display, with a 3-wire SPI interface.
To decrease the power needed:
- The DMA is used to send data to the SPI
- Redundant transfers are removed in the SPI
- The next frame is rendered during the SPI transfer
- Graphics are pre-rendered and stored in RAM
Using the XMEGA event system to offload the
CPU
Parts of the system work independently thanks to the event system. The arbitrary
waveform generator runs in the background by using the DMA and an event generated by
a timer. The Frequency counter function works by using an event to increment a timer,
The Event system in the XMEGA microcontroller interconnects peripherals so that they
can communicate without using the CPU.
References
Brian Chu [2008]. AN1149 Designing A Li-Ion Battery Charger and Load Sharing
System With Microchip’s Stand-Alone Li-Ion Battery Charge Management Controller.
http://ww1.microchip.com/downloads/en/AppNotes/01149c.pdf
Arne Martin Holberg , Asmund Saetre [2006]. Innovative Techniques for Extremely Low
Power Consumption with 8-bit Microcontrollers.
http://www.atmel.com/images/doc7903.pdf
Atmel [2009]. AVR1010: Minimizing the power consumption of Atmel AVR XMEGA
devices. http://www.atmel.com/Images/doc8267.pdf
Energy Micro [2013]. AN0048 Energy Optimized Display Application.
http://cdn.energymicro.com/dl/an/pdf/an0048_efm32_energy_friendly_display.pdf
Appendix
Figure 13: The Oscilloscope Watch
Figure 14: Oscilloscope Watch Schematics
Download