Forum Discussion
Altera_Forum
Honored Contributor
12 years agoDe2-115 windows application to control Cyclone chip
Hi,
I bought Altera board (development) DE2-115 In the example CD - there is a very nice PC application with UI - when pressing buttons-> altera board light leds, show LCD when you write in PC etc. I would like to develop myself FORM (C sharp or visual C) that will control my board (at first light leds by the button I am pressing for example) Unfortunately there are no any sources, furthermore I contact terasic (board manufacture) and they don't give any code or sources. After some searches I have found that Altera board uses USB chip of Cypress which uses FTDI driver. So now I know I need: 1. write PC code - that uses FTDI DLL to transfer data to board. 2. The FTDI DLL 3. Altera code to identify commands Now the only example is with Verilog, and NIOS II - SOCP, and Eclipse. But I would like to read the chip JTAG inputs with some VHDL code Is any one familiar how to start doing this, or have any example (VHDL is preferred)? Any help will help Thanks, Roee25 Replies
- Altera_Forum
Honored Contributor
The official (and documented) way to do this is to use system console. Using SOPC builder or QSys you can create an FPGA system with a JTAG to Avalon master (you don't need a Nios CPU to do that) and in system console you can create a GUI to control your board. System console uses TCL though, and not C# or C++.
- Altera_Forum
Honored Contributor
Thank you,
Can I do this without SOCP builder? - do I have any interuction with the JTAG (internal Jtag of altera)?, Also I would like to do so with VHDL, is this possible without SOCP builder? Does any one have any source file (VHDL) eaxmple that I can use for this? Also if I use UART command, isn't it possible to transfer data to DLL (I guess FTDI DLL) through Visual C or C sharp? Thanks, Roee - Altera_Forum
Honored Contributor
Everything is possible, but using JTAG directly isn't documented so you are on your own and must reverse engineer a lot. I really think learning to use SOPC Builder / QSys and system console would me a more productive use of your time ;)
You can find a tutorial here: http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial (thanks Dave for reminding me about this tutorial in another thread!) For very simple tests (LEDs, buttons) you just need to use PIO components. For more complex interfaces or modules, you can write your own VHDL code and integrate it as a custom component in your SOPC design. - Altera_Forum
Honored Contributor
--- Quote Start --- Everything is possible, but using JTAG directly isn't documented so you are on your own and must reverse engineer a lot. --- Quote End --- Altera has documented their SLD Virtual JTAG component; http://www.altera.com/literature/ug/ug_virtualjtag.pdf‎ and I have documented how to use it in detail here: http://www.ovro.caltech.edu/~dwh/correlator/pdf/vjtag.pdf --- Quote Start --- I really think learning to use SOPC Builder / QSys and system console would me a more productive use of your time ;) --- Quote End --- I agree. The protocol used by the Avalon-MM bridge is documented here: http://www.ovro.caltech.edu/~dwh/correlator/pdf/altera_jtag_to_avalon_analysis.pdf http://www.ovro.caltech.edu/~dwh/correlator/pdf/altera_jtag_to_avalon_analysis.zip You can use that information along with the USB-Blaster protocol http://sourceforge.net/apps/mediawiki/urjtag/index.php?title=cable_altera_usb-blaster To access the FTDI device directly and send JTAG-to-Avalon-MM bytes directly. However, you can also do the same thing using Tcl scripts. --- Quote Start --- You can find a tutorial here: http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial (thanks Dave for reminding me about this tutorial in another thread!) --- Quote End --- This is also a good reference :) --- Quote Start --- For very simple tests (LEDs, buttons) you just need to use PIO components. For more complex interfaces or modules, you can write your own VHDL code and integrate it as a custom component in your SOPC design. --- Quote End --- Start with the Qsys tutorial and use System Console. Use the Tcl server that comes with that code and access it via C# or whatever language you like. Cheers, Dave - Altera_Forum
Honored Contributor
Hi Guys,
Something I misunderstand, If I am using JTAG debugger (in Programmer), I can move bits to JTAG and make CLOCKS and see TDO as I expect, But when I see TDO=1 => I don't see my green led on board lighting? why is that am I missing something? Attached my design Thanks, Roee - Altera_Forum
Honored Contributor
--- Quote Start --- Something I misunderstand, If I am using JTAG debugger (in Programmer), I can move bits to JTAG and make CLOCKS and see TDO as I expect, But when I see TDO=1 => I don't see my green led on board lighting? why is that am I missing something? --- Quote End --- It does not work because you have not read any of the documentation and understood how the JTAG component works. The TDO from the SLD_Virtual_JTAG component is *NOT* the same as the external pin. There is multiplexing logic in the SLD_Virtual_JTAG component. You need to issue JTAG commands to select your component first. The vjtag.pdf document contains example Tcl code and SignalTap II logic analyzer traces. Add a SignalTap II instance to your design and you will see that TDO will not change until you issue the correct commands. Cheers, Dave - Altera_Forum
Honored Contributor
Hi Dave
I have read part of it :) I see there is an instruction set, and seen your example I did do same module as you (I guess this is 6 instructions ?) - of 3 bits I didn't understand yet how to define them Also didn't actually succeed to load the TCL tools to read and write to JTAG, Can you refer me to tools that will work on windows 8 machine? Do I need to install TCL environment to run the TCL tools? keep trying (probably will take me few days) ... Thanks, Roee - Altera_Forum
Honored Contributor
--- Quote Start --- I have read part of it :) --- Quote End --- There is a lot of information in the references I provided. You will have to read all of it, several times. --- Quote Start --- Also didn't actually succeed to load the TCL tools to read and write to JTAG, Can you refer me to tools that will work on windows 8 machine? Do I need to install TCL environment to run the TCL tools? --- Quote End --- The documentation tells you everything you need to know. The quartus_stp and SystemConsole tools must be used to accessing JTAG directly - a general Tcl tool does not have support for Altera JTAG access. Cheers, Dave - Altera_Forum
Honored Contributor
Hi Dave,
While reading your PDF, I have more question: When you write: "The Virtual instruction register bus from the Virtual JTAG component was connected to GPIO bits and to the LEDs (so that Tcl commands can change the LED state)." This means that I have manually to connect the Virtual Jtag myself to LEDS ? I guess you mean ir_out[2..0] ? So I should connect it manually myself? Also I did not understand how to change Directions - meaning the TDI generally is output of Altera, and just in JTAG mode turns to input? so how should I turn it to input? Also in the timing diagram you mark TDI-ERROR (what would you expect there?) When it is in JTAG mode - by TCL commands, this block get automatically clocks and data? (so I don't have to take care about toggling these pins correct?) So if I have connected my leds correct and gave TCL commands I should see the leds lighting by my input to ir_in[2..0]? When I connect in my block the ir_out[2..0] to LEDS on board I get an error "missing source signal" like this is input why? how can I overcome this problem? Thanks for your help, When my blocks are ready I will share them to all here Thanks, Roee - Altera_Forum
Honored Contributor
--- Quote Start --- While reading your PDF, I have more question: When you write: "The Virtual instruction register bus from the Virtual JTAG component was connected to GPIO bits and to the LEDs (so that Tcl commands can change the LED state)." This means that I have manually to connect the Virtual Jtag myself to LEDS ? I guess you mean ir_out[2..0] ? --- Quote End --- Yeah. Instantiate an SLD_Virtual_JTAG component and a SignalTap II instance. Probe the ir_out[] bus and you'll see that it captures your custom instruction LSBs. --- Quote Start --- Also I did not understand how to change Directions - meaning the TDI generally is output of Altera, and just in JTAG mode turns to input? so how should I turn it to input? Also in the timing diagram you mark TDI-ERROR (what would you expect there?) When it is in JTAG mode - by TCL commands, this block get automatically clocks and data? (so I don't have to take care about toggling these pins correct?) So if I have connected my leds correct and gave TCL commands I should see the leds lighting by my input to ir_in[2..0]? Thanks for your help, When my blocks are ready I will share them to all here --- Quote End --- I'll dig up my example code and post it. It'll be much easier for you to use a working example. Cheers, Dave