Overview

Our development environment is configured with tools that can “synthesize” Verilog to a configuration file (called a bitstream) for the iCE40 UltraPlus FPGA, which is on the UPduino board. The UPduino also includes an RGB LED, which can be used for output.

Preparation & Plugging in

  1. Programming requires your USB (data) cable, your UPduino, and either Chrome (macOS or Windows) or Edge (windows).

    Caution!

    Only browsers with WebUSB support will work. Safari does not support WebUSB.

  2. Plug the UPduino into your computer.

    Windows


    Pay close attention to these directions! Replacing the wrong driver may cause your computer to perform poorly!

    The tools being used require the WinUSB driver. Other drivers may be installed by default or due to prior work, like working with Arduinos.

    You can use the Zadig.exe installation tool to change the driver.

    1. Connect the UPDuino
    2. Download and open Zadig
    3. click Options > List All Devices
    4. Select the UPduino from the list (If the UPduino is not shown, you may want to confirm that you have a data-capable cable)
    5. If it’s not already selected, pick “WinUSB” in the right box (above Reinstall Driver)
    6. Click Reinstall Driver. It may take a few minutes to download and install the driver. Some versions of Windows may also require a reboot.

    Note in the picture below the UPduino was selected, then the WinUSB driver was selected, and finally “Reinstall Driver” was clicked.

    Zadig Driver Tool

    Other resources:

    macOS

    Newer versions of macOS will ask if you want to connect to USB devices. If so, be sure to select “Allow”. If you have difficulties accessing the device, you may want to adjust the default permissions for accessories as described here. (“Ask for new accessories” is probably the best choice, but “Always” may be beneficial if you are unable to get it to connect).

    If you don’t see any evidence of the UPduino being connected confirm that you have a data-capable cable.

Running the Programmer

Use the Task to open the FPGA programmer (“FPGA Programmer Server”). Unlike most tasks, this one will continue running. Note the button is not the usual “play” button, which indicates that the FPGA Programmer Server is still running. Pressing it again will stop the task, but that is seldom necessary.

FPGA Image Server

Running the task should reveal an “Open in Browser” pop-up:

Open in Browser

Clicking on the button should open a web browser to the “programmer page”.

If you close the browser tab or don’t see that pop-up, you can use the “PORTS” tab in the VS code bottom pane to get the URL or re-open it:

Reopen in Browser

You can also open the “PORTS” view by View > Open View... and searching for “ports”.

Connecting

“Images” (bitstreams) are files that describe how the FPGA should be configured. The initial webpage should look something like:

Programmer Page

You will need to “connect” to the UPduino via the Connect button. That should cause the browser to pop-up a window that will allow you to select and connect to the UPduino:

Select UPduino

Programming Images

Each “image” file will have an Upload button. If the UPDuino is connected, you should be able to upload the image to program it. Most repositories will contain images that turn the led colors. You can use these images to confirm that programming is working. After selecting Upload on an image you should see the row for that image fill with a reddish color as the UPduino is erased and then a greenish color as the image is programmed. You’ll also see status messages in the “Standard Output” (StdOut) pane (or possibley error messages in the “StdError” pane)

Try programing one of the LED color images (red.bin or blue.bin), which should make the LED on the UPduino the corresponding color.

Led & Key Module

Your kits contain an LED & Key module that includes 8, 7-segment displays, 8 traditional LEDs, and 8 push buttons. The module is controlled by the TM1638 (which can be controlled by a state machine!).

HW-154

Your kit also comes with a male to female jumper wires that can connect your breadboard to the module:

Male to Female Cable

Use the cable to connect the UPduino to the board:

UPduino to board

UPduino Pin Number/Name Board Pin Name
3V3 VCC
GND GND
23 STB
25 CLK
26 DIO

It should look about like below (the board has been rotated and a rubber band has been used to hold it to the breadboard):

UPduino to board

Program the ledandkey_test.bin image.

Use the web page to program the ledandkey_test.bin image on the part. If it works, the board should show 8. on each of the 7-segment displays. All LEDs should also be on, but the I/O boards have an astonishingly high rate of bad LEDs. Pressing a button should cause the corresponding 7-segment display and LED to turn off. Confirm that the board is connected correctly, that the 7-segment displays work, and the each button works. Most boards will have black marks indicating LEDs that may not be working correctly.

Trouble Shooting

Check all wiring

Carefull check all external wiring to confirm there aren’t short circuits, misconnected wires, or floating inputs/outputs.

Confirm Connection / Reconnect

Double check the USB cable. Also, confirm that you have a USB cable that is data capable!.

  1. You may need to reload the page and reconnect to the UPduino via the Connect button.
  2. If connection is successful, the Connect button should be faint and the Disconnect button should be enabled:

Connected

Confirm Programming

  1. The last bitstream that was successfully programmed to the UPduino will be highlighted with a Green bar. If no images have a green bar, you may need to confirm that you’re connected and select Upload by the image.
  2. Images also contain the creation time. If the UPduino isn’t updating as expected, you may want to confirm that the image is changing when you change your source code and run the task to create the bitstream.

After Upload

Images Not Updating

If the image isn’t updating, you may want to review the Problems tab for clear syntax problems and the Terminal associated with the task for problems related to creating the bitstream. In the example below there was an error in the blink: image task:

  1. The Problems tab shows syntax errors.
  2. Selecting
    1. the Terminal tab (2a) and then
    2. the terminal associated with the blink: image task (2b)

    shows more detail about errors. Some configuration errors will not be shown in Problems, but will be shown in the terminal. This also provides a lot more detail about the synthesis process.

Programming Problem Details