element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet & Tria Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Avnet Boards General XADC reference design
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 1 reply
  • Subscribers 365 subscribers
  • Views 719 views
  • Users 0 members are here
Related

XADC reference design

martingaraj
martingaraj over 10 years ago

There are numerous topics about the mysterious XADC, but none of them is working up to date.

My Set-up:
   Windows 7
   ZedBoard Rev D, running PetaLinux v2013.10
   Vivado 2015.4 (with provided SDK)

I have tried http://zynqhowto.blogspot.kr/ , but the lab 3 differes in cpp source file, I dont have "xsysmon.h" (was there any change with previous versions of Vivado ?). Also the PL design requires Reset Block (the design provided in Lab 3 cannot be otherwise validated).

Is there a simple TUTORIAL / REFERENCE PROJECT that shows how XADC samples external signal ?

----------------------------------------------------------
What I have done so far

According to Lab 3 tutorial

1) Design block diagram using:
     processing_system7_0
     axi_interconnect_0
     rst_processing_system7_0_100M
     xadc_wiz_0
     adding the ports according to Lab 3 (vn_in, vp_in, ...)

   - enabling Timer 0 in Zynq, setting Xadc according to tutorial Lab 3, runnig connection automation

2) constraints
 
#set_property PACKAGE_PIN E16 [get_ports vauxn0]
set_property IOSTANDARD LVCMOS33 [get_ports vauxn0]

#set_property PACKAGE_PIN E16 [get_ports vauxp0]
set_property IOSTANDARD LVCMOS33 [get_ports vauxp0]

#set_property PACKAGE_PIN D17 [get_ports vauxn8]
set_property IOSTANDARD LVCMOS33 [get_ports vauxn8]

#set_property PACKAGE_PIN D16 [get_ports vauxp8]
set_property IOSTANDARD LVCMOS33 [get_ports vauxp8]

#set_property PACKAGE_PIN M12 [get_ports vn_in]
set_property IOSTANDARD LVCMOS33 [get_ports vn_in]

#set_property PACKAGE_PIN ML11 [get_ports vn_in]
set_property IOSTANDARD LVCMOS33 [get_ports vp_in]

3) SDK
     a) using Lab 3 source code - missing "xsysmon.h"
     b) importing XADC Example from documentation - and adding a loop with usleep()

#include <stdio.h>
#include <unistd.h>

#include "xparameters.h"
#include "xadcps.h"
#include "xstatus.h"
#include "stdio.h"

#define XADC_DEVICE_ID ttXPAR_XADCPS_0_DEVICE_ID

#define printf xil_printf /* Small foot-print printf function */
static int XAdcPolledPrintfExample(u16 XAdcDeviceId);
static int XAdcFractionToInt(float FloatNum);

static XAdcPs XAdcInst;      /* XADC driver instance */

int main(void)
{

tint Status;
tint loop = 0;

t/*
t * Run the polled example, specify the Device ID that is
t * generated in xparameters.h.
t */

twhile(loop < 50){
ttStatus = XAdcPolledPrintfExample(XADC_DEVICE_ID);
ttif (Status != XST_SUCCESS) {
tttreturn XST_FAILURE;
tt}
ttloop++;
ttprintf("loop: %d", loop);
ttusleep(500000); //wait 500ms
t}
treturn XST_SUCCESS;
}

int XAdcPolledPrintfExample(u16 XAdcDeviceId)
{
tint Status;
tXAdcPs_Config *ConfigPtr;
tu32 TempRawData;
tu32 VccPintRawData;
tu32 VccPauxRawData;
tu32 VccPdroRawData;
tfloat TempData;
tfloat VccPintData;
tfloat VccPauxData;
tfloat MaxData;
tfloat MinData;
tXAdcPs *XAdcInstPtr = &XAdcInst;

tprintf("r
MEASUREMENT r
");

t/*
t * Initialize the XAdc driver.
t */
tConfigPtr = XAdcPs_LookupConfig(XAdcDeviceId);
tif (ConfigPtr == NULL) {
ttprintf("r
FAILURE 01 r
");
ttreturn XST_FAILURE;
t}
tXAdcPs_CfgInitialize(XAdcInstPtr, ConfigPtr,
ttttConfigPtr->BaseAddress);

t/*
t * Self Test the XADC/ADC device
t */
tStatus = XAdcPs_SelfTest(XAdcInstPtr);
tif (Status != XST_SUCCESS) {
ttprintf("r
FAILURE 02 r
");
ttreturn XST_FAILURE;
t}

tVccPintRawData = XAdcPs_GetAdcData(XAdcInstPtr, XADCPS_CH_VPVN);
tVccPintData = XAdcPs_RawToVoltage(VccPintRawData);
tprintf("r
The Current VCCPINT is %0d.%03d Volts. r
",
ttt(int)(VccPintData), XAdcFractionToInt(VccPintData));

tVccPauxRawData = XAdcPs_GetAdcData(XAdcInstPtr, XADCPS_CH_VCCPAUX);
tVccPauxData = XAdcPs_RawToVoltage(VccPauxRawData);
tprintf("r
The Current VCCPAUX is %0d.%03d Volts. r
",
ttt(int)(VccPauxData), XAdcFractionToInt(VccPauxData));

treturn XST_SUCCESS;
}


int XAdcFractionToInt(float FloatNum)
{
tfloat Temp;

tTemp = FloatNum;
tif (FloatNum < 0) {
ttTemp = -(FloatNum);
t}

treturn( ((int)((Temp -(float)((int)Temp)) * (1000.0f))));
}


Outcome

I cant read external pins, the displayed values are still the same, even though I have grounded the pins vp_in, vn_in, vaux0, vaoux8 on the XADC header

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    0 Former Member over 10 years ago

    Hello Martin,

     

    You might want to take a look at Adam Taylor's MicroZed Chronicles blog:

    http://zedboard.org/content/microzed-chronicles

     

    He has several posts on using the XADC:

     

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Getting-the-XADC-Running-on-the-MicroZed-Adam-Taylor-s-MicroZed/ba-p/380989

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/MicroZed-XADC-Software-Adam-Taylor-s-MicroZed-Chronicles-Part-8/ba-p/383861

    and

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-104-XADC-with-Real-World/ba-p/659668

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-105-Interrupt-Latency/ba-p/661857

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-106-Interrupt-Latency/ba-p/663250

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-107-Combining-XADC-and/ba-p/664734

     

    -Gary

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 10 years ago

    Hello Martin,

     

    You might want to take a look at Adam Taylor's MicroZed Chronicles blog:

    http://zedboard.org/content/microzed-chronicles

     

    He has several posts on using the XADC:

     

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Getting-the-XADC-Running-on-the-MicroZed-Adam-Taylor-s-MicroZed/ba-p/380989

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/MicroZed-XADC-Software-Adam-Taylor-s-MicroZed-Chronicles-Part-8/ba-p/383861

    and

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-104-XADC-with-Real-World/ba-p/659668

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-105-Interrupt-Latency/ba-p/661857

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-106-Interrupt-Latency/ba-p/663250

    https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-107-Combining-XADC-and/ba-p/664734

     

    -Gary

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube