This is an old revision of the document!


Nexys 4 GPIO Demo

Overview

Features Used

Not Used Used
16 user switches X
16 user LEDs X
Two tri-color LEDs X
5 User Push Buttons X
Two 4-digit 7-segment displays X
4 Pmod ports X
Pmod for XADC signals X
12-bit VGA output X
USB-UART Bridge X
Serial Flash for Application Data X
USB HID Host With Mouse X
USB HID Host With Keyboard X
Micro SD card connector X
PWM audio output X
PDM microphone X
3-axis accelerometer X
16Mbyte CellularRAM X
Temperature sensor X
10/100 Ethernet PHY X

Description

The Basic User Demo project demonstrates a simple usage of the Nexys4's GPIO and UART. The behavior is as follows:

  • The 16 User LEDs are tied to the 16 User Switches. While the centerUser button is pressed, the LEDs are instead tied to GND
  • The 7-Segment display counts from 0 to 9 on each of its 8 digits. This count is reset when the center button is pressed. Also, single anodes of the 7-Segment display are blanked by holding BTNU, BTNL, BTND, or BTNR. Holding the center button blanks all the 7-Segment anodes.
  • An introduction message is sent across the UART when the device is finished being configured, and after the center User button is pressed.
  • A message is sent over UART whenever BTNU, BTNL, BTND, or BTNR is pressed.
  • The Tri-Color LEDs cycle through several colors in a ~4 second loop
  • Data from the microphone is collected and transmitted over the mono audio out port.
  • Note that the center user button behaves as a user reset button

All UART communication can be captured by attaching the UART port to a computer running a Terminal program with 9600 Baud Rate, 8 data bits, no parity, and 1 stop bit.


Prerequisites

Skills

  • Basic familiarity with Vivado
    • This experience can be found by walking through our “Getting Started with Vivado” guide

Hardware

  • Nexys4 FPGA board
  • Micro-USB cable
  • Headphones or speaker

Software

  • Vivado Design Suite 2015.X
    • Newer/older versions can be used, but the procedure may vary slightly

Downloads

Nexys4 Support Repository – ZIP GIT Repo


How to...

1. Generate the Project

1.1) Download the repository linked in the download section and unzip it in the location of your choosing.
1.2) Generate the GPIO project in the Projects folder by following this guide before continuing: How to Generate a Project from Digilent's Github

2. Build the Project

2.1) Click Generate Bitstream on the left hand menu towards the bottom. Vivado will run through both Run Synthesis and Run Implementation before it generates the bitstream automatically.

Note: If you want, you can click each step by itself in the order of Run Synthesis, Run Implementation and then Generate Bitstream.

3. Program the Board

3.1) Once you have generated your bit file, Click on the hardware manager and connect to your board by choosing the local server option.

3.2) Click program to load the project onto your Nexys4.

4. Run the Project

This portion will help you run the demo and observe all its features.

4.1) Using the Switches with Leds

For this section, all the switches are tied to their corresponding led. Every time a switch is toggled, the led directly above it will toggle with it. If the center push button is pressed, all the Leds will be tied to ground

4.2 Seven Segment Display

The 7-Segment display counts from 0 to 9 on each of its 8 digits. This count is reset when the center button is pressed. Also, single anodes of the 7-Segment display are blanked by holding BTNU, BTNL, BTND, or BTNR. Holding the center button blanks all the 7-Segment anodes.

4.3) Tri-color Leds

The two tri-color leds are set to gradually change colors at all times. The user cannot affect them in this demonstration.
4.4) Microphone to PWM Output

The microphone which is next to Pmod connector JC, records audio data and sends it to the mono audio output located at J8. To listen to the mics output, you will need to plug in headphones or a speaker.