In this example project, you will learn how to use the Cmod S7-25's Spartan 7 FPGA's analog-to-digital core with a Microblaze processor. Xilinx Vivado 2018.2 SDK is used to program the bitstream onto the board and to build and deploy a C application.


Digilent Cmod S7Digilent Cmod S7 is a small, 48-pin DIP form factor board, populated with 36 pins, built around a Xilinx® Spartan®-7 FPGA that brings FPGA power and prototyping to a solderless breadboard. The board includes a Quad-SPI flash for programming, as well as a USB-JTAG programming circuit and USB-UART bridge. The Cmod S7 also features a clock source, Pmod port, and onboard I/O with LEDs and pushbuttons.

Digilent Cmod S7



Import the example project in Xilinx Vivado


Firstly, you need to download and extract ZIP archive ("Cmod-S7-25-XADC-2018.2-*.zip"). After you open the XPR project file in Vivado 2018.2, you export the hardware and launch the SDK. Then, you can create a new Application Project and import the ready-to-run application program:


In the "Select an import wizard" pane of the window that pops up, expand General and select File System. Fill out the fields of the "File system" screen as in the table below. Most of the listed values will be the defaults but are included in the table for completeness.


From directory<archive extracted location>/sdk_appsrc
Files to import pane: sdk_appsrcChecked box
Into folderCmod-S7-25-XADC/src
Options: Overwrite existing resources without warningChecked box
Options: Create top-level folderUnchecked box


Program the hardware and launch the application


Once you connect a test circuit to the Cmod S7-25's analog input pins, you can open a serial terminal, e.g. TeraTerm. Then, you can connect the terminal to the Cmod S7's serial port and choose baud rate of 9600.

In Xilinx SDK, you select Xilinx -> Program FPGA and do not change any field. In the Project Explorer pane, right-click on the "Cmod-S7-25-XADC" application project and select "Run As -> Launch on Hardware (System Debugger)". The application will now be running on the Cmod S7.


Run the demonstration


As long as the demo is running, ten times per second, the voltages on each of the Cmod S7-25's DIP header's analog input pins (AIN32 and AIN33) are read and printed to a connected serial terminal. The readings are accurate to two decimal places. Take care not to apply a voltage greater than 3.5 Volts to the analog pins. Any voltages less than 0 Volts or greater than 3.3 Volts are read as those instead.


The project source files and step-by-step guidelines are available on the Digilent GitHub Page