• 0

Troubleshooting Switch Issues on FPGA


I have a switch on my Basys 3 board that the board thinks is always in the on position. Does anyone have any ideas for troubleshooting the issue. I've put a multimeter to it to test continuity and it behaves like you would expect. I know that it's something to do with the switch and not whatever output I display to (it does the same for the LED's, the seven segment display, and through the SDK terminal on my computer.

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0


if I were faced with the issue (this is maybe somewhat overkill) , I'd set up a five-line design that routes two switches (one known-good) to two LEDs.

Then build and run twice, with pullups or pulldowns enabled in the constraints file for the switch input

set_property PULLDOWN true [get_ports {mySwitchPorts[*]}]

same alterrnatively with PULLUP

If the LED follows the pull direction on the broken switch, the pin is floating. This would indicate a bad solder connection or a torn PCB trace / via.
Sometimes, pushing gently with a finger on PCB and FPGA can reveal such a failure.

Disclaimer: 99.9 % of all isses are NOT hardware-related (but that makes the remaining 0.1 % all the harder to spot)

Edited by xc6lx45
Link to post
Share on other sites
  • 0


@xc6lx45 has obviously been down some of the same same dark country roads that I've known as far as debugging is concerned.

So this is a great opportunity to get experience with concepts and tools available to assist the debugging process. One problem for me is that I don't use the board design flow and have the Vivado tools (ILA and VIO) available ( I don't know if they are available to the free Vivado user..). I'm assuming that the switch input in question is always showing either a logic '1' or '0' all the time in whatever your sensor ( i.e. LED, HEX display etc is). I'm also assuming that you have a MicroBlaze as that is the way Xilinx and Digilent prefer you use your FPGA.

Do, take xc6lx45's comments to heart and try and determine if the pin connected to your bad switch is changing values as the switch is moved from one position to the other. You can't probe a pin with your multimeter but you can probe the side of a pull-up or pull-down resistor not connected to Vcc or GND. You will need to review the Basys3 schematic to find the right resistor ( and have good fine motor skills to avoid shorting signals that shouldn't be connected).

First, I suggest that you read through all of the messages that the synthesis, place and route, and bitgen are mentioning. It is possible that your input isn't surviving these tools. There will be a lot of messages for a MicroBlaze design. If you are using a MicroBlaze then you have a lot of software that could be a problem. Again check messages.

Second, if there's no sign of your input being removed from the final logic, you can try a "golden" or "known good" design for your board to see if the issue follows the design. An all HDL design would be preferable. I can't help you here because I don't have a Basys3 board to test on. Somewhere there surely must be a decent HDL demo design using the switches.

Third, if you have VIO or the ILA debugging IP available then this is a good way to find out if your input exists in the final bitstream and is working as an input.

That should help get you started as I don't know your level of knowledge or competence outside replicating the simple demo project(s) provided by Digilent.

Edited by zygot
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now