FPGA pushbutton toggles LED

Overview

PyPi module N/A
git repository https://bitbucket.org/arrizza-public/fpga-pushbutton-led-toggle
git command git clone git@bitbucket.org:arrizza-public/fpga-pushbutton-led-toggle.git
Verification Report https://arrizza.com/web-ver/fpga-pushbutton-led-toggle-report.html
Version Info
  • Ubuntu 20.04 focal, Python 3.10

Summary

CMODA7 FPGA - toggle an LED when the pushbutton is pressed. Shows how to keep an internal state in the FPGA. See https://arrizza.com/fpga for prerequisites and setup.

Note: original code is from https://stackoverflow.com/questions/60930471/how-to-create-positive-edge-detector-behavioural-code

To install

  • clone the repo
  • Open Vivado
  • click Open Project
  • navigate to the repo and select the .xpr file

Settings

  • select Settings (blue cogwheel)
    • select Tool Settings | Project
    • in Default Project Directory, select "Specify project directory" and select the directory for this project
    • click OK

To program and run

  • find "SYNTHESIS" in left hand pane
    • click "Run Synthesis" next to Green arrow
    • see upper right corner in menu bar for status e.g. "running synth_design" with a cycling green circle
    • takes 1-2m
  • get dialog box "Synthesis Completed"
    • ensure "Run Implementation" selected
    • click OK
  • get dialog box "Launch Runs"
    • set Number of jobs to the number of cores your PC has (e.g. 8)
    • click OK
    • see upper right corner in menu bar for status e.g. "initializing Design" with a cycling green circle
    • takes 1-2m
  • get dialog box "Implementation Completed"
    • select "Generate Bitstream"
    • click OK
  • get dialog box "Launch Runs"
    • click OK
    • see upper right corner in menu bar for status e.g. "Running write_bitstream" with a cycling green circle
    • takes 1-2m
  • get dialog box "Bitstream Generation Completed"
    • select "Open Hardware Manager"
    • if No hardware target is open:
      • ensure your FPGA is connected via USB-micro and powered on
      • click "Open Target" either in left hand pane or in green bar at top of window
      • get a dropdown menu
      • click "Auto Connect"
      • get dialog box, takes 5 - 10s
      • Hardware pane should have your FPGA in it and indicate "Connected"
  • there should be a new item "Program device" in the left hand pane and in the the green bar at top of window
    • click "Program device"
    • get dialog box "Program Device"
    • click "Program"
    • takes 1-2s

To test

  • There is a button on the FPGA board BTN0 (closest to the 12 pin header)
  • There are 3 LEDs: LD0, LD1 and LD2

    • LD0 is a tri-color led and should be lit (blue)
    • LD1 and LD2 are off (both green)
  • click BTN0 => LD1 should turn on

    • LD0 should stay lit (blue) and LD2 be off
  • click BTN0 => LD1 should turn off
    • LD0 should stay lit (blue) and LD2 be off

- John Arrizza