Introduction: Digilent ZYBO Based Oscilloscope With LabVIEW

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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:

XSysMon_SetSeqChEnables(&ADC,22);

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

Picture of 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

Picture of 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!

Picture of 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

Comments

LariSan (author)2015-11-09

I love your project, are you on Digilent's forum?

azorp12 (author)LariSan2015-11-09

Thanks for comments, unfortunately I don't have an account on Digilent forum :) I improved this design by adding SPI RX / TX controller (written by me in Verilog language) which is used to communicate with external 12 - bit ADC and DAC - so it also can be used as an arbitrary waveform generator - but now I'm working on it (controlling DAC output via LabVIEW program is a good idea and I'm trying to realize it).

LariSan (author)2015-08-26

This is excellent, thank you so much for posting this.

About This Instructable

4,576views

12favorites

More by azorp12:Digilent ZYBO based oscilloscope with LabVIEWIndustrial FPGA
Add instructable to: