Introduction: Digilent ZYBO Based Oscilloscope With LabVIEW

This is simple "oscilloscope" using Zynq - 7000 and NI LabVIEW program. To acquire data from external generator I have used built-in 12 - bit, 1MSPS analog to digital converter.

To generate signals I have used DAC output of STM32F407 (unfortunately I don't have professional generator), which generate sine, triangle and square signal. This is preliminary version of design so I will improve some functions in future.

Step 1: Download Base Design System

First of all - download base design system from ZYBO page and upgrade it if you have newer version of Vivado (in this tutorial I have used Vivado 2015.1 version).

Step 2: Add XADC Wizard to Design

To acquire analog data by digital device you have to add ADC option - XADC Wizard. Right click on the block design, choose "Add IP". Then find the "XADC Wizard" and add it.

Step 3: Configure XADC Wizard - Basic Tab

Double click on the XADC Wizard.

In Basic:

  • Interface Options: check AXI4Lite,
  • Startup Channel Selection: check Channel Sequencer
  • AXI4STREAM Option: uncheck Enable AXI4STREAM
  • Timing Mode: check Continuous Mode

Step 4: Configure XADC Wizard - Channel Sequencer

In this stage you can choose the channels which would you like to use. It is important that not all channels all available - in ZYBO are:14, 7, 15, 6. I choosen channel vauxp6/vauxn6. Click ok and close the wizard

Step 5: Constrain Your ADC

To do this step you can use XDC constraint file available on ZYBO site and ZYBO schematic. Schematic is needed, because channels has assigned concrete pins. To channel 6 you have to assign K14 and N14 pins.

Step 6: Synthetize Your Design!

You created programmable logic part of design. Synthetize your design and export it to SDK.

Step 7: Configure UART

Because our design will communicate by UART we have to configure this peripheral in SDK. Initialize the component and set baud rate as shown on the picture.

Of course, you can use other peripherals than UART, for example Ethernet, USB,... Now I'm trying to configure Ethernet but this is very complex thing to do and I have a lot of problems to configure it.

Step 8: Configure ADC

Initialize ADC component using configuration functions - similar to UART configuration functions. After this start the ADC - use the function XSysMon_StartAdcConversion(&ADC)

On while loop, or in the interrupt (if you configure it) read data from your channel by function:

XSysMon_GetAdcData(&ADC,channel number + 16)

Remember - in function:


Instead 22 you have to write channel number + 16 - this is described in header file of SysMon.

To convert raw data to voltage you can use function XSysMon_RawToVoltage(), which returns float value.

Step 9: Send Data to LabVIEW

You can do this step in main function or write your own procedure which is based on interrupts.

It is important that to send the data you have to convert float to char *.

If you write application - compile it and program the device.

Step 10: Build LabVIEW Program

Use VISA Serial blocks and array functions to acquire data from ADC. Convert string to number and create shift register, visualize your data and do a lot of analyses of sine, triangle, square, noise signal. You can replace the for loop by while loop, but in this case you have to delete some portion of data to avoid overflow.

Step 11: Acquire Signals and Analyse It!

Important - for tests use the voltage divider according to maximum voltage of analog to digital converter. Generate waves by microcontroller (in my case - STM32F407) or by generator - if you have this type of device.

To do:

  • Use ethernet or usb instead of serial port,
  • Use interrupts to acquire and send the data,
  • Improve LabVIEW application