Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,843 Views

Sending data from Cyclone V FPGA to PC through USB Blaster

Hi All, 

I have a cyclone V Soc Development kit which has an on board USB blaster II comprising of MAX II and Cypress USB driver CY7C68013A. I would like to transmit data through the USB driver to the PC. I would like to know if there are any reference designs related to this application. Otherwise a guidance for the above application will be a lot helpful. Please provide info on the same. 

 

Thanks in advance, 

CG6991
0 Kudos
15 Replies
Altera_Forum
Honored Contributor I
174 Views

Try this wiki article for the USB-Blaster II 

 

http://alterawiki.com/wiki/on-board_usb-blaster_ii 

 

I do not have a board with a USB-Blaster II, so cannot comment on how well it works. 

 

I wrote a tutorial on how to use the USB-Blaster for communications, perhaps some aspects will be relevant 

 

http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial 

 

Cheers, 

Dave
Altera_Forum
Honored Contributor I
174 Views

Thanks Dave I intend to communicate through the dedicated USB lines in the MAX II and not the JTAG lines. Is there any code for configuring from the host(PC) in order to facilitate the USB data transmission from PC to FPGA and vice versa, by configuring the MAX II(USB BLaster II) or should the MAX II firmware be modified. 

 

Thanks, 

Gowtham
Altera_Forum
Honored Contributor I
174 Views

Read about the System Console USB Interface provided with USB Blaster II. It offers a fast parallel connection that can be used in concurrence with the Altera JTAG interface. 

 

You don't have the MAX II design files and won't be able to integrate the existing JTAG interface with a newly designed user USB interface. Does the Dev Kit provide a factory recovery file for MAX II? I guess, it doesn't.
Altera_Forum
Honored Contributor I
174 Views

You don't need to modify the MAX II firmware to use the USB direct interface. There are two ways to do it: 

 

The easy way is to instantiate an altera_usb_debug_master within your FPGA and connect its conduit interface to the pins which route to the USB direct pins on the USB-Blaster II MAX. Then use SystemConsole to read and write through this master. 

 

The difficult way is to take apart this component and use the altera_usb_debug_fifos component within it to terminate the interface. This gets you a raw avalon streaming FIFO in each direction that you can connect to your hardware. Use the appropriate host libraries (libusb on linux or winusb on windows) to locate and open the USB device - the second set of interfaces are used for communicating with the direct endpoint. Any data sent to the USB OUT interface will appear on the fifo's avst_src interface, data from the avst_sink interface will appear on the host's USB IN interface. USB Packet boundaries are ignored for out, for in there is a ~100 clock timeout before the MAX sends an incomplete packet to the host. 

 

I recommend getting the easy way working first even if you plan to use the difficult way later as it will get past the trivial but inevitable mistakes (pin assignments or clocks wrong etc).
Altera_Forum
Honored Contributor I
174 Views

 

--- Quote Start ---  

I intend to communicate through the dedicated USB lines in the MAX II and not the JTAG lines. Is there any code for configuring from the host(PC) in order to facilitate the USB data transmission from PC to FPGA and vice versa, by configuring the MAX II(USB BLaster II) or should the MAX II firmware be modified. 

 

--- Quote End ---  

 

I'd follow Wombat's advice on this one :) 

 

The USB-Blaster II is a weird beast; Altera have used a Cypress PHY that could have implemented both the JTAG interface and the parallel interface (FPGA4U do it that way, http://fpga4u.epfl.ch/wiki/fx2), there is no need for the MAX II. 

 

Good luck with your testing. Feel free to write up some notes and post them to the wiki to help others. 

 

Cheers, 

Dave
Altera_Forum
Honored Contributor I
174 Views

Thank you Wombat and Dave. I am going with the easy way suggested by Wombat for initial testing.

Altera_Forum
Honored Contributor I
174 Views

 

--- Quote Start ---  

You don't need to modify the MAX II firmware to use the USB direct interface. There are two ways to do it: 

 

The easy way is to instantiate an altera_usb_debug_master within your FPGA and connect its conduit interface to the pins which route to the USB direct pins on the USB-Blaster II MAX. Then use SystemConsole to read and write through this master. 

 

The difficult way is to take apart this component and use the altera_usb_debug_fifos component within it to terminate the interface. This gets you a raw avalon streaming FIFO in each direction that you can connect to your hardware. Use the appropriate host libraries (libusb on linux or winusb on windows) to locate and open the USB device - the second set of interfaces are used for communicating with the direct endpoint. Any data sent to the USB OUT interface will appear on the fifo's avst_src interface, data from the avst_sink interface will appear on the host's USB IN interface. USB Packet boundaries are ignored for out, for in there is a ~100 clock timeout before the MAX sends an incomplete packet to the host. 

 

I recommend getting the easy way working first even if you plan to use the difficult way later as it will get past the trivial but inevitable mistakes (pin assignments or clocks wrong etc). 

--- Quote End ---  

 

Hi i am a newbie to system console and been trying to get the commands for performing the read and write in the USB debug master component.
Altera_Forum
Honored Contributor I
174 Views

The command sequence below opens master number <id>, reads 16 bytes from it, writes them back and then closes it again. 

 

set master <id>] set handle set data master_write_memory $handle 0 $data close_service master $handle  

 

The master_read|write_memory commands are much faster than master_read|write_8|16|32 commands as the memory commands do the access as a whole block, the specified width commands do one or more accesses at the exact size specified which is much slower. You can use master_write_from_file if you have the data available in binary format in a local file.
Altera_Forum
Honored Contributor I
174 Views

 

--- Quote Start ---  

The command sequence below opens master number <id>, reads 16 bytes from it, writes them back and then closes it again. 

 

set master <id>] set handle set data master_write_memory $handle 0 $data close_service master $handle  

 

The master_read|write_memory commands are much faster than master_read|write_8|16|32 commands as the memory commands do the access as a whole block, the specified width commands do one or more accesses at the exact size specified which is much slower. You can use master_write_from_file if you have the data available in binary format in a local file. 

--- Quote End ---  

 

Thank you wombat but is there any tcl script in particular for executing these commands??
Altera_Forum
Honored Contributor I
174 Views

 

--- Quote Start ---  

Thank you wombat but is there any tcl script in particular for executing these commands?? 

--- Quote End ---  

 

 

I don't think I really understand your question.  

 

You should start SystemConsole from the Quartus GUI (or by typing system-console from the command line), the bottom right hand window is the script window into which you can type Tcl and see the results. If you save your script into a file then the Tcl source command can be used to execute it. 

 

Alternatively, you can right click on the /scripts node in the system explorer window, open the user scripts folder and then create a Tcl file in there. You can then run it by clicking on it.
Altera_Forum
Honored Contributor I
174 Views

 

--- Quote Start ---  

I don't think I really understand your question.  

 

You should start SystemConsole from the Quartus GUI (or by typing system-console from the command line), the bottom right hand window is the script window into which you can type Tcl and see the results. If you save your script into a file then the Tcl source command can be used to execute it. 

 

Alternatively, you can right click on the /scripts node in the system explorer window, open the user scripts folder and then create a Tcl file in there. You can then run it by clicking on it. 

--- Quote End ---  

 

Wombat I tried the command sequence in the bottom right script window but there was no response at all...
Altera_Forum
Honored Contributor I
174 Views

 

--- Quote Start ---  

Wombat I tried the command sequence in the bottom right script window but there was no response at all... 

--- Quote End ---  

 

 

What happens if you type "help" in that window? If that gets nothing then I think you have a problem with your install. You might try running it with no hardware attached to check your kernel drivers are not causing problems.
Altera_Forum
Honored Contributor I
174 Views

 

--- Quote Start ---  

What happens if you type "help" in that window? If that gets nothing then I think you have a problem with your install. You might try running it with no hardware attached to check your kernel drivers are not causing problems. 

--- Quote End ---  

 

Sorry for the late reply, I am able to get some commands on which i could get info form the help command. I observed an error with the USB connections on the messages section and when i tried the command you had suggested bad error index appears...
Altera_Forum
Honored Contributor I
174 Views

Hi wombat the commands are working am able to write and read data on the on chip ram also control the LEDs...

Altera_Forum
Honored Contributor I
174 Views

Hi wombat, Is there any provision in the system console for storing the data read from the on chip memory through system console into a file?? like .bin??

Reply