• 0

Problem with Basys 3 XADC Ip Core



I have used XADC IP Core on my Basys 3 board, I am unable to get updated value. i Keep getting 0V Can you please help me out with this. I have attacthed the block design and SDK Code.

Kind regards

R Vishnu Kumar


#include <stdio.h>
#include "xparameters.h"
#include "xsysmon.h"

#include "xil_cache.h"
//#include "xsysmon.h"
#include "sysmon_header.h"

        static XSysMon SysMonInst; //a sysmon instance
        //static int SysMonFractionToInt(float FloatNum);

        int main()
        u32 TempRawData,VccIntRawData,ExtVolRawData;
        float TempData,VccIntData,ExtVolData;
        int xStatus;
        XSysMon_Config *SysMonConfigPtr;
        XSysMon *SysMonInstPtr = &SysMonInst;
        printf("Hello World\n\r");
        //‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ SysMon Initialize
        SysMonConfigPtr = XSysMon_LookupConfig(SYSMON_DEVICE_ID);
        if(SysMonConfigPtr == NULL) printf("LookupConfig FAILURE\n\r");

        xStatus =     XSysMon_CfgInitialize(SysMonInstPtr, SysMonConfigPtr,
        if(XST_SUCCESS != xStatus) printf("CfgInitialize FAILED\n\r");
        XSysMon_GetStatus(SysMonInstPtr); // Clear the old status
        XSysMon_SetSequencerMode(SysMonInstPtr, XSM_SEQ_MODE_SINGCHAN);
        XSysMon_SetAlarmEnables(SysMonInstPtr, 0x0);
        { //wait until EOS activated
        while ((XSysMon_GetStatus(SysMonInstPtr) & XSM_SR_EOC_MASK    ) != XSM_SR_EOC_MASK    );

        VccIntRawData = XSysMon_GetAdcData(SysMonInstPtr,XSM_CH_VPVN); //Read the on‐chip    Vccint Data
        VccIntData = XSysMon_RawToVoltage(VccIntRawData);        printf("The Current VCCINT is %0d Volts. \n\r",VccIntData);
        usleep(5000000);XSysMon_GetStatus(SysMonInstPtr); // Clear the old status
        //XSysMon_SetSequencerMode(SysMonInstPtr, XSM_SEQ_MODE_SINGCHAN);
        XSysMon_SetAlarmEnables(SysMonInstPtr, 0x0);
        return 0;



Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

I think you need to set the channel for conversion.
See here


Table 3-4 and Table 3.7, register 0x40 bits 0 .. 4.

I'm not familiar with the wrapper functions, but they couldn't guess beforehand, which one of the 16 AUX channels you want to read. So it needs to be set.

Link to post
Share on other sites
  • 0

problem solved i used Vaux 15 instead of Vp VN channel. Thanks lot for the reply. I have a query though. i will be using xadc for reading a ccd image so inorder to read 1000 pixel whose analog signal will be around 1Mhz, what do i do jus use a for loop

i.e  for i=1 to 1000




is this the right method?




Link to post
Share on other sites
  • 0


I'm happy to hear that it works.
But, note that there is no "Vp/Vn" channel. The ADC has 16 AUX inputs that can be multiplexed to one of the two ADC cores.

I think what you did now was to read the value from the results register that belongs to the channel that is being triggered.
My proposal was to switch the ADC to the AUX input that is physically connected. Once you use more than one channel, this can't be avoided.

A "for" loop should get some data, but then your code becomes very brittle, timing-wise. Any interrupt that distracts the CPU for a microsecond will cause you to skip a sample.

I suspect you will have a hard time with a concept, where software is timing-critical. The easier way would be IMHO to use event-triggered mode via the XADC's CONVST pin, and a hardware FIFO.

Edited by xc6lx45
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now