What FPGA boards can receive/send data to PC through USB? - Page 1
Forum section: electronics / general

author: caspian
author_rank: Newbie
timestamp: May 26, 2022, 07:41:19 pm
content: Dear members,I need a FPGA board that can be connected to a PC using USB. I need to send the input data of the FPGA chip through USB from a PC to the inputs of the Chip and then, receive the output data of the FPGA chip through USB from the outputs of the FPGA chip to the PC.Does a FPGA board such as Mojo v3 have this capability?If not so, what FPGA boards do have this capability to receive/send data through USB?Is there any tutorial that clarifies how to use this capability?Thanksnote1: I do not mean to receive/send the FPGA Chip's program through USB.note2: I do not want to use a PCIe FPGA board.

author: langwadt
author_rank: Super Contributor
timestamp: May 26, 2022, 08:01:41 pm
content: did you try google?https://alchitry.com/hello-world-verilog

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 27, 2022, 05:21:03 am
content: There are lots of FPGA boards that have simple USB to serial converters like CH340 on it. Easy to interface on the FPGA but data rate is limited to ~2Mbits per second. When you need more then that you have to look into other solutions.Boards that I have some experience with come from:PiSwords has Xilinx and Altera based boards, but prices went up like crazyhttp://piswords.com/demoboard.htmlhttps://nl.aliexpress.com/item/32828884647.htmlAnother one is QMTECH but there you need either a daughter board plus a FPGA board to get the USB interface, or a more expensive board with it all on one board.https://qmtechchina.aliexpress.com/store/4486047You can also get some CH340 or similar USB to serial modules and connect them to a cheaper FPGA board that does not have such an interface on it.

author: Berni
author_rank: Super Contributor
timestamp: May 27, 2022, 05:35:19 am
content: The usual is indeed USB to UART bridges. They are really easy to implement, but as others have said they can only do up to 1 to 5 Mbit/sIf you want more speed then things get a bit more complicated. One way is using Ethernet to get 1Gbit/s. You can just send raw MAC address traffic to sidestep needing a whole TCP/IP stack and such, but even that is quite a bit of work. Directly doing USB HS on a FPGA to get 480Mbit/s is possible but also quite complex.A nice cheat for getting high speed is the FT600 chip from FTDI that gives you a USB 3.0 to 16/32bit parallel bus bridge at about 3Gbit/s. This makes it really easy to interface to a FPGA since you just set the data pins and clock it in. The FTDI chip takes care of buffering it and sending it over while on the PC side the driver looks much like a serial port (Whatever you send into the bus you get as a sequence of bytes on the PC)

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 27, 2022, 06:04:19 am
content: Quote from: Berni on May 27, 2022, 05:35:19 amA nice solution but not that cheap. But FTDI has a wide range of devices to choose from that might fit the bill for a lower price.Another slightly more complicated and only USB2.0 (480Mbits/s) is using an MCU like the F1C100s as an interface between the FPGA and the PC. This gives you full control on the communication between the two devices but involves writing drivers.

author: caspian
author_rank: Newbie
timestamp: May 27, 2022, 06:29:22 am
content: In the Mojo v3 board, if some data is received by the Spartan6 chip from the serial port, what section of the chip do the data enters?the internal RAM? or a specific block?Can I program the Spartan6 chip so that the serially-received data enter all the logic blocks of the chip for processing?Are the logic blocks that the serially-received data can enter for processing, limited to a few blocks?Is there any limitation (other than data rate) on processing of serially-received data compared to parallel-received data that enter the chip from the IO pins?

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 27, 2022, 06:43:07 am
content: I'm not familiar with the Mojo v3 board, but the way a FPGA works is that you make the programming for it. When an USB to serial module is connected to the FPGA it most likely uses only the RX and the TX lines. In the FPGA you have to connect these signals to your logic. There is no dedicated serial interface on a FPGA (apart from JTAG and configuration logic)Look for verilog or VHDL uart examples. These will provide you with parallel data buses for incoming and outgoing data. Connect these to the rest of your logic in the FPGA.After converting the serial data to parallel with one of those uart examples it is just the same as having parallel IO lines connected to the FPGA.All you have to be aware of is clock domains. Make sure that you synchronize to your main clock in a correct way, and preferably only use one main clock if possible.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 27, 2022, 06:56:58 am
content: I looked at the schematic of the Mojo v3 and noticed that it uses the ATMEGA32 as a possible USB to serial bridge. This means you have to write code for the MCU to handle the communication between the PC and the FPGA.This also allows you to do a parallel interface on the FPGA since a lot of the GPIO pins of the ATMEGA32 are connected to the FPGA.Just take a good look at the schematic on how things are connected:https://cdn.sparkfun.com/datasheets/Dev/FPGA/mojov3-sch.pdf

author: langwadt
author_rank: Super Contributor
timestamp: May 27, 2022, 08:38:21 am
content: Quote from: pcprogrammer on May 27, 2022, 06:56:58 amno, the ATMEGA32 comes programmed to configure the fpga, act as serial to usb bridge and supply adc data to the fpga if needed

author: langwadt
author_rank: Super Contributor
timestamp: May 27, 2022, 08:43:38 am
content: Quote from: caspian on May 27, 2022, 06:29:22 amI think you need to take a few steps back and start at the beginning, first step is understanding what an fpga is.

author: Berni
author_rank: Super Contributor
timestamp: May 27, 2022, 09:55:51 am
content: Quote from: caspian on May 27, 2022, 06:29:22 amLooks like you first need to learn about what FPGAs are and how to use them.They do not work like a MCU where they have predefined interfaces and data paths, no big RAM area that you can just read/write to in any way you want. The FPGA is mostly just a giant pile of logic gates that get wired together to perform a function. Sending data into a FPGA is just wiggling a IO pin, it is then your job to build logic inside that interprets that wiggling as the data you want to receive. This is the main benefit of FPGAs, they can implement any interface you want without needing dedicated hardware for it.

author: pcprogrammer
author_rank: Super Contributor
timestamp: May 27, 2022, 10:58:12 am
content: Quote from: langwadt on May 27, 2022, 08:38:21 amIs it not possible to reprogram the ATMEGA32?Sure you have to write the code to load the FPGA, but that should not be to hard. Either serial bit banging or writing parallel bytes to it. The pins can be reused to interface between the ATMEGA32 and the FPGA.Quote from: langwadt on May 27, 2022, 08:43:38 amBut I agree that it looks like caspian has to start from the beginning and learn how to use the FPGA first.

author: DiTBho
author_rank: Super Contributor
timestamp: May 27, 2022, 12:46:51 pm
content: Code:FPGA |||splitter | _____| | | |+--- fifo0 |===== serial0 5Mbps ===== serial-to-usb =====| |+--- fifo1 |===== serial1 5Mbps ===== serial-to-usb =====| USB |===== 20Mbps ==== bonding+--- fifo2 |===== serial2 5Mbps ===== serial-to-usb =====| HUB |+--- fifo3 |===== serial3 5Mbps ===== serial-to-usb =====| || |_____|this would be insanely great (did I say "insanely"? )crazy

author: Foxxz
author_rank: Regular Contributor
timestamp: May 27, 2022, 02:11:39 pm
content: I have used a mojo board. There are serial examples in verilog for it. It's a decent board but it was difficult for a beginner to get started with it. I would suggest finding a book for beginners that teaches about using a specific board and then buying that board to follow along with the book.But to echo what others have said an FPGA isn't magic and you have to do alot of work to get it to do something. An FPGA doesn't understand what serial or USB is. You have to write code that describes the protocol down to the binary level and how to interact with it. You can make the data you send and receive work however you want such as loading it into a block ram or passing it to another module within the FPGA.There are often examples and 'cores' others have written you can use but unless they are for the specific board you are using you will still need to do some work to make them usable. Even then they make not work how you envision or need them to function.

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 27, 2022, 04:58:28 pm
content: The only dev board that I know of that has a FT2232Hwith enough IOs connected to the FPGA so that it can be used in parallel mode(albeit only asynchronous, because AFAIR, the clock out is not routed) is the Numato Saturn:https://numato.com/product/saturn-spartan-6-fpga-development-board-with-ddr-sdram/I've used it successfully in the asynchronous parallel mode.The async FIFO mode of the FT2232H allows throughputs of up to about 8MBytes/s. Not nearly as much as you can get with the synchronous mode, but way higher than anything you could get with a USB to serial interface.For the record, it's interesting to note that, while many FPGA dev boards include the FT2232H chip (because it can be used as a JTAG interface very easily), most of them only route the second channel as a UART interface, while routing a few more IOs would allow the async (or better yet, the sync) parallel mode. Of course, you can always quickly add this kind of interface using a FT2232H breakout board and connecting it to your FPGA board (keep connections short for parallel modes.)

author: free_electron
author_rank: Super Contributor
timestamp: May 27, 2022, 05:22:01 pm
content: Quote from: Berni on May 27, 2022, 05:35:19 amthis !. you can do the same with the 4232 or certain 2232 chips as well. they emulate a 8051 bus interface (16 bit address, 8 bit data, read and write strobe and give you a couple of handshake lines.all you do on the fpga side is implement a DPRAM.I typically work that way. simply map the register in the FPGA as a virtual ram and the pc can read/write anything it wants. no need for doing complicated uart emulation, fifos and converting stuff to from ascii. you have a channel directly from the PC side to the flipflops.you get 65536 8-bit registers that are random access. if you need more: bank them. use the top byte as index and you can make 256 banks of 65535 ... you'll exhaust the FPGA trying to read/write 134 million bits.

author: langwadt
author_rank: Super Contributor
timestamp: May 27, 2022, 06:32:37 pm
content: Quote from: SiliconWizard on May 27, 2022, 04:58:28 pmI've used this onehttps://numato.com/product/mimas-a7-artix-7-fpga-development-board/afair close to 40MBytes/s in sync FIFO mode

author: DiTBho
author_rank: Super Contributor
timestamp: May 27, 2022, 06:52:51 pm
content: Quote from: langwadt on May 27, 2022, 06:32:37 pmis there any code example?

author: free_electron
author_rank: Super Contributor
timestamp: May 27, 2022, 07:07:46 pm
content: i believe ftdi or altera or terasic have sample code. i rolled my. i know ftdi has it for the ftd6xx

author: chickenHeadKnob
author_rank: Super Contributor
timestamp: May 27, 2022, 09:14:43 pm
content: Cypress (now Infineon I think) FX2 boards that you can still buy cheap on aliexpress have USB2 high speed to parallel throughput similar to FTDI2232H. They have an internal 8051. You can find open source drivers for them, in particular the author of the sigrok drivers has an excellent but moribund youtube channel "OpenTechLab". He describes programming these board(s) in two of his videos. Boards plural to denote the generic FX2 board or the salae logic clone board.

author: mblinov
author_rank: Contributor
timestamp: May 27, 2022, 09:20:01 pm
content: This is one of the major reasons i've been looking into Gowin FPGAs. USB 2.0 PHY right on the chip, plus royalty free IP for it.still though, you have to hook it up yourself - still figuring out whether theres some EHCI wrapper to make it easy to inter-operate with for example TinyUSB.Gowin have an entire video on this - there is some usb 3.0 stuff on the horizon too, which i think is quite exciting.

author: langwadt
author_rank: Super Contributor
timestamp: May 27, 2022, 09:35:32 pm
content: Quote from: DiTBho on May 27, 2022, 06:52:51 pmI think numato might have some, else there is several on github that isn't board specific

author: langwadt
author_rank: Super Contributor
timestamp: May 27, 2022, 09:38:05 pm
content: Quote from: mblinov on May 27, 2022, 09:20:01 pmthe advantage with the FT2232 is that it has drivers and you can swap between jtag and fifo so you can use it for both communication and configuration

author: DiTBho
author_rank: Super Contributor
timestamp: May 27, 2022, 09:54:54 pm
content: Thanks guys-Actually, I have already implemented the crazy four serials in bonding mode, with four FIFO buffers and a fsm to manage them.Many years ago, when Giga-Ethernet was very expensive, we used a couple of Digital Tulip quad Fast-Ethernet PCI-X cards in that bonding setup.Code:computerA | | computerB| |Kernel Linux | | kernel Linuxbonding net | TCP/IP | bonding netPCI-X | 142Mbyte/sec | PCI-XQuadTulip | | QuadTulip+----ch0 ===== ethernet cable ===== ch0 ----++----ch1 ===== ethernet cable ===== ch1 ----++----ch2 ===== ethernet cable ===== ch2 ----++----ch3 ===== ethernet cable ===== ch3 ----+| |______________| |_______________it was possible to move up to 142Mbyte/sec over four ethernet cables. Shocking these days even a 30 euro RPI can do it better and cheaperThat's why I implemented the quad-serial bonding thing. Nostalgia ...

author: Bassman59
author_rank: Super Contributor
timestamp: June 06, 2022, 05:37:45 pm
content: Quote from: SiliconWizard on May 27, 2022, 04:58:28 pmI wonder if they don't wire it up for the parallel mode because that requires host driver support, as it needs to conform to some Vendor-Specific class and not a standard Class? That means host software, too.

author: Berni
author_rank: Super Contributor
timestamp: June 06, 2022, 05:59:43 pm
content: Quote from: Bassman59 on June 06, 2022, 05:37:45 pmI am guessing they mostly just reused the FTDI chip JTAG trick from cheep JTAG dongles for microcontrollers where having a extra UART is the most useful interface to have, so that you can easily interface your application with terminal on the PC. Even then these interfaces are rarely pushed to really high baudrates when they are mostly just printing some debug info to a terminal.The usual way of offering high bandwidth connectivity is sticking gigabit ethernet on a dev board. The PHYs for it are cheap and it can reliably do near full 1Gbit in both directions simultaneously for near 2Gbit of total bandwidth. The same port can also be used to link up multiple dev boards to each other. Quite a few industrial electronics involving PCs also use ethernet in the final product due to its resilience. But for development it is indeed pretty inconvenient.

author: SiliconWizard
author_rank: Super Contributor
timestamp: June 06, 2022, 06:21:54 pm
content: Quote from: Bassman59 on June 06, 2022, 05:37:45 pmFor most such boards I've seen, the FTDI chip still had the original FTDI VID and PID (and not a custom one) and thus the required driver is already there on the mainstream OSs without anything extra to install. Without such drivers, the JTAG interface would not work either anyway, there's nothing "standard" about it. You NEED FTDI drivers to make them work in JTAG, at least on Windows.So, I dunno. It's just probably because the designers either want to save IOs for their customers, or because they don't even know about the parallel interface of those FTDI chips and merely all re-use common application notes/schematics from their competitors, and they all do the exact same. Laziness.But as we mentioned, Numato has done this, and it's handy. Otherwise, as I said, it's not hard to use an extra breakout board for a FT232H for instance and some wiring, but embedding a FT2232H on board and not being able to use it "fully" is just waste IMHO.

author: langwadt
author_rank: Super Contributor
timestamp: June 06, 2022, 08:21:15 pm
content: Quote from: SiliconWizard on June 06, 2022, 06:21:54 pmif they don't have their own VID/PID they might not have an eeprom on the FTDI an that is required to use sync fifo mode

author: mon2
author_rank: Frequent Contributor
timestamp: June 06, 2022, 09:22:36 pm
content: Have not read through this entire thread...sorry.Have a look at:https://ftdichip.com/products/morph-ic-ii/Available in stock @ DK. Pre-covid prices were less, of course. There is also Opal Kelly and I know we have one of their USB 3.0 FPGA boards in the lab.If you are fine to consider using the UART / Serial port over USB as a communication channel with your FPGA, then there is also the Lattice kits which feature the FTDI2232H devices.There are also the FTDI USB 3.1 ICs they created to mate with the Altera / XILINX targets but no idea on their stock position.Then there is the Cypress / Infineon USB 3.1 bridge FX3 IC they created + Altera package (we have this in the building as well).https://www.infineon.com/cms/en/product/evaluation-boards/cyusb3kit-003/?utm_source=cypress&utm_medium=referral&utm_campaign=202110_globe_en_all_integration-dev_kitSome ideas to explore..

author: mc68000
author_rank: Contributor
timestamp: June 06, 2022, 10:51:10 pm
content: Here is the board with 2 different FPGA. Each can do Rx and Tx.https://www.gowinsemi.com/en/support/devkits_detail/36/