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: 
Visitor sfi
Visitor
309 Views
Registered: ‎03-05-2019

Can't get XADC working on Arty S7

Jump to solution

Hello,

I am trying to use the temperature sensor of the xadc with the cortex M1 on an Arty S7-50.

I started with the Cortex M1 Demo from the ARM DesignStart where I added the xadc_wiz IP to the block design in Vivado.

block_design_xadc.PNG

(not visible on this screen: the s_axi_aclk is connected to the same connection as the ones from the already existing axi_gpio blocks, the same with the s_axi_aresetn)

I am not sure if those output ports are really needed and how to use them properly.

Then after creating the .hdf for Xilinx SDK and from there the BSP, I used the sample µVision project to try out initializing the xadc by using the xsysmon.h header file. However it never gets past the XSysMon_CfgInitialize()-function.

The code I'm using:

print("Initializing Config\r\n");
XSysMon* Xadc; 
XSysMon_Config* xadc_cfg = XSysMon_LookupConfig(XPAR_SYSMON_0_DEVICE_ID);
XSysMon_CfgInitialize(Xadc, xadc_cfg, xadc_cfg->BaseAddress);
print("Config succeeded\r\n");

After a little further investigation I noticed that the program crashes any time it tries to access the memory assigned to the xadc (0x44A00000 to 0x44A0FFFF I would say from looking at the address editor/xparameters.h)

I am an absolute beginner in Vivado and fpga programming and I have trouble with a lot of this stuff, so maybe I'm missing something obvious.

Also please note that I'm not a native speaker so please excuse any mistakes I may have made writing this post.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Visitor sfi
Visitor
156 Views
Registered: ‎03-05-2019

Re: Can't get XADC working on Arty S7

Jump to solution

After successfully using the xadc in a MicroBlaze design to verify that it's working at all and looking into some documents of ARM for the Cortex M1 I found the solution to my problem.

I didn't know I have to regenerate the Memory Map Information file after adding the xadc_wiz IP to my block design. When generating the output files the software always used the provided example file where the xadc_wiz was not integrated and therefore no additional memory was "allocated" (not sure if this term is appropriate for this context).

However after Implementation I went to Open Implemented Design and used the commands 

cd V:/hardware/m1_for_arty_a7/m1_for_arty_a7
source ./make_mmi_file.tcl

in the Tcl Console.

source: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.100211_0001_00_en/sxz1526479558662.html

After taking this measure the configuration of the device was no problem and I was easily able to read the temperature from the sensor. I took some tweaks on my code for those interested:

#define XADC_DEV XPAR_XADC_WIZ_0_DEVICE_ID

    // init XADC
    XSysMon Xadc;
    XSysMon_Config* xadc_cfg = XSysMon_LookupConfig(XADC_DEV);
    Xadc.Config = *xadc_cfg;
    XSysMon_CfgInitialize(&Xadc, xadc_cfg, xadc_cfg->BaseAddress);
    print("init Config done\r\n");
    u16 temp;

    while ( 1 )
    {
	if(Xadc.IsReady) temp = XSysMon_GetAdcData(&Xadc, XSM_CH_TEMP);
	temp = (((temp >> 4) * 503.975) / 4096) - 273.15;
	xil_printf("temperature data: %d\r\n", temp);
    }

I wasn't aware of this because the guides I followed didn't cover the addition of new IPs to the Cortex M1 Example Design and so this step wasn't explained.

Anyway I'm still thankful for the provided help.

5 Replies
Community Manager
Community Manager
244 Views
Registered: ‎08-08-2007

Re: Can't get XADC working on Arty S7

Jump to solution

Hi @sfi 

 

Within the SDK install there are example provided for the different IP. I would suggest trying on of the SDK examples first, if that works you can customise it to suit your usecase. 

 

For example if you use the xsysmon_low_level_example.c it calls the XADC using the BASEADDR, that will help figure out if it can access the XADC memory space. 

	/*
	 * Run the SysMonitor Low level example, specify the Base Address that
	 * is generated in xparameters.h.
	 */
	Status = SysMonLowLevelExample(SYSMON_BASEADDR);
	if (Status != XST_SUCCESS) {
		xil_printf("Sysmon lowlevel Example Failed\r\n");
		return XST_FAILURE;
	}
	xil_printf("Successfully ran Sysmon lowlevel Example\r\n");
	return XST_SUCCESS;
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Visitor sfi
Visitor
225 Views
Registered: ‎03-05-2019

Re: Can't get XADC working on Arty S7

Jump to solution

Thank you for your reply.

I used the code from the example you named and ran it within my project. However I ran into the exact same problem.

The code runs until the line

XSysMon_WriteReg(BaseAddress, XSM_SRR_OFFSET, XSM_SRR_IPRST_MASK);

from the SysMonLowLevelExample(u32 BaseAddress) is executed. Just as in my own approach the problem occurs as soon as the assigned memory is accessed.

I'm quite certain that my problem is within the Vivado design. It seems like I'm missing some steps in the process of adding an IP. What else has to be done other than adding the Xadc Wizard and the needed connections?

0 Kudos
Community Manager
Community Manager
214 Views
Registered: ‎08-08-2007

Re: Can't get XADC working on Arty S7

Jump to solution

Hi @sfi 

 

When you add the XADC to the Block Design and the look at the Address Editor AddressEditor.PNG

 

Then when you are in SDK, does the HDF match the same addresses HSF.PNG

 

In a xsct console if you try to read from that address space, does it work? 

eg : mrd a0002000

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Visitor sfi
Visitor
203 Views
Registered: ‎03-05-2019

Re: Can't get XADC working on Arty S7

Jump to solution

Thank you for your reply.

Here's my address editor in Vivado:

address_editor.png

Here's my address map from the hdf in Xilinx SDK which shows the same addresses:

address_map.png

When I try to access the memory via xsct console:

targets
  1* xc7s50
xsct% connect
tcfchan#1
xsct% mrd 0x44a00000
xsct% Context does not support memory read. Unsupported command

Not sure about the usage of the xsct console though. I didn't know about this before.

I should mention that when running from code I am able to access other memory addresses without any problem. It's only in the range of the xadc_wiz where the software seems to get stuck.

0 Kudos
Highlighted
Visitor sfi
Visitor
157 Views
Registered: ‎03-05-2019

Re: Can't get XADC working on Arty S7

Jump to solution

After successfully using the xadc in a MicroBlaze design to verify that it's working at all and looking into some documents of ARM for the Cortex M1 I found the solution to my problem.

I didn't know I have to regenerate the Memory Map Information file after adding the xadc_wiz IP to my block design. When generating the output files the software always used the provided example file where the xadc_wiz was not integrated and therefore no additional memory was "allocated" (not sure if this term is appropriate for this context).

However after Implementation I went to Open Implemented Design and used the commands 

cd V:/hardware/m1_for_arty_a7/m1_for_arty_a7
source ./make_mmi_file.tcl

in the Tcl Console.

source: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.100211_0001_00_en/sxz1526479558662.html

After taking this measure the configuration of the device was no problem and I was easily able to read the temperature from the sensor. I took some tweaks on my code for those interested:

#define XADC_DEV XPAR_XADC_WIZ_0_DEVICE_ID

    // init XADC
    XSysMon Xadc;
    XSysMon_Config* xadc_cfg = XSysMon_LookupConfig(XADC_DEV);
    Xadc.Config = *xadc_cfg;
    XSysMon_CfgInitialize(&Xadc, xadc_cfg, xadc_cfg->BaseAddress);
    print("init Config done\r\n");
    u16 temp;

    while ( 1 )
    {
	if(Xadc.IsReady) temp = XSysMon_GetAdcData(&Xadc, XSM_CH_TEMP);
	temp = (((temp >> 4) * 503.975) / 4096) - 273.15;
	xil_printf("temperature data: %d\r\n", temp);
    }

I wasn't aware of this because the guides I followed didn't cover the addition of new IPs to the Cortex M1 Example Design and so this step wasn't explained.

Anyway I'm still thankful for the provided help.