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: 
Adventurer
Adventurer
11,870 Views
Registered: ‎02-12-2015

XADC Values not updating

Jump to solution

Hi,

 

I've seen a few posts with this issue but no solutions are decribed....

 

I have implemented an XADC in my PL design. I have set it up as a single channel, continuous ADC - for now just reading the temperature.

 

Below is the code I am running in the SDK. My temperature value never changes - I would expect some jitter in the raw reading but I get nothing. I first tried to read an aux input and got the same issue. The value changes when I restart the system, but after that each read seems to just get the same value as if the register isn't being updated.

 

int main()
{
XAdcPs_Config *ConfigPtr;
XAdcPs *XADCInstPtr = &XADCMonInst;

//status of initialisation
int Status_ADC;

//temperature readings
u32 TempRawData;
float TempData;

init_platform();
ps7_post_config();
xil_printf("Should only see this once... \n\r");


//XADC initilization

ConfigPtr = XAdcPs_LookupConfig(XPAR_AXI_XADC_0_DEVICE_ID);
if (ConfigPtr == NULL)
{
return XST_FAILURE;
}

Status_ADC = XAdcPs_CfgInitialize(XADCInstPtr,ConfigPtr,ConfigPtr->BaseAddress);

if(XST_SUCCESS != Status_ADC)
{
xil_printf("ADC INIT FAILED\n\r");
return XST_FAILURE;
}

//self test
Status_ADC = XAdcPs_SelfTest(XADCInstPtr);
if (Status_ADC != XST_SUCCESS)
{
return XST_FAILURE;
}

u32 test = XAdcPs_GetSequencerMode(XADCInstPtr);

//stop sequencer
XAdcPs_SetSequencerMode(XADCInstPtr,XADCPS_SEQ_MODE_SINGCHAN);

//disable alarms
XAdcPs_SetAlarmEnables(XADCInstPtr, 0x0);

test = XAdcPs_GetSequencerMode(XADCInstPtr);
test = XAdcPs_ReadInternalReg(XADCInstPtr, XADCPS_CFR0_OFFSET);

while(1)
{
TempRawData = XAdcPs_GetAdcData(XADCInstPtr, XADCPS_CH_TEMP);
TempData = XAdcPs_RawToTemperature(TempRawData);
//printf("Raw Temp %lu Real Temp %f \n\r", TempRawData, TempData);
xil_printf("TempDig %d %d\n\r", TempRawData, (u32)(TempData));

//Aux10PRawData = XAdcPs_GetAdcData(XADCInstPtr, XADCPS_CH_AUX_MIN + 10);
//Aux10PV = XAdcPs_RawToVoltage(Aux10PRawData);
//xil_printf("Aux 10 %d - %d\n\r", Aux10PRawData, (u32)Aux10PV);
}

return 0;
}

 

Terminal output:

TempDig 43261 59
TempDig 43261 59
TempDig 43261 59
TempDig 43261 59
TempDig 43261 59
TempDig 43261 59
TempDig 43261 59
TempDig 43261 59
TempDig 43261 59
TempDig 43261 59
TempDig 43261 59

 

 

Resetting the board:

TempDig 42995 57
TempDig 42995 57
TempDig 42995 57
TempDig 42995 57
TempDig 42995 57
TempDig 42995 57
TempDig 42995 57
TempDig 42995 57
TempDig 42995 57
TempDig 42995 57
TempDig 42995 57

 

 

I tried resetting the ADC in the loop but this had no effect.

 

Please help!

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
18,843 Views
Registered: ‎03-21-2008

Re: XADC Values not updating

Jump to solution

Hi Marc,

 

You are correct, If the XADC was converting there should be small variations in the result from one read to the next.

So from this we can conclude that the XADC is not converting and what you are reading back is the last value captured in the register.

 

A few thinns can prevent the XADC from being converted - being held in reset, or being configured to be in event mode, and not supplying a conversion start signal continuously via the CONVST input.

 

Also, the DCLK provided to the XADC in the PL should be set so the combination of DCLK and CLK_DIVIDE (reg 0x42) results in an ADC clock in the range of 1 to 26MHz.

 

One way to check if the block is held in reset / not converting is to do a reset from the PS - and then readback any of the min/max registers - i.e. min-temperature and max-temperature. If these values are in the reset state (all 0's for Max and all 1's for min) - then this confirms the XADC is not converting.

 

You mention that you instantiated the XADC in the PL - can you check this instantion, and the settings for config reg 0 (reg 0x40) to ensure event-mode is not set.

 

Hope this helps,

John

View solution in original post

19 Replies
Scholar austin
Scholar
11,857 Views
Registered: ‎02-27-2008

Re: XADC Values not updating

Jump to solution

Are you following XAPP1172?

 

 

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
Adventurer
Adventurer
11,849 Views
Registered: ‎02-12-2015

Re: XADC Values not updating

Jump to solution

Hi Austin,

 

No, I'm not using Linux, this is a bare metal application.

 

Thanks.

0 Kudos
Adventurer
Adventurer
11,839 Views
Registered: ‎02-12-2015

Re: XADC Values not updating

Jump to solution
Even a very simple test, leaving the sequencer mode in safe mode and constantly reading the temperature and VCCInt shows identical values.

These values stay the same until I reset the board and re-program the fpga.
0 Kudos
Xilinx Employee
Xilinx Employee
18,844 Views
Registered: ‎03-21-2008

Re: XADC Values not updating

Jump to solution

Hi Marc,

 

You are correct, If the XADC was converting there should be small variations in the result from one read to the next.

So from this we can conclude that the XADC is not converting and what you are reading back is the last value captured in the register.

 

A few thinns can prevent the XADC from being converted - being held in reset, or being configured to be in event mode, and not supplying a conversion start signal continuously via the CONVST input.

 

Also, the DCLK provided to the XADC in the PL should be set so the combination of DCLK and CLK_DIVIDE (reg 0x42) results in an ADC clock in the range of 1 to 26MHz.

 

One way to check if the block is held in reset / not converting is to do a reset from the PS - and then readback any of the min/max registers - i.e. min-temperature and max-temperature. If these values are in the reset state (all 0's for Max and all 1's for min) - then this confirms the XADC is not converting.

 

You mention that you instantiated the XADC in the PL - can you check this instantion, and the settings for config reg 0 (reg 0x40) to ensure event-mode is not set.

 

Hope this helps,

John

View solution in original post

Adventurer
Adventurer
11,683 Views
Registered: ‎02-12-2015

Re: XADC Values not updating

Jump to solution

John,

 

Thanks, it did help.

 

I'm using an axi based XADC just so I can easily query the values, and never paid attention to the DCLK frequency in the ADC wizard.

 

I matched the DCLK frequency to that of the s_axi_clk (50MHz) and everything looks like it's updating.

 

Thanks again for your help.

 

Marc

0 Kudos
Adventurer
Adventurer
11,672 Views
Registered: ‎02-12-2015

Re: XADC Values not updating

Jump to solution

If I could ask another question...

 

To keep everything in the PL - I assume I'll need to use the DRP interface. I am wondering how to access the XADC registers in the PL, could you point me to some examples?

 

Thanks

0 Kudos
Visitor gliu999
Visitor
10,935 Views
Registered: ‎06-24-2015

Re: XADC Values not updating

Jump to solution

Hallo marc,

I have another question, after using the XADC wizard, the System monitor in debug core doesn't change over time. It seems like your problem. I check the busy, eos, eoc signals they work fine. The only thing goes wrong is the temperature is always 270.3 which is FFF in the case. I also use the signal channel model and DRP interface.

0 Kudos
Scholar austin
Scholar
10,933 Views
Registered: ‎02-27-2008

Re: XADC Values not updating

Jump to solution

g,

 

That is an indication the XADC has no power to its supply, or does not hve its reference voltage supplied, either internally or externally (an option in the setyup).

 

 

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
Visitor gliu999
Visitor
10,912 Views
Registered: ‎06-24-2015

Re: XADC Values not updating

Jump to solution

Austin,

Hallo, I use xc7vx330tffg1157-2 as device. I found a IO Pin for Vref for XADC on the package. Should I assign it in the XDC file or something? Actually I only assign the Vp and Vn pins as external inputs. How can I assure my XADC IP Core Power supplied connected to the right pins?

 

Kinds Regards

Gongda

0 Kudos
Scholar austin
Scholar
7,556 Views
Registered: ‎02-27-2008

Re: XADC Values not updating

Jump to solution

g,

 

 You either need to select the internal reference in your design vua the options of the sysmon (see the users guide for the XADC or Sysmon), or supply it to that pin.

 

 

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
Visitor gliu999
Visitor
7,493 Views
Registered: ‎06-24-2015

Re: XADC Values not updating

Jump to solution

I found the pin I choose is not supported. Then I choose another one and it fixed. Thank you very much!

0 Kudos
Scholar austin
Scholar
7,482 Views
Registered: ‎02-27-2008

Re: XADC Values not updating

Jump to solution

g,

 

No.  The Vref pin location is not programmable, it is fixed at that dedicated pin, and that pin only.

 

 

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
Observer jpc2112
Observer
3,527 Views
Registered: ‎06-05-2017

Re: XADC Values not updating

Jump to solution

This is an old post but I'm having a similar problem today and the answer posted doesn't exactly apply to me.  I'm using 2016.4 and the ZC706 eval board.

 

I'm doing a pure VHDL design, instantiating the XADC using the wizard to set up continuous conversion mode with sequencer and with 256 sample averaging so I can have a state machine periodically (every 6 seconds) read all status registers for the temperature and internal voltages and send them out as a packet of data across a tiny custom uart to my laptop where my C# GUI parses it for display.  What puzzles me is that I get what is mostly correct data (two exceptions), but it's always the same regardless of power ups or how long I let it run.

 

I read on this post that another designer saw a different value after each power up, whereas I get the same values.  Yet because the values mostly make sense it seems it must be converting at least once correctly, although why I never get any variation, especially for temperature, makes no sense.

 

What I'm doing: I wait for a timeout in my state machine, then on the next EOS I use the DRP signals to interrogate all the registers.  I change the address when DEN activates, then I use DRDY to know that I can do a read.  I've attached a scope image showing (top to bottom): DEN, DRDY, DADDR0, DADDR1, DADDR2, DADDR3.  You can see my DCLK is 25 MHz in this particular scope image.  DCLK is currently 74 MHz so that ADCCLK can be 14.8 MHz so that the sequencer cycles at a 40 KHz rate (I'm also enabling calibration channel).  But behavior is the same regardless of rates.

 

I also attached two images showing output snapshots displayed by the GUI: note that the temperature has never been anything but 18.1, the same is true for the voltages that are not in red.  For the VREFP and VREFN, note that VREFP is out of range and VREFN alternates randomly between a value of either 0 or 2.86 (never in between).  The data is never different from these two images.  I'm not getting 000 or FFF for data so seems like the XADC is converting.  PLUS, I also convert on VP/VN in the sequence and for THAT input I DO see different data.  This is input from an audio mic and it's responding to sounds in real time.

 

Whether I use internal or external VREFP makes no difference.  Turning off the FPGA heat sink fan makes no temperature rise (only burning 1/3 W but that should cause at least 0.1 degree rise).

 

If the odd VREFN or VREFP value is a clue, how is it that I get a mirage of good data on the first read from all inputs, and that I get good data from VP/VN all the time?

 

Any advice, anyone?

Thanks.

 

XADC.jpg
sysmon1.jpg
sysmon2.jpg
0 Kudos
Scholar austin
Scholar
3,512 Views
Registered: ‎02-27-2008

Re: XADC Values not updating

Jump to solution

Without your design,

 

(no bitstream loaded) what does hardware manager report for the XADC voltages and temperature?

 

 

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
Observer jpc2112
Observer
3,502 Views
Registered: ‎06-05-2017

Re: XADC Values not updating

Jump to solution

Hi Austin, attached is the hardware manager XADC table after being powered on for several minutes.  It seems to be working without a bitstream including VP_VN when I enable all aux.

 

correction: I just noticed that without the bitstream I am seeing VREFN around 1V (changing by a few mV per reading).  After programming with my bitstream, I am still monitoring the XADC but now with my GUI along with hardware manager tabs.  In the hardware manager I am now seeing VREFN be either 0.000V or 1.000V, nothing in between.  The rest of the sensors are correct.  My GUI still reports the same as before.

0 Kudos
Scholar austin
Scholar
3,466 Views
Registered: ‎02-27-2008

Re: XADC Values not updating

Jump to solution

If it works without your bitstream, it is a bug in your design.

 

If it does not work without a bitstream, it is the board, connections, power supplies, or a bad (damaged) device.

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
Observer jpc2112
Observer
3,458 Views
Registered: ‎06-05-2017

Re: XADC Values not updating

Jump to solution

ok, I'll test my code some more.  what about VREFN being at 1v without design, then bouncing from 0v to 1v with design?  I checked the board jumpers and J12/J13 are at default.

I see now that VREFN is read in bipolar mode so that probably explains why my GUI, which assumes unipolar, was decoding as either 0v or 2.86v (i.e. 0x000 or 0xF41, though why it's never 0xFFF is puzzling).

 

but shouldn't VREFN be solidly near 0v at least in the hardware manager, regardless of what is programmed?

 

regarding my code maybe I'm doing something that, while allowed by the XADC wizard, is causing problems.  I'm doing 256 sample averaging on all the sensors but no averaging on VP/VN, plus I've extended the acquisition time on VP/VN, plus I've enabled the calibration channel which averages 16 samples by default.  And I've powered down ADC B.  my scope waveforms exactly match the sample rates I am expecting for each channel (putting the XADC/DRP signals onto test outputs).  I calculated there are 370 ADCCLKs total for my sequencer.

 

0 Kudos
Observer jpc2112
Observer
3,448 Views
Registered: ‎06-05-2017

Re: XADC Values not updating

Jump to solution

found the root of the problem, which is that the UART on the pc side is producing 0x3F value for LSBs of exactly 4 out of the 9 sensor readings, while the MSBs are correct for all.  The incorrect bytes are always the LSBs of temp, VCCAUX, VREFP and VCCPAUX.  maybe a coincidence that the MS byte that go with these 4 bad LS bytes are all either 0x09 or 0x06, whereas the other 5 sensors have something else for MS byte?

 

Anyhow the data bytes are all correct in the scoped serial TX stream going out of the FPGA so the XADC is working.  When I manually convert the captured TX data to temperature and voltage I get good results.  So other than VREFN being 1V in the hardware manager which doesn't make sense to me, this is a C# or UART receiver issue.  Thanks for troubleshooting this with me.

 

0 Kudos
451 Views
Registered: ‎04-10-2019

Re: XADC Values not updating

Jump to solution

hi 

your problem is here

//stop sequencer
XAdcPs_SetSequencerMode(XADCInstPtr,XADCPS_SEQ_MODE_SINGCHAN);

you have to change your Sequencer to continuosly

that mean you have to change that line to this:

XAdcPs_SetSequencerMode(XAdcInstPtr, XADCPS_SEQ_MODE_CONTINPASS);