Author Topic: Gowin: Which programmer to use?  (Read 4444 times)

0 Members and 1 Guest are viewing this topic.

Offline mblinovTopic starter

  • Contributor
  • Posts: 43
  • Country: gb
Gowin: Which programmer to use?
« on: May 17, 2022, 10:09:22 pm »
Hi everyone,

I am looking into evaluating the Gowin FPGA platform, and I'm confused by the presence of two JTAG adapters from Gowin:
 - Gowin PL-USB-Cable_V4.0: https://www.amazon.co.uk/Gowin-PL-USB-Cable_V4-0-FPGA-Download-Cable/dp/B09B3MWDJ5?ref_=ast_sto_dp
 - GOWIN USB Dongle (U2X): https://www.amazon.co.uk/Gowin-GOWIN-USB-Dongle-U2X/dp/B09S3D65D4?ref_=ast_sto_dp

Could someone whos experienced with Gowin stuff suggest what's the difference between them? I've read some past forum threads on the subject but didn't get any conclusive answers.

My intention is to play around with the "MiniStar Nano" (https://www.amazon.co.uk/Gowin-MiniStar-Nano-Limited-Edition/dp/B09CD8BG8M?ref_=ast_sto_dp)
 

Offline josuah

  • Regular Contributor
  • *
  • Posts: 119
  • Country: fr
    • josuah.net
Re: Gowin: Which programmer to use?
« Reply #1 on: May 18, 2022, 11:41:40 am »
In case that helps, there was a thread last year about that MiniStar Nano:
https://www.eevblog.com/forum/fpga/gowin-ministar-nano-limited-edition/

It looks like the goal is to end-up with a working JTAG programmer, whichever chip does that job (an MCU bit-banging JTAG, an FTDI letting the host bit-bang JTAG over USB, a J-Link...

Maybe there is more on https://magicjellybeanfpga.github.io/mjb/hardware.html
 

Offline mblinovTopic starter

  • Contributor
  • Posts: 43
  • Country: gb
Re: Gowin: Which programmer to use?
« Reply #2 on: May 18, 2022, 03:55:56 pm »
Yes, I did read that thread and a few others. I suppose then, if both the "U2X" and the "PL-USB-Cable_V4.0" ultimately serve the same purpose (programming the FPGA over JTAG), then my question is whether the big "PL-USB-Cable_V4.0" Gowin programmer is worth paying an extra £50 for?
 

Offline mblinovTopic starter

  • Contributor
  • Posts: 43
  • Country: gb
Re: Gowin: Which programmer to use?
« Reply #3 on: May 18, 2022, 04:41:30 pm »
Hi all, quick update: I asked the folks at the magicjellybeanfpga project, who forwarded my inquiry to Gowin support. Here's their reply:

Quote
Both cables are supported by GOWIN programmer. You should not see the difference in your project.

There are 2 obvious differences:
  • The physical form is different:
    • The PL-USB-Cable is a box with both ends connected to cables. One side is USB cable to PC, the other end is JTAG cable to your board.
    • USB Dongle has only Jtag cable to your board. The other side is a USB connector that can plug into your PC.
  • The chip is different from current listing:
    • The PL-USB-Cable is using FDTI232
    • USB Dongle is using GOWIN’s GWU2X
  • Price is obvious different.

So it looks like im splitting hairs here. Cheap option it is.
 
The following users thanked this post: edavid

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #4 on: May 18, 2022, 06:28:13 pm »
FTDI232H to be exact will be inside the cable. I would rather have multiple root canals than try to source these on the market. TBH, took a chance and imported a few (5 pieces ) from an Aliexpress store which FTDI did not recommend. We have not yet tested these parts out but we trust the vendor from past dealings.

GWU2X is the best choice as the part is likely available and is based on Gowin silicon and support so it is a proven solution.

We are about to test JTAG emulation using RISC cores to mimic the programmer.
 
The following users thanked this post: ali_asadzadeh, ch_scr, mblinov

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1902
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #5 on: May 19, 2022, 06:55:47 am »
Quote
We are about to test JTAG emulation using RISC cores to mimic the programmer.
If it's open source, Please share it here >:D
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #6 on: May 19, 2022, 08:35:36 am »
Yes, open source. The risc-v micro BL702 is $0.80usd on AliExpress. The built pcb is about $4usd.

https://github.com/sipeed/RV-Debugger-BL702

Emulates FTDI MPSSE.
 
The following users thanked this post: paf, ali_asadzadeh

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1902
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #7 on: May 21, 2022, 07:57:07 am »
Thanks mon2 for sharing, Actually I want to use my Main STM32 device to load the Bitstream to the FPGA too, so the firmware can be updated after the product is shipped to the customer, beside saving a few parts in the BOM.
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #8 on: May 21, 2022, 11:30:15 am »
I think it is possible to use STM32 as the JTAG bridge for your target device (micro, FPGA, etc.) The thorn in the idea is that I would think you want to remain compatible with the existing API calls made by the host software. Unless you wish to also code from scratch the host programmer application, this is desirable for the best compatibility. Respectively, this is why FTDI MPSSE devices are so popular. Many versions of programming applications available from the factory or open source. We are in similar boats and want to ship product that can be field upgraded. Currently we are developing our design with a usb hub to allow us to test the use of FTDI FT232HQ, the risc-v emulator or U2X device as the usb to JTAG bridge. At PCBA time, we can switch to either solution if there is a silicon shortage. Tired of begging silicon suppliers for parts. Diodes quoted us 70 weeks lead time for a 1v0 LDO yesterday. Unbelievable!!!
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1902
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #9 on: May 23, 2022, 09:48:15 am »
I want to embed the FPGA bin file in the STM32 image, for security reasons and also for ease of update, so I want to use the STM32 to read the bin file when booting and config the FPGA, maybe if you know some open source projects, I can modify it and share it.
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #10 on: May 23, 2022, 10:24:04 am »
This will provide a good start:

https://github.com/zoobab/versaloon

A few years ago, we started a similar project to program a virgin and blank Lattice FPGA. To do this, we applied a bus analyzer to monitor the JTAG transaction between the FTDI and Lattice FPGA.

Then used the XMOS CPU and the details of how JTAG works on Jean's awesome website, fpga4fun.

This worked well to ping and erase the FPGA.

You will have to follow a similar process unless you know already how the FPGA uses the JTAG commands.
 
The following users thanked this post: ali_asadzadeh

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3690
  • Country: nl
Re: Gowin: Which programmer to use?
« Reply #11 on: May 23, 2022, 10:41:22 am »
I want to embed the FPGA bin file in the STM32 image, for security reasons and also for ease of update, so I want to use the STM32 to read the bin file when booting and config the FPGA, maybe if you know some open source projects, I can modify it and share it.

If the Gowin FPGA's are like the ones from other manufacturers you don't need JTAG to load the programming. Use a serial connection to load it from the MCU. Altera calls this PS configuration. The MCU generates the clock and data signal.

Way easier then fiddling with JTAG.

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #12 on: May 23, 2022, 01:47:22 pm »
Gowin is JTAG programmed only - either by FTDI MPSSE or the Gowin U2X Bridge devices.

The U2X bridge is a tad slower on the operation because believe it is due to the bridge being USB 1.1 FS (12Mbps) interface vs. USB 2.0 HS (480Mbps) with FTDI devices.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3690
  • Country: nl
Re: Gowin: Which programmer to use?
« Reply #13 on: May 23, 2022, 03:27:14 pm »
Are you sure about that?

The datasheet seems to show it is possible to do it with different methods.

Edit: this applies to the GW1n and GW2a devices
« Last Edit: May 23, 2022, 03:32:11 pm by pcprogrammer »
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1902
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #14 on: May 24, 2022, 06:40:13 am »
Quote
If the Gowin FPGA's are like the ones from other manufacturers you don't need JTAG to load the programming. Use a serial connection to load it from the MCU. Altera calls this PS configuration. The MCU generates the clock and data signal.

Way easier then fiddling with JTAG.
DO you have any opensource project on that for AMD(Xilinx) or Intel(Altera)?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3690
  • Country: nl
Re: Gowin: Which programmer to use?
« Reply #15 on: May 24, 2022, 11:05:44 am »
I wrote software for loading a Xilinx XC3000 device way back in 1997, but I don't know where the code is. To many backup drives from the past.

Looked at the Gowin documentation and it shows three possible options:
1) Setup the FPGA as a slave SPI device. The MCU is the master and has to clock in the data to the FPGA
2) Setup the FPGA for serial and connect via the DIN interface. The MCU is the master and has to clock the bits onto the DIN line.
3) Setup the FPGA for CPU and connect via a parallel data bus. The MCU will again be the master and clock in the bytes.

All you have to do is make sure that the MODE pins are set for the configuration option you want to use and connect the MCU according to the chosen option.

For SSPI mode all you need to do is set the config pin to the right state and start pushing the bytes out of the SPI interface. The data is most likely what otherwise is written to FLASH, and not the .bit file you would use on the host when configuring via JTAG.

I found a newer manual about the programming of the Gowin FPGA's. Did notice that the internal FLASH of devices that have this can only be programmed via JTAG, but it is not clear to me if these can still be loaded from an external host with the MODE pins set to one of these modes and thus not use the internal FLASH.

Chapter 6 holds the information needed for timing and used signals, so with that you can easily write your own code for it on your STM32 device.

Edit: Another thing to consider is that the pins used for this can also be used to interface between the FPGA and the MCU when the system is running.
« Last Edit: May 25, 2022, 08:38:53 am by pcprogrammer »
 
The following users thanked this post: ali_asadzadeh, Just4Fun

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1987
  • Country: dk
Re: Gowin: Which programmer to use?
« Reply #16 on: May 24, 2022, 04:47:28 pm »
Embedded programming of bitstreams Altera & Xilinx

Altera
Keyword jam stapl
https://github.com/htlabnet/Jam_STAPL_for_Arduino

Xilinx
Keyword
SVF ... Well xsvf

Collin Oflynn's lubloader (avr)
http://sourceforge.net/projects/lubloader/

xsvf loaders
http://www.clifford.at/libxsvf/

/Bingo
 
The following users thanked this post: Just4Fun

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1902
  • Country: ca
Re: Gowin: Which programmer to use?
« Reply #17 on: May 26, 2022, 06:48:34 am »
Thanks pcprogrammer and bingo600
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline josuah

  • Regular Contributor
  • *
  • Posts: 119
  • Country: fr
    • josuah.net
Re: Gowin: Which programmer to use?
« Reply #18 on: March 30, 2023, 09:00:33 am »
Sorry to scavenge that post, but a word of help here:

The FTDI part shortage lead GOWIN to discontinue its PL USB cable and replace it with its GoBridge-based U2X (or GWU2X) solution.

This works well with the GOWIN-based tools, such as the Gowin Analyzer Oscilloscope (GAO, an RTL-bases oscilloscope exporting the data through JTAG).

But if you have a 1.8 V part, make sure to use level-shifting from 3.3 V of the GWU2X, as it would blow something up if using a part with different voltage for a while.

For instance, one can use a small extra FPGA dev board that supports an external Vio, plug the Vio to the same rail as the GOWIN's Vio, and configure piping on the FPGA devboard from some 3v3-powered port to the Vio-powered port.

Of course if you have level shifters or can build some MOSFET-based circuit, that'd work too. :)
 

Offline josuah

  • Regular Contributor
  • *
  • Posts: 119
  • Country: fr
    • josuah.net
Re: Gowin: Which programmer to use?
« Reply #19 on: March 30, 2023, 09:04:35 am »
openFPGALoader works very well with many debuggers supported it, some of which might already be on your part drawer.

OpenOCD also has a patch ongoing for GOWIN programming support, which might mean even more dongles that can program an FPGA.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf