UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
1,212 Views
Registered: ‎08-04-2018

Data logging

Jump to solution

Hi everyone,

 

So I am reading the data from the XADC and want to transport the data to a log file (for example: .txt or .csv). Can anyone say how to do it? is there a way actually? I am using VHDL for the fpga development so far.

any help is appreciated. 

 

Thanks in advance.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
897 Views
Registered: ‎02-09-2017

Re: Data logging

Jump to solution

Hi @benaka,

 

For viewing live internal signals such as the one you described, I'd suggest using the VIO and ILA IPs.

 

https://www.xilinx.com/products/intellectual-property/vio.html

 

https://www.xilinx.com/products/intellectual-property/ila.html

 

The document Vivado Design Suite Tutorial Programming and Debugging - UG936, Lab 3 and Lab 5, have an example of using such IPs for signal visualization and debugging.

 

Thanks.

Andre Guerrero

Product Applications Engineer

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
9 Replies
Scholar dpaul24
Scholar
1,203 Views
Registered: ‎08-07-2014

Re: Data logging

Jump to solution

@benaka,

 

In my opinion the simplest way would be to get an UART core inside the FPGA to transfer your digitized data to the PC. After that getting them saved in a text file is easy.

--------------------------------------------------------------------------------------------------------
FPGA enthusiast!
All PMs will be ignored
--------------------------------------------------------------------------------------------------------
1,200 Views
Registered: ‎06-21-2017

Re: Data logging

Jump to solution

@benaka

 

@dpaul24is right.  The UART is an easy and flexible way to export your data to a file.  One other way is to capture the data in an ILA and export the ILA data.  You will be limited by the depth of the ILA, but this is also a fairly easy method.

Moderator
Moderator
1,184 Views
Registered: ‎02-09-2017

Re: Data logging

Jump to solution

Hi @benaka,

 

You can print on the TCL console (and also print it into a txt file) the results from the XADC by using the command:

 

get_property ATTRIBUTE [get_hw_sysmons]

The attribute is the name of the parameter you want to see the current value, for example:

 

get_property VCCAUX [get_hw_sysmons]

To get the name of all the available XADC parameters, use the command:

 

report_property [get_hw_sysmons]

 

To make it behave more like a data logger, you'd need to make a script with a for loop that gets executed every X seconds (or ms) , and inside you can use a clock command to print the current system time, and then print the values of the parameters you need.

 

One example would be the script below. For 10 seconds, it will print the current time and the VCCINT current reading.

 

proc write_xadc {i} {
	set systemTime [clock seconds]
	puts -nonewline [clock format $systemTime -format %H:%M:%S]
    puts "  $i"
    flush stdout
}

proc do {end_time} {
    set end 0
    while {$end < $end_time} {
        after 1000
		write_xadc [get_property VCCINT[get_hw_sysmons]]
        incr end
    }
}

do 10

Hopefully you can modify it for the application you need.

 

Thanks.

 

Andre Guerrero

Product Applications Engineer

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
Adventurer
Adventurer
1,167 Views
Registered: ‎08-04-2018

Re: Data logging

Jump to solution

HI @dpaul24,

 

I am using the DRP interface for the XADC. Now Is it still possible to use the AXI bus?

0 Kudos
Adventurer
Adventurer
1,164 Views
Registered: ‎08-04-2018

Re: Data logging

Jump to solution

Hi @anunesgu

 

You explained well and seems more apt solution for my task, but are there any examples for reference. Vivado is new to me and TCL console is further new, may be a example will help me understand better. 

 

Thanks for understanding.

0 Kudos
Scholar dpaul24
Scholar
1,150 Views
Registered: ‎08-07-2014

Re: Data logging

Jump to solution

@benaka,

 

Now Is it still possible to use the AXI bus?

No it has no AXI, it is only having native interface.

https://www.xilinx.com/support/documentation/user_guides/ug480_7Series_XADC.pdf

 

btw - Why do you want to use an AXI bus?

 

You can easily find a free UART core having a non-AXI i/f and drive it after writing a bit of your own interfacing logic, a small state-machine or something like that.

 

--------------------------------------------------------------------------------------------------------
FPGA enthusiast!
All PMs will be ignored
--------------------------------------------------------------------------------------------------------
0 Kudos
Moderator
Moderator
1,121 Views
Registered: ‎02-09-2017

Re: Data logging

Jump to solution

Hi @benaka,

 

So, to view the info from the XADC, you have to be in the HW Manager, looking at something like this:

 

XADC_Console.jpg

 

If you look at the bottom of the screen, you will see the TCL console. You can actually see that some commands have been run already (anything you do on the GUI gets converted into a TCL command).

 

So, from the TCL console, you can run Vivado specific commands. One set of commands are related to reading data from the XADC (such as the get_property VCCINT [get_hw_sysmons] that I mentioned on my prvious message).

 

So I made the attached script called XADC_logger.tcl.

 

If you open this file, you will see there is a process (or function) declaration, as below:

 

 

proc write_xadc {end_time} {
	#Set here the directory and file name
	set filename C:/Users/anunesgu/Desktop/XADC_dump.csv
	set fileId [open $filename "w"]
    
	set end 0
    while {$end < $end_time} {
        #the number 1000 indicates the loop will be run every second (1000 ms).
		#If you need a higher or lower frequency, adjust it.
		after 1000
		
		set systemTime [clock seconds]
		puts -nonewline $fileId [clock format $systemTime -format %H:%M:%S]
		puts -nonewline $fileId ","

		#this is the XADC properties that you want to have printed.
		#Add as many as you need.
		puts -nonewline $fileId [get_property VCCINT [get_hw_sysmons]]
		puts -nonewline $fileId ","
		puts -nonewline $fileId [get_property TEMPERATURE [get_hw_sysmons]]
		puts $fileId " "
		flush stdout
        incr end
    }
	close $fileId
}

 

You will have to change a few things it it, such as:

- Right on the top of the script, there;s a line declaring the filename. Change that to the location and file name you desire.

- The frequency that you want to log the data (every 10ms, every 1s, every minute, etc.) by changing the parameter after 1000.

- The name of the XADC parameter that you want to use (on this script, I added VCCINT and TEMPERATURE. You can add as many as you want)

 

You can save it somewhere in your computer, and once you're done edditing it, from the TCL console you can enable it using the following command:

 

source c:/Users/anunesgu/Documents/XADC_logger.tcl

Off course, change the path above to the one where you saved the file.

 

Now that Vivado session has a new command called write_xadc

 

So now from the TCL console, you can call that function by typing write_xadc 10 (the number 10 can be changed to whatever number, it's the number of seconds you want to run the scripts).

 

You will see a screen like this:

 

XADC_running_script.jpg

 

Once the processing popup goes away, you can open the file that was created with notepad or Excel. It will have something like this:

 

13:47:53	1.004	31.4
13:47:54	1.005	31.4
13:47:55	1.003	31.5
13:47:56	1.006	31.6
13:47:57	1.006	31.7
13:47:58	1.006	31.6
13:47:59	1.004	31.5
13:48:00	1.006	31.5
13:48:01	1.003	31.5
13:48:02	1.006	31.6
13:48:03	1.003	31.7
13:48:04	1.006	31.6
13:48:05	1.004	31.7
13:48:06	1.006	31.3
13:48:07	1.005	31.7
13:48:08	1.006	31.6
13:48:09	1.006	31.4
13:48:10	1.006	31.5
13:48:11	1.006	31.6
13:48:12	1.005	31.7

Observe it is the a log of the VCCINT and TEMPERATURE every second for 20 seconds.

 

I believe from here you will be able to easily modify this script and get what you need to do.

 

I suggest you first run it as is, without modifying anything and learn how it works.

 

Thanks!

Andre Guerrero

Product Applications Engineer

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
Adventurer
Adventurer
1,078 Views
Registered: ‎08-04-2018

Re: Data logging

Jump to solution

Hi @anunesgu , Thank you for the example. I will run as it is first as you mentioned and know more about it. also , I have another question, is it possible fir the processing to be seen live ?

For example I have this code which will get converted data from the address '0000011'(Vp_n_addr) when end_f_conversion of the XADC goes high.  and extract the actual data when DRDY signal goes high. So now I have store the data in 

decode_sig <= master_volt;

 

ports..

 

archi...

 

signals

constants

 

read_xadc: process(clk)
begin
if rising_edge(clk) then
--read converted data when high at 'eoc' pin, with enabling drp and address;
if i_eoc = '1' then
o_den <= '1';
o_daddr <= vp_n_addr;
end if;
-- read the actual output data;
if i_drdy <= '1' then
master_volt <= in_do;
end if;
end if;
end process;

decode_sig <= master_volt;

end Behav;

 

 

so now i have to see the data decode_sig at every certain interval live on a console are there any options or input you can provide? 

 

Thanks in advance.

0 Kudos
Moderator
Moderator
898 Views
Registered: ‎02-09-2017

Re: Data logging

Jump to solution

Hi @benaka,

 

For viewing live internal signals such as the one you described, I'd suggest using the VIO and ILA IPs.

 

https://www.xilinx.com/products/intellectual-property/vio.html

 

https://www.xilinx.com/products/intellectual-property/ila.html

 

The document Vivado Design Suite Tutorial Programming and Debugging - UG936, Lab 3 and Lab 5, have an example of using such IPs for signal visualization and debugging.

 

Thanks.

Andre Guerrero

Product Applications Engineer

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------