Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16557 Discussions

Generating files from FPGA to hard drive

Altera_Forum
Honored Contributor II
1,549 Views

Hi guys. I'm working on a VHDL project for university and I'd like to know how could I generate a file from FPGA to the hard drive of the computer through the USB cable. I mean, it seems to me that it's theoretically possible but I'm really having trouble finding material about it. 

 

The FPGA is a Cyclone II ep2c35f672c6. 

 

I would really appreciate any help.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
559 Views

Might be easier to create a PC program that requests data from the FPGA via USB, and then writes that data into a file. 

 

All you would have to do is create some kind of C (or other language) program that reads data from the USB port. The FPGA can have NIOS sending a packet of data through the UART module. You can get fancy and define a communication protocol - start packet, CRC, etc., to make sure that the data you are sending and receiving is valid.
0 Kudos
Altera_Forum
Honored Contributor II
559 Views

If your main goal is moving data and not learning USB, then I wouldn't recommend using USB to implement this. USB is such a complex topic you would be much better off using SPI or I2C to send data to a microcontroller (for example a 3.3 volt Arduino board like the Due). 

 

Yes, all USB communications need to be initiated by the host (the PC in this example). If you want to use an FPGA alone without an SoC or accompanying microcontroller, you will want to implement USB in device mode. You will need a board with a USB OTG or device mode socket. There are some examples for Terasic boards where the board is emulating a keyboard or mouse. 

 

Another alternative is to use a USB hard drive. In this case, the FPGA board is operating in host mode which is much more complex and isn't practical without a processor. You could use an SoC board or implement a NIOS embedded processor. There are also examples for this for some of the Terasic boards.
0 Kudos
Altera_Forum
Honored Contributor II
559 Views

All you need to do is implement a UART core - its a qsys module - 2 wires (RX and TX), fixed baud rate. 

To interface with USB, buy a UART to USB converter - it cost $5 or less. 

 

Then use the NIOS on any FPGA to write data to your UART module, it will send that data to the TX pin serially, and the UART to USB converter will deliver it to the PC. 

 

Sending data to the PC from the FPGA is a fairly simple task
0 Kudos
Reply