OpenScope MZ Reference Manual

OpenScope MZ is an open source, multi-function, electronic instrumentation device that can be controlled using a computer or mobile device to acquire, analyze, visualize, and generate signals from circuits, sensors, and other electronic devices. OpenScope MZ makes it easy to generate analog and digital signals using the power supply, function generator and GPIO and measure and visualize analog and digital signals using the oscilloscope and logic analyzer. Develop and debug circuits faster by generating stimuli and visualizing the response using OpenScope MZ.

Features

  • Connectivity
    • WiFi (802.11g)
    • USB 2.0 (High Speed Required)
  • Oscilloscope
    • 2 Channels
    • 12-bit resolution per channel
    • 6.25 MS/s sample rate
    • Flat bandwidth up to 1 MHz at ±0.5dB
    • 2 MHz of bandwidth at -3dB
    • 1 MΩ of input impedance
    • ±20 V input voltage range
    • Maximum buffer size of 32640 samples per channel
  • Arbitrary Waveform Generator
    • Sine, triangle, sawtooth, square and DC outputs
    • 10-bit resolution
    • 1 Hz to 1 MHz frequency
    • 3 V pk2pk output with ±1.5 V offset
    • 10 mA output current
    • 25000 sample buffer size
  • Logic Analyzer and GPIO
    • 10 Channels multiplexed between the Logic Analyzer and as general purpose IO
    • 3.3V CMOS logic for both the Logic Analyzer and GPIO
    • 7 mA source and 12 mA sink when used as GPIO
    • Logic Analyzer has a sample rate of 10 MS/s
    • Maximum buffer size of 32640 samples per channel for the Logic Analyzer
  • Power Supply
    • 2 Channels
    • ±4 V output voltage
    • 50 mA per channel
  • Other features
    • Two external triggers
    • USB powered device
    • 4 user LEDs

OpenScope MZ Hardware Block Diagram (Click to enlarge)

OpenScope MZ Pinout Diagram

OpenScope MZ J1 Header Pinout
Top Row Bottom Row
1 D8 (8) 2 UART_RX/PWM2 (P5)
3 D7 (7) 4 SPI_CS/UART_RTS/PWM1 (P4)
5 D6 (6) 6 SPI_CLK/UART_CTS (P3)
7 D5 (5) 8 SDI/SDO/UART_TX (P2)
9 D4 (4) 10 SDI/SDO (P1)
11 D3 (3) 12 INT/CLK2 (C2)
13 D2 (2) 14 DO10 (10)
15 D1 (1) 16 DO9 (9)
17 Trigger Input (T1) 18 Trigger Output (T0)
19 GND (↓) 20 GND (↓)
21 AWG1 (W1) 22 INT/CLK1 (C1)
23 DC Output 1 (V1) 24 DC Output 2 (V2)
25 GND (↓) 26 GND (↓)
27 AI2+/OSC2 (2+) 28 GND/AI2- (2-)
29 AI1+/OSC1 (1+) 30 GND/AI1- (1-)

Walk Around the Board

Walk Around the OpenScope

Oscilloscope

OpenScope MZ uses the ADC on the PIC32MZ to create a 2 channel oscilloscope with 12-bits of resolution per channel. Each channel has a pair of analog inputs with a PWM output to facilitate the interleaving of the two inputs, one PWM to handle the input offset voltages, and one DMA channel at the second highest priority to transfer the measured data.

Analog Input on the OpenScope MZ

To ensure that the ADC performs accurately, a 3 V reference with feedback must be assumed to be accurate with 0.1% resistors and 10% capacitors.

3V reference for the Oscilloscope

The oscilloscope has the following features:

  • 2 Channels
  • 12 bits of resolution per channel
  • 6.25 MS/s per channel
  • 2 MHz bandwidth at -3 dB
  • Input impedance of 1 MΩ
  • Input voltage range of ±20 V
  • Maximum Buffer Size of 32640 samples per channel
    • Reduced from a maximum size of 32766 samples to account for ADC warm-up and pre-trigger data, various delay timer overrun sources, and a 4 byte reduction to prevent large DMA stalls when the maximum destination block size is used.

Function Generator

The OpenScope MZ has a single channel 10 MS/s 10-bit function generator. An R2R resistor ladder with 1% resistors is used in place of a DAC. Due to the nature of resistor ladders, it is possible to have a missing code for steps larger than 3 mV or encounter propagation delays, most notably when switching between the values of 0x1FF and 0x200. The channel uses 10 IO pins on the PIC32MZ to generate the output through the resistor ladder and a DMA channel that is shared with the Logic Analyzer at the highest priority level to transfer data and a PWM output to control the offset voltage level.

Function Generator schematic

Actual Propagation delay

Digilent's WaveFormsLive supports a calibration option for the function generator where each voltage code is applied and then read via the feedback network; the 1000 best codes that most closely match the ideal values (i.e. every 3 mV) are saved in a lookup table for future use by the function generator.

Feedback circuit for the Function Generator

The function generator supports:

  • Sine, triangle, sawtooth, square and DC outputs
  • 10-bit resolution
  • 1 Hz to 1 MHz frequency
  • 3 V pk2pk output with ±1.5 V offset
  • 20 mA output current
  • 25000 sample buffer size

Digital I/O

The OpenScope MZ has 10 user IO pins that are shared between the Logic Analyzer and as digital input/output pins. A DMA channel shared with the AWG at the highest priority level is used to transfer data received by the PIC32MZ.

User IO Pins

  • 10 Channels multiplexed between the Logic Analyzer and as general purpose IO
  • 3.3V CMOS logic
  • 7 mA source and 12 mA sink when used as GPIO
  • Logic Analyzer has a sample rate of 10 MS/s
  • Maximum buffer size of 32640 samples per channel for the logic analyzer

DC Power Supplies

OpenScope MZ has two DC outputs that are driven by their own PWM output with a single PWM line for the DC offset. A gain circuit is implmented on the OpenScope MZ to provide a voltage range of -4 V to 4 V for each channel. A feedback circuit is also present to allow for calibration of the DC output.

DC output

DC output feedback

  • 2 channels
  • ±4 V
  • 50 mA per channel

Communication with the host

A block diagram of how the OpenScope MZ communicates with the host is provided below:

User Interface communications setup

UART Interface

OpenScope MZ uses an FTdI FT232RQ USB/Serial converter to handle the flow control between a host computer and a connected OpenScope MZ. The host computer will need a USB 2.0 High Speed (or better) port to allow the OpenScope MZ to run at 1.25 MBaud (139 kB/s) and to negotiate 500 mA on the USB bus. Users may interact with the OpenScope MZ via a terminal in either Menu Mode or JSON Mode. A pair of DMA channels at the lowest priority are dedicated to the UART. If any other DMA channels stall out the UART DMA, all communication with the host will cease.

WiFi

The OpenScope MZ uses a MRF24WG0MA WiFi chip to enable wireless communication with a browser based UI, WaveFormsLive (WFL). The OpenScope MZ itself implements a simple HTTP Server that stores static web content on a μSD card and supports dynamic content implemented in the code through the Digilent deIP™ Network Stack. More information about WFL and the Digilent Agent can be found on the OpenScope MZ Resource Center.

Timers

8 out of 9 timers available on the PIC32MZ are utilized for the OpenScope MZ to trigger the ADCs, DMA transfers, PWM outputs, and trigger delays. Two timers are dedicated to the ADC channels, two are dedicated to the DC outputs, one for the DC offset, one for the function generator and logic analyzer, one for an external trigger, and one for the hardware protocol.

Triggers

The PIC32MZ triggers are used to initiate and control all of the DMA transfers in the OpenScope MZ. When a trigger is enabled, a data acquisition will run continuously before the trigger event because it is not known when the trigger event will occur. Data acquisition will also continue to run until all post trigger data is collected. Due to data acquisition size limitations, it is not possible to measure a point of interest that exists too far in advance prior to the trigger event. The reverse for a point of interest too far after a trigger event is also true.

Supported triggers for the oscilloscope are:

  • Rising or Falling Edge triggers
  • Rise/Fall time with lower and upper threshold
  • By default WaveForms Live sets the lower threshold 30 mV below the upper threshold

Supported triggers for the logic analyzer are:

  • Rising, Falling or either Edge triggers
  • Any of the 10 LA signal channels in any combination
  • Pattern matching of the LA signal channels is not supported

DMA

8 out of 8 DMA channels available on the PIC32MZ are used on the OpenScope MZ. Two channels are dedicated to UART, a pair of DMA channels are assigned to each interleaved ADC channel for a total of four channels, one channel is shared between the function generator and the logic analyzer and one dedicated to hardware protocol communication. All DMA channels can be triggered on any interrupt event and do not require the use of an ISR.

DMA is used to transfer data without utilizing the CPU by working in parallel with the CPU and has to ability to access peripherals and non-cached memory at much greater speeds. DMA cell transfers are serialized so care is taken in the OpenScope firmware to ensure that multiple channels are not triggered above 10 MT/s to prevent a high priority channel from stalling all other DMA channels.

PWM

9 PWM channels of the PIC32MZ are implemented on the OpenScope MZ. Two are used in the interleaving of the ADC channels, three are used for offsets for the AWG and both analog input channels, two are used for the DC outputs, and the remaining two used as offsets for the DC outputs.

The PWM outputs have 330 unique values ranging from 0 V to 3.3 V, with a step size of 10 mV. The internal clock runs at 100 MHz, providing a PWM frequency of 303 kHz. All of the analog designs on the OpenScope MZ are based on PWM values from 50 to 300 to allow some headroom for calibration.

Troubleshooting

LED Indicators

The LEDs on the OpenScope MZ are used to indicate the current status of the OpenScope MZ hardware as follows:

Note: Firmware versions prior to 1.2.0 will not exhibit the LED behavior described below.

  • Blue Off - Device is booting and not ready to use.
  • Blue Flashing - Device is booted and ready to use but Wifi is not connected.
  • Blue Solid - Device is booted and ready to use and Wifi is connected.
    • The three other LEDs blink the last octet of the OpenScope MZ's IP Address.
  • Red Solid - Calibration or acquisition in progress.
  • All user LEDs Solid - An error has occurred. Reboot the OpenScope MZ.
  • When connected to a Wifi network the 3 user LEDs display the last octet of the OpenScope MZ's IP address by blinking the number of times corresponding to that digit of the last octet in decimal. For example an OpenScope MZ with an IP address ending in '123' would blink LD1 once, LD2 twice and LD3 three times.