I am using no-OS bare-metal reference design of the DAQ2 board with Xilinx zc706. And how can i obtain the adc0 and adc1 data separately in my code. Which address should i read from DDR memory?
The implementation of the adc_capture() function can be found at:
no-OS/adc_core.c at master · analogdevicesinc/no-OS · GitHub
Basically, adc_capture() programs the DMA to transfer a specified number of samples to a specified memory location. I think this is not that important for your project, as it applies to another project with slightly different approach than on the daq2 project.
In the daq2 project, the capture is done a bit differently:
no-OS/fmcdaq2.c at 2016_R2 · analogdevicesinc/no-OS · GitHub (captures the data), but the DMA is preconfigured at:
no-OS/fmcdaq2.c at 2016_R2 · analogdevicesinc/no-OS · GitHub and the address at which the data is transferred is configured at no-OS/fmcdaq2.c at 2016_R2 · analogdevicesinc/no-OS · GitHub .
adc_setup only configures the HDL ADC IP, which will always stream data.
As I understand here is the ram address to read adc datas,
rx_xfer.start_address = XPAR_DDR_MEM_BASEADDR + 0x800000;
So how adc datas are located in the memory? One adc sample is 14 bit, how is arranged the adc datas in the memory?
Each sample is using 16 bytes (sign extended). Samples are interleaved. So you can consider the address an array of shorts, with even elements ADC0 samples and odd elements ADC1 samples.
Adrian thanks for your reply. If so, when I read adc by using "adc_read(core, rx_start_address, ®_data);" I get 32-bit which adc1,adc0 from MSB to LSB.
adc_read is used to read registers from the ADC, not data from the DDR.
I have recently done something similar for another project, maybe that will help you also:
ad9361: Add capture for arradio · analogdevicesinc/no-OS@69c5a66 · GitHub
Can I use like this ;
reg_data = ad_reg_read(XPAR_DDR_MEM_BASEADDR + 0x800000);
Or should I follow some instruction to read adc?
Not sure what ad_reg_read function does. The changes I've done and linked in my previous response would suffice to get the data.
Our IP doesn't allow direct access to a sample, it programs a DMA and transfers a buffer of samples, then the samples are accessed in memory, with whatever method you want.
OK, but I couldn't understand exactly what adc_capture() is doing. Does it only initialize adc, if so adc_setup is making it. Does only,
short* data = (short*) ADC_DDR_BASEADDR;
this code getting the adc samples?
OK, I think there are all the necessary definitions in the fmcdaq2.c to capture adc datas. So we should read the ddr ram only by using short* data = (short*) ADC_DDR_BASEADDR; this code, right?
short* data = (short*) rx_xfer.start_address.
Retrieving data ...