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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
FPGA
  • Technologies
  • More
FPGA
Blog 7 Ways to Leave Your Spartan-6 Challenge - experiment with XADC
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
FPGA requires membership for participation - click to join
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ralphjy
  • Date Created: 2 Aug 2022 12:39 AM Date Created
  • Views 913 views
  • Likes 9 likes
  • Comments 0 comments
  • arty-s7
  • 7 Ways to Leave Your Spartan-6
  • sysmon
  • spartan-7
  • xilinx fpga
  • Spartan_Migration
  • xadc
Related
Recommended

7 Ways to Leave Your Spartan-6 Challenge - experiment with XADC

ralphjy
ralphjy
2 Aug 2022

This week has been a very challenging one to be sure...

I ended last week with a problem with the primary external hard drive that contains the Ubuntu Virtual Machines that I use for Xilinx development tools.  I was intermittently getting files missing or corrupted.  Extremely frustrating, but I managed to move my project setup to a new drive.  I also encountered a strange problem when I incorporated the PmodBLE into my project.  It took me a while to figure out that none of the other 3 Pmods (PmodNav, PmodOLED, or PModOLEDrgb) would function when I included the PmodBLE in the hardware platform I exported from Vivado.  The 3 Pmods would all work together, but none would work in any combination (even individually) with the PmodBLE.  Somewhat perplexing because the PmodBLE basically just interfaces via a UART.  And the PmodBLE works fine on its own and with the board GPIO (LEDs, switches and buttons).  Quite maddening and I still haven't figured it out.

Of course, it doesn't help that we've had extremely hot weather recently (9 days so far in the mid to upper 90s - a couple over 100 F).  I had to move my development setup downstairs to try to keep reasonably cool.  Seems like the weather all over  the world is going crazy again this year.

For my challenge experiment I had intended to do a WebBLE interface with the IMU (PmodNAV) on the Arty S7.  With my current problems, I don't think that I have enough time left in the Challenge to get that to work.  So instead, I've decided to use the integrated XADC on the Arty S7 and interface it to the Serial Bluetooth Terminal on my Android tablet.

The XADC Block contains two 12-bit, 1 MSPS ADCs. These ADCs are available for use with both external analog inputs and on-chip sensors.  These sensors and external inputs are shown in the Block Diagram:

image

The on-chip sensors include die temperature and power rails.  There are 17 external differential inputs (one dedicated pin pair and 16 dual-purpose pin pairs) that can be connected  to the ADCs through an internal mux.  The dual-purpose (aux) pins can also be configured as digital I/O.  Each differential pair can be configured as a single-ended (unipolar or bipolar) input or a differential input.  The on-chip sensors are used in the sysmon application to monitor device health and can be configured with programmable alarms.  The analog inputs have a differential range of 1V (0 to 1V or +/-0.5V).

Vivado Platform

The IP element in Vivado is the XADC Wizard.  Here is the Block Diagram image showing the external inputs and alarm outputs.

XADC Wizard

image

The XADC IP can be configured to continuously sequence through selected channels for measurement.  I set up that mode.  

image

I selected the die temperature, VCC internal and VCC aux sensors and external channels Vp_Vn, Vaux0, and Vaux15.

image

Here is the project block diagram with the external inputs:

image

Arty-S7-50-Master.xdc constraints file must be modified to uncomment the desired external pin connections for the ADC.

image

Vitis Application

It turns out that there is a Vitis Application template that has a SysMonPolledExample that configures the XADC for making measurements.  I am going to adapt that example to sample the appropriate internal sensors and external inputs and merge it with my BLE code.  That template is called "Peripheral Tests".

image

It's essentially equivalent to using a library.  I copied the code files and headers.  The application src directory in the Vitis Explorer window:

image

The key to using the SysMon code is determining the "name Indexes" for the ADC channels and finding the appropriate functions to use read the data.  All of that information is contained in the sysmon_header.h and the modified xsysmon_polled_example.c files.  I've excerpted sections below:

name Indexes

/************************** Constant Definitions ****************************/

/**
 * @name Indexes for the different channels.
 * @{
 */
#define XSM_CH_TEMP		        0x0  /**< On Chip Temperature */
#define XSM_CH_VCCINT		    0x1  /**< VCCINT */
#define XSM_CH_VCCAUX		    0x2  /**< VCCAUX */
#define XSM_CH_VPVN		        0x3  /**< VP/VN Dedicated analog inputs */
#define XSM_CH_VREFP		    0x4  /**< VREFP */
#define XSM_CH_VREFN		    0x5  /**< VREFN */
#define XSM_CH_VBRAM	    	0x6  /**< VBRAM - 7 Series and Zynq */
#define XSM_CH_SUPPLY_CALIB	    0x07 /**< Supply Calib Data Reg */
#define XSM_CH_ADC_CALIB	    0x08 /**< ADC Offset Channel Reg */
#define XSM_CH_GAINERR_CALIB 	0x09 /**< Gain Error Channel Reg  */
#define XSM_CH_AUX_MIN		    16   /**< Channel number for 1st Aux Channel */
#define XSM_CH_AUX_MAX		    31   /**< Channel number for Last Aux channel */

Read and convert XADC data

	/*
	 * Read the ADC converted Data from the data registers for on-chip
	 * temperature and on-chip VCCAUX
	 */
	TempData = XSysMon_GetAdcData(SysMonInstPtr, XSM_CH_TEMP);
	VccintData = XSysMon_GetAdcData(SysMonInstPtr, XSM_CH_VCCINT);
	VccauxData = XSysMon_GetAdcData(SysMonInstPtr, XSM_CH_VCCAUX);
	VpVnData = XSysMon_GetAdcData(SysMonInstPtr, XSM_CH_VPVN);
	Vauxp0Data = XSysMon_GetAdcData(SysMonInstPtr, XSM_CH_AUX_MIN);

	/*
	 * Convert the ADC data into temperature
	 */
	*Temp = XSysMon_RawToTemperature(TempData);

	/*
	 * Convert the ADC data into voltage
	 */
	*IntV = XSysMon_RawToVoltage(VccintData);
	*AuxV = XSysMon_RawToVoltage(VccauxData);
	*VpvnV = XSysMon_RawToVoltage(VpVnData);
	*Ap0V = XSysMon_RawToVoltage(Vauxp0Data);

I built and uploaded the project to the Arty-S7 and the operation with the Serail Bluetooth Terminal app is demonstrated in the following video.

Screencast of Serial Bluetooth Terminal running on my Android tablet.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

One thing that you can see from the screencast is that VAp0 which is the first external aux input is not changing.  Even though I set the pin connection constraint in Vivado, it appears that it is not connected.  I verified that I could not change that input.  I'll need to work on this and if I get it working in time for the challenge, I'll upload another video.  The dedicated internal sensors appear to be working okay.

  • Sign in to reply
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 © 2025 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