How can I control the LEDs on the Tang nano 9K FPGA? Using USB Serial interface supported by the Tang nano 9K.
The Tang has two available interfaces via USB
- Serial (standard CDC serial)
- JTAG (used to program the FPGA)
For development tools, using vscode with the Lushay Code extension for compiling and programming the FPGA. I have a brief intro into using these tools or follow the link and follow the installation. There are plenty of examples.
For the UART code, using IP from here.
Here is a screen shot of the complete project.
To compile the code, use the lower left, click on FPGA toolChain. Have the option to compile and program the board.
Once the board is programmed, open minicom --device /dev/ttyUSB0 and set the serial port baud rate to 115200 no hardware handshake. If there is an issue with permissions please let me know, will add this to the howto.
The verilog code maps the received serial byte to the lower four LEDs via the the following code:
assign {led[3], led[2], led[1], led[0]} = ~uart_tx_axis_tdata;
The LEDs are tied to 1.8v so, a low will turn on the LED. So, inverted logic is used.
Use the number pad, 0 thru 9, this will be ASCII 0x30 through 0x39. So, the LEDs show the value.
Working on another article to control two hardware LEDs, a LED strip and the on board LEDs using serial port.
Comments
Please log in or sign up to comment.