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.
xStatus = XSysMon_CfgInitialize(SysMonInstPtr, SysMonConfigPtr,
SysMonConfigPtr->BaseAddress);
if(XST_SUCCESS != xStatus) printf("CfgInitialize FAILED\n\r");
printf("Test3\n\r");
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
XSysMon_GetStatus(SysMonInstPtr); // Clear the old status
XSysMon_SetSequencerMode(SysMonInstPtr, XSM_SEQ_MODE_SINGCHAN);
XSysMon_SetAlarmEnables(SysMonInstPtr, 0x0);
//XSysMon_StartAdcConversion(SysMonInstPtr);
while(1)
{ //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);
XSysMon_ResetAdc(SysMonInstPtr);
usleep(5000000);XSysMon_GetStatus(SysMonInstPtr); // Clear the old status
//XSysMon_SetSequencerMode(SysMonInstPtr, XSM_SEQ_MODE_SINGCHAN);
XSysMon_SetAlarmEnables(SysMonInstPtr, 0x0);
//XSysMon_StartAdcConversion(SysMonInstPtr);
}
return 0;
}
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
Question
Vishnuk
Hi,
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
Code
#include <stdio.h>
#include "xparameters.h"
#include "xsysmon.h"
#include "xil_cache.h"
//#include "xsysmon.h"
#include "sysmon_header.h"
#define SYSMON_DEVICE_ID XPAR_SYSMON_0_DEVICE_ID //ID of xadc_wiz_0
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;
//init_platform();
printf("Hello World\n\r");
printf("Test1\n\r");
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ SysMon Initialize
SysMonConfigPtr = XSysMon_LookupConfig(SYSMON_DEVICE_ID);
if(SysMonConfigPtr == NULL) printf("LookupConfig FAILURE\n\r");
printf("Test2\n\r");
xStatus = XSysMon_CfgInitialize(SysMonInstPtr, SysMonConfigPtr,
SysMonConfigPtr->BaseAddress);
if(XST_SUCCESS != xStatus) printf("CfgInitialize FAILED\n\r");
printf("Test3\n\r");
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
XSysMon_GetStatus(SysMonInstPtr); // Clear the old status
XSysMon_SetSequencerMode(SysMonInstPtr, XSM_SEQ_MODE_SINGCHAN);
XSysMon_SetAlarmEnables(SysMonInstPtr, 0x0);
//XSysMon_StartAdcConversion(SysMonInstPtr);
while(1)
{ //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);
XSysMon_ResetAdc(SysMonInstPtr);
usleep(5000000);XSysMon_GetStatus(SysMonInstPtr); // Clear the old status
//XSysMon_SetSequencerMode(SysMonInstPtr, XSM_SEQ_MODE_SINGCHAN);
XSysMon_SetAlarmEnables(SysMonInstPtr, 0x0);
//XSysMon_StartAdcConversion(SysMonInstPtr);
}
return 0;
}
//‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.