Nexys Video PS/2 Keyboard Demo


Overview

The PS/2 Keyboard Demo demo consists of a Vivado hardware project and an SDK project for the MicroBlaze processor which will interpret data received from a USB Keyboard connected to the Nexys Video USB HID port. The data will then be passed via UART to a PC which can display it on a terminal. The key element of the demo is the AXI PS/2 IP core. This IP works as a PS/2 controller for the PS/2 lines found between the FPGA and the PIC24 which manages the USB HID port.

Features Used

Not Used Used
8 user switches X
8 user LEDs X
128×32 monochrome OLED display X
USB-UART Bridge X
160-pin FMC LPC connector X
Micro SD card connector X
HDMI Sink and HDMI Source X
DisplayPort Source X
Audio codec w/ four 3.5mm jacks X
6 user push buttons X
User EEPROM X
10/100/1000 Ethernet PHY X
512MiB 800Mt/s DDR3 Memory X
Serial Flash X
Four Pmod ports X
Pmod for XADC signals X
USB HID Host X
USB PROG/DPTI X

Prerequisites

Skills

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

Hardware

  • Nexys Video FPGA board
  • Micro-USB cable
  • USB Keyboard

Software

  • Vivado Design Suite 2016.4
    • Newer/older versions can be used, but the procedure may vary slightly
  • Xilinx SDK
  • Serial port terminal (teraterm, putty etc)

Downloads

Nexys Video Support Repository – GIT Repo


Tutorial

1. Generate the Project

1.1) Download the repository linked in the download section and place it in the location of your choosing.

1.2) Generate the PS/2 Keyboard Demo project within 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. Export to SDK

Export the MicroBlaze project by going to File>Export>Export Hardware. Click the check box to Include the bitstream, and export it to the hw_handoff folder.

4. Import the SDK files

In your project Explorer window on the left side, click File>Import then expand the General tab and click Existing Projects into Workspace. Navigate to the download folder, select the sdk folder, and click OK. In the Import window, click Finish to import the SDK project. Once the project has been imported, right-click on design_1_wrapper_hw_platform_0, select Change Harware Platform Specification, go to the hw_handoff, and then select the file found inside. Also, make sure to regenerate the BSP sources.

5. Program the FPGA

Click Xilinx Tools>Program FPGA and click Program. Xilinx SDK will then program the FPGA with a MicroBlaze bit file.

6. Run the SDK program

Right-click on the PS/2 Keyboard Demo folder and click Run as>Launch on Hardware(GDB). The MicroBlaze program will be programmed onto your Nexys Video.

7. Running the Nexys Video PS/2 Keyboard Demo


7.1) After connecting the board to the PC and turning it on, the terminal must be configured to the correct COM port and baud rate - 9600.

7.2) Load the bitstream and then run the SDK project - KeyboardDemo. The first things that can be noticed is that the three keyboard LEDs - Caps Lock, Num Lock and Scroll Lock will flash and that a text appears on the terminal.

example1.jpg

7.3)The way the project works is pretty simple. By simply pressing a button, it's corresponding make code - when pressed - and break code - when released - is received by the software and interpreted. After the interpretation is done, it's corresponding character is sent via uart to the terminal and displayed.

example2.jpg

7.4)Most of the keyboard buttons have been implemented at least to some degree. All of the alphabet letters together with high caps are working. High caps can be set either by using any of the shift buttons or by pressing the caps-lock button.

The numbers 0-9 are also implemented however the special characters are not.

When keys that have not been implemented are pressed, “Unknown Key!!” is displayed on the terminal. Depending on the key, this text can be accompanied by misinterpreted key codes since some keys may produce longer make/break codes than others which can lead to identification errors.

example3.jpg

Output for “Page Down” button:

example4.jpg