06-12-2018 11:18 PM
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
06-13-2018 01:14 AM
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.
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
06-13-2018 03:47 AM
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..
06-13-2018 03:56 AM
06-13-2018 04:06 AM - edited 06-13-2018 04:54 AM
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.
06-19-2018 02:54 PM