cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
himanshu28
Observer
Observer
1,410 Views
Registered: ‎05-17-2018

Application project for XADC

How do I create an application project in the SDK and write C program for PS-XADC interfaciing in DRP mode.

 

I am having trouble in considering which header files and functions should be there in my code

 

 

xadc11.JPG
5 Replies
klumsde
Moderator
Moderator
1,390 Views
Registered: ‎04-18-2011

Hi @himanshu28

 

you don't need to keep posting variations of the same questions multiple times. 

 

look at my example:

I have a design with an XADC that is just doing internal supplies. 

I use the AXI4Lite interface to talk to the processor. 

 

himanshu_xadc.JPG

 

I build this design and export to SDK. 

I create a new application project, in fact I use the helloword template. 

then I modify it to do reads 

i just read temperature and VCCINT and print them out. 

 

/*
* helloworld.c: simple test application
*
* This application configures UART 16550 to baud rate 9600.
* PS7 UART (Zynq) is not initialized by this application, since
* bootrom/bsp configures it to baud rate 115200
*
* ------------------------------------------------
* | UART TYPE BAUD RATE |
* ------------------------------------------------
* uartns550 9600
* uartlite Configurable only in HW design
* ps7_uart 115200 (configured by bootrom/bsp)
*/

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xil_types.h"
#include "xsysmon.h"

static XSysMon XADCMonInst;

int main()
{
XSysMon_Config *ConfigPtr;

XSysMon *XADCInstPtr = &XADCMonInst;
int Status_ADC;
u32 TempRawData;
float TempData;
u32 PLVccintRawData;
float PLVccintData;

init_platform();

ConfigPtr = XSysMon_LookupConfig(0);
if (ConfigPtr == NULL) {
return XST_FAILURE;
}
Status_ADC = XSysMon_CfgInitialize(XADCInstPtr,ConfigPtr,ConfigPtr->BaseAddress);
if(XST_SUCCESS != Status_ADC){
print("ADC INIT FAILED\n\r");
return XST_FAILURE;
}

xil_printf("Hello World\n\r");
xil_printf("Check Temperature\n\r");

TempRawData = XSysMon_GetAdcData(XADCInstPtr, XSM_CH_TEMP);
TempData = XSysMon_RawToTemperature(TempRawData);
xil_printf("Raw Temp %lu \n\r", TempRawData);
printf("Real Temp %.1f \n\r", TempData);

xil_printf("Check VCCINT\n\r");

PLVccintRawData = XSysMon_GetAdcData(XADCInstPtr, XSM_CH_VCCINT);
PLVccintData = XSysMon_RawToVoltage(PLVccintRawData);
xil_printf("Raw VCCINT %lu \n\r", PLVccintRawData);
printf("Real VCCINT %.2f \n\r", PLVccintData);


cleanup_platform();
return 0;
}

 

You need to go away and try something simple like this.

Then modify it to maybe use the EOC as an interrupt. you will need to go and research Zynq-7000 and how to do this. 

 

Keith  

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Reply
himanshu28
Observer
Observer
1,376 Views
Registered: ‎05-17-2018

Thank you for the reply.

 

But I have to get the digital output of the XADC and pass it through filter bank to be connected ahead.

Now the question is how to access the 16 bit ADC output values ? Please note that I am applying a sine wave in the input..

0 Kudos
Reply
klumsde
Moderator
Moderator
1,370 Views
Registered: ‎04-18-2011

Is the filter in the FPGA fabric?
Is it an IP or do you have RTL code? Maybe you should look at the documentation about packaging and customizing IP.
http://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_1/ug1118-vivado-creating-packaging-custom-ip.pdf
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Reply
himanshu28
Observer
Observer
1,368 Views
Registered: ‎05-17-2018

Hi @klumsde

The filter bank is already in the IP.

 

Before that I have to set up a communication between filter bank and the XADC. I am facing problem regarding from where to take the XADC output values.

0 Kudos
Reply
klumsde
Moderator
Moderator
1,292 Views
Registered: ‎04-18-2011

Sounds to me like you need to take the output of the filter and buffer it in block ram or something and read it back using the processor. You need to plan out this design I think.
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Reply