Nexys 4 GPIO Demo

Overview

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.

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

Prerequisites

Hardware

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

Software

  • Vivado Design Suite 2016.4
    • Newer versions can be used, but the procedure may vary slightly

Downloads

Nexys 4 GPIO Demo Project Repository – ZIP GIT Repo


Download and Launch the Nexys 4 GPIO Demo

1) Follow the Using Digilent Github Demo Projects Tutorial. This is an HDL design project, and as such does not support Vivado SDK, select the tutorial options appropriate for a Vivado-only design. Return to this guide when prompted to check for extra hardware requirements and setup.
2) In order to fully use the demo, you will need to connect a serial terminal to your Nexys 4. Plug your board into your computer with a Micro USB cable and make sure the board is turned on. Then open a serial terminal (such as TeraTerm) on your computer. In the terminal application, setup the serial port to connect to the appropriate port for your board, with a baud rate of 9600. Then return to the Github Projects Tutorial to finish programming and running the demo.

Using the Nexys 4 GPIO Demo

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

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.

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. 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.

5. UART Messages

On startup or reset of the demo, the message “NEXYS4 GPIO/UART DEMO!” is sent over UART to your serial terminal application. Whenever the right, left, up, or down button is pressed, the message “Button press detected!” will be sent.