Gowin: Which programmer to use? - Page 1
Forum section: electronics / general

author: mblinov
author_rank: Contributor
timestamp: May 17, 2022, 10:09:22 pm
content: 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_dpCould 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)

author: josuah
author_rank: Regular Contributor
timestamp: May 18, 2022, 11:41:40 am
content: 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 onhttps://magicjellybeanfpga.github.io/mjb/hardware.html

author: mblinov
author_rank: Contributor
timestamp: May 18, 2022, 03:55:56 pm
content: 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?

author: mblinov
author_rank: Contributor
timestamp: May 18, 2022, 04:41:30 pm
content: Hi all, quick update: I asked the folks at themagicjellybeanfpgaproject, who forwarded my inquiry to Gowin support. Here's their reply:QuoteSo it looks like im splitting hairs here. Cheap option it is.

author: mon2
author_rank: Frequent Contributor
timestamp: May 18, 2022, 06:28:13 pm
content: 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.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: May 19, 2022, 06:55:47 am
content: QuoteIf it's open source, Please share it here

author: mon2
author_rank: Frequent Contributor
timestamp: May 19, 2022, 08:35:36 am
content: 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-BL702Emulates FTDI MPSSE.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: May 21, 2022, 07:57:07 am
content: 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.

author: mon2
author_rank: Frequent Contributor
timestamp: May 21, 2022, 11:30:15 am
content: 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!!!

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: May 23, 2022, 09:48:15 am
content: 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.

author: mon2
author_rank: Frequent Contributor
timestamp: May 23, 2022, 10:24:04 am
content: This will provide a good start:https://github.com/zoobab/versaloonA 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 23, 2022, 10:41:22 am
content: Quote from: ali_asadzadeh on May 23, 2022, 09:48:15 amIf 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.

author: mon2
author_rank: Frequent Contributor
timestamp: May 23, 2022, 01:47:22 pm
content: 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 23, 2022, 03:27:14 pm
content: 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

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: May 24, 2022, 06:40:13 am
content: QuoteDO you have any opensource project on that for AMD(Xilinx) or Intel(Altera)?

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 24, 2022, 11:05:44 am
content: 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 FPGA2) 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.

author: bingo600
author_rank: Super Contributor
timestamp: May 24, 2022, 04:47:28 pm
content: Embedded programming of bitstreams Altera & XilinxAlteraKeyword jam staplhttps://github.com/htlabnet/Jam_STAPL_for_ArduinoXilinxKeywordSVF ... Well xsvfCollin Oflynn's lubloader (avr)http://sourceforge.net/projects/lubloader/xsvf loadershttp://www.clifford.at/libxsvf//Bingo

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: May 26, 2022, 06:48:34 am
content: Thanks pcprogrammer and bingo600

author: josuah
author_rank: Regular Contributor
timestamp: March 30, 2023, 09:00:33 am
content: 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 thatsupports 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.

author: josuah
author_rank: Regular Contributor
timestamp: March 30, 2023, 09:04:35 am
content: openFPGALoaderworks verywell with many debuggers supported it, some of which might already be on your part drawer.OpenOCD also has apatchongoing for GOWIN programming support, which might mean even more dongles that can program an FPGA.