Forum Discussion
Altera_Forum
Honored Contributor
13 years agoget value from master_read_32
Hello evryone,
I am trying to do a GUI interface with tcl to load the .sof that I generated into the FPGA with tcl. I want also in this tcl script read from a memory adress, get a value and put it into a label in the GUI interface. I am using master_read_32 command to do this: # set m_path [lindex [get_service_paths master] 0] # open_service master $m_path # master_read_32 $m_path 0x00000000 1 to read the 32 bit value. My question is how can I save this value to put it into the label in the GUI interface!? I am waiting for some help please. Thanks a lot.23 Replies
- Altera_Forum
Honored Contributor
Look at the Tcl client GUI example in this tutorial
http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial Cheers, Dave - Altera_Forum
Honored Contributor
Hello Dave,
that tutorial has nothing about how to save the master_read_32 <adress> to a variable to present that value saved into a label in GUI interface! Do you know how to do it? Kind regards, - Altera_Forum
Honored Contributor
--- Quote Start --- that tutorial has nothing about how to save the master_read_32 <adress> to a variable to present that value saved into a label in GUI interface! Do you know how to do it? --- Quote End --- As I commented, the Tcl code for the client GUI has everything you need. The code for the GUI shows how to control the content of a label or hex entry box by mapping that entry to a text variable, eg., here's the code for the response for a read
and for the corresponding read command# A hex entry box with the default data set jtag(data) 0 entry $win.f1.e2 -textvariable jtag(data) -width 12 -justify right -relief sunken -validate key -validatecommand {validate_isxdigit %d %P}
Every time read is called, it updates jtag(data), which in turn updates the GUI. Then if you look at jtag_read on the server in jtag_read_cmds.tcl, you will see# Pressing the read/write buttons will automatically connect # to the client if needed. The trace on jtag(socket) will # cause the connection status GUI elements to update # proc read_button {} { global jtag # The address and data entry boxes contain only digits, # so add the leading 0x to the address set data # and then strip the response 0x set jtag(data) }
which uses master_read_32 to implement the read procedure. You can lump all of this into a single Tcl procedure if you want. Cheers, Dave# Read 32-bits puts "SERVER: jtag_read $addr" if {} { if {} { # JTAG connection lost? jtag_close error "Error: Check the JTAG interface\n -> '$result'" } } else { if {} { # JTAG connection lost? jtag_close error "Error: Check the JTAG interface\n -> '$result'" } } return $result - Altera_Forum
Honored Contributor
Hello Dave,
thanks for answering so quick. I have a question: I have one Qsys with a component that I did and JTAG to Avalon Master Brige into the Qsys, connected. I did some tests to read a value with the avalon_master and I use this in Qsys console: # set m_path [lindex [get_service_paths master] 0] # open_service master $m_path # master_read_32 $m_path 0x00000000 1 # close_service master $m_path and with this I get the 32 bits value on the adress 0x00000000. When you write on your code JTAG it works with JTAG to Avalon Master Bridge or I need to change to other one in Qsys? King regards - Altera_Forum
Honored Contributor
--- Quote Start --- When you write on your code JTAG it works with JTAG to Avalon Master Bridge or I need to change to other one in Qsys? --- Quote End --- You can answer this question yourself very easily by just looking at the tutorial ... which part of the block diagram on the main page of the tutorial is not clear? http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial Cheers, Dave - Altera_Forum
Honored Contributor
Hey Dave,
Ok, I can use any of the 3 ways to get the value. I am just asking if I write down the code that u gave, that work for these 3? To run the script, I just need to build a GUI and do the Tcl procedure including the 3 codes that you gave me? Kind regards - Altera_Forum
Honored Contributor
--- Quote Start --- Ok, I can use any of the 3 ways to get the value. I am just asking if I write down the code that u gave, that work for these 3? To run the script, I just need to build a GUI and do the Tcl procedure including the 3 codes that you gave me? --- Quote End --- Yes, if you build a Qsys system that contains a single JTAG-to-Avalon-MM master, then you should be able to use the Tcl scripts included with the tutorial directly. If it does not work, then look at the jtag_open command in the server Tcl code to see that the sequence works for your implementation (you can manually enter those commands in System Console to check). Cheers, Dave - Altera_Forum
Honored Contributor
Thanks a lot for your help Dave. I will check those commands in System Console.
When you say System Console , is the console that we open in Qsys tool menu right? Cheers - Altera_Forum
Honored Contributor
--- Quote Start --- Thanks a lot for your help Dave. I will check those commands in System Console. When you say System Console , is the console that we open in Qsys tool menu right? --- Quote End --- Yes. You can also start it by opening a "NIOS II IDE Shell" (a cygwin console) and typing system-console. Cheers, Dave - Altera_Forum
Honored Contributor
Hello Dave,
The tutorial works with any board or just that one that you put in your tutorial? I have a DE0-nano. Kind regards