Sunday, 3 March 2024

9k Tang Nano FPGA development board works with Raspberry PI. and Visual Studio Code.

 

About a year ago I added a 9k Tang Nano FPGA development board to my already over populated selection of FPGA development boards that clutter my work bench at the moment.

It 's a neat board and low cost and it can be programmed using open source tools, its a Chinese board that's available from UK sellers. It's easy to work with having development supported by the manufacturer "Gowin Semi"  IDE and other open source tools.

Well that's what the internet sellers and promotors will tell you, but it's not quite like that like that. 

It has taken me about a year to get the module to programme.

Firstly I bought this because you can use open source tools. 

Secondly Verilog is available to work with this board. I have got used to using Verilog when writing modules for Cypress PSoC 5 development boards, where the pre constructed logic does not do all I want.

To get to use 9k Tang Nano FPGA development board, I went down the learning and development road proposed by LushayLabs.

LushayLabs have a very good Tang Nano 9K: Getting Setup blog

I would advise you to follow this carefully especially how to set up the FPGA tool chain in Microsoft Visual Studio Code. 

One of the things you get to understand about working with FPGA is that you tend to need a fast computer to work on. As I have a very fast laptop running Windows 11 OS, I started out with building the IDE on this machine. 

Brilliant Microsoft Visual Code Studio all works as it should. My Verilog instructions synthesise without a hitch, as long as I type Verilog instructions correctly, in fact the Verilog instructions almost write themselves, as you type in VS-Code environment. Synthesis followed by place and route happens without a problem and the bit stream for loading to the Tang Nano via the USB interface completes without a hitch. Everything in the garden is coming up roses? 

Well NO!!!!!

Windows 11, 10 and even as low as 95 refuse to work with the USB port on the Tang Nano. 

I change USB device drivers as indicated in other blogs and notes from Lushay Labs and Gowin, but to no avail, Windows will find the ports in Device Manager but will not load the Tang Nano SRAM with the bit stream. Even  a Windows compiled version of OpenFPGALoader, refuses to work with my Windows machines. 

I have to add I detest hacking into a working OS Widows version, so the only things I change, are what I can find on the web, which does not harm the Windows OS. 

I will touch on OpenFPGALoader later on in the blog.

So the Tang Nano is sat in the box on my beach and I get on with something else, at leat I still have my PSoC 5 dev boards to use. 

I hate to have a no win situation where electronics is concerned.

Recently as part of the development work for another project, using Raspberry Pi. version 3 boards. I decided to develope the code on a Raspberry Pi 4 4Gb board using Microsoft Visual Code. If you are doing this I would recommend the  RPi. 4 has access to a fast USB SSD drive.

That 9k Tang Nano FPGA board is poking its PCB out of the development board box every time I work at the electronics bench. OK I am going to give this little varmint another chance.

The Raspberry Pi. 4 has Microsoft Visual code installed so I install the FPGA environment as described in the Lushay Labs Tang Nano 9K: Getting Setup blog. For the small Verilog module that is used in this blog the RPi. 4 is amazingly quick to generate the final bit stream. So its crunch time.

I plug the 9K Tank Nano into the RPi.'s USB port and select load bitstream, NOTHING, SWEET FANNY ADAMS, NADA, ZILCH. 

As it has been a bit of a time since I searched the net for solutions I have another search. I come across accounts that some people have found that the initial power on surge when plugging in the Tang Nano causes the USB port to shut down. Their solution is to use a powered USB hub. 

OK I have one. It is worth a go. 

So I plug the Tang Nano into the hub, apply power to the hub and plug the hub into the RPi. and select the option to load the bitstream. The output pane in Visual Studio Code has not shown an ERROR and loading information scrolls up the pane. 

CRACKED IT !!!!!!!!!

Yes the flash actually got changed and I can change it again to something else.

If the hub worked for the PI would it work for my fast Windows laptop? It's worth a try, but Windows 10 is not playing ball. Neither is OpenFPGALoader working with Windows 10 and a powered hub. 

I will keep trying to find a solution, as there are various reasons for wanting to be able to use the Windows 10 & 11 Laptops, which are as follows.

The version of SystemVerilog used in Visual Studio Code environment has some quirks which I find annoying. I would also like to use the professional Gowin Semi IDE as it has a lot of functionality that I would like to use which is not available on Raspberry PI or Windows Visual Studio Code.

At present I write the Verilog code in Gowin Semi IDE, transfer the Verilog file to the RPi Visual Studio Code. Change the code to suit the Verilog format required in Visual Studio Code and compile the Bitstream and upload to the Tang Nano from the Pi. If I can get the version of Windows openFPGALoader to work then a lot of my problems will disappear.

Please Comment if you see this and add your thoughts about uploading the Tang from Windows.

 

 


9k Tang Nano FPGA development board works with Raspberry PI. and Visual Studio Code.   About a year ago I added a 9k Tang Nano FPGA developm...