Jump to content
  • 0

Connecting PMOD AD1 to ultrazed using 2 ADC channels


rebelsequeira

Question

Hi,

My setup is using Avnet Ultrazed board with PMOD AD1. Also I am using Xilinx Vivado & SDK 2019.1. 

I am successfully being able to use 1 channel of the PMOD AD1. I am trying to use both the ADC channels on the PMOD AD1. As the PMOD libraries has no board support files for the Avnet Ultrazed board I went ahead and created a QSPI IP block to get a single channel working. I am having trouble getting the second channel working. Few doubts I have are: 

1. For the QSPI IP block, should I use it in standard mode or Dual SPI mode. (I have set the data pins as MISO. Also selected the number of slaves as 1)

2. In the C code how do I switch between the 2 ADC channels as the 2 slaves are connected to the same chip select. I have set the slave select in initialize as  --> XSpi_SetSlaveSelect(SpiInstancePtr, 0x01);

3. Should I use manual slave select or automatic slave select? --> XSpi_SetOptions(SpiInstancePtr, XSP_CLK_ACTIVE_LOW_OPTION | XSP_MASTER_OPTION | XSP_MANUAL_SSELECT_OPTION);

Thanks!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Hi @rebelsequeira

Welcome to the forums!

The Pmod AD1 IP core can be used without board file support:

  1. Add the IP to the diagram with the Add IP button.
  2. Select the IP's Pmod_out interface.
  3. Right click on the Pmod_out interface and select "make external"
  4. Connect clocks, interrupts, and AXI interfaces as usual.
  5. Create an HDL wrapper or make sure that the existing one is up to date. Open the HDL wrapper to find the port names for the Pmod pins (typically something like Pmod_out_*_pin1_io by default).
  6. Create an XDC to constrain the Pmod pins as they are named in the wrapper, basing the locations of the pins on whatever materials Avnet provides.
  7. Generate a bitstream, etc. Continue as normal.

If you want to go with the QSPI route instead, it may be tricky. Standard SPI mode likely only exposes a single AD1 channel, while dual mode likely requires deinterlacing of the channels' data in software. The AD1 is designed such that data is provided on both pins at once. To use both channels simultaneously, data must be shifted off of both pins, you select a channel by picking which bits to read. See the code block below for a vague sketch of how this works:

SPI MISOs:
D0: (MSB) An, ... A2, A1, A0 (LSB)
D1: (MSB) Bn, ... B2, B1, B0 (LSB)

Dual Read Result:
(MSB) Bn, An, ..., B2, A2, B1, A1, B0, A0 (LSB)

Automatic slave select is likely fine, as long as the number of bits in a transfer is correctly specified (32 for a read of both channels).

Thanks,

Arthur

Link to comment
Share on other sites

Hi artvvb,

Thanks for your response. That was really helpful.

I was able to use the PMOD AD1 library and both channels worked. Although, I noticed a weird issue. In normal scenario, if I have a pot connected as input to a standard QSPI and vary the pot, the ADC output is 0 to 4096. Although the PMOD library IP varies from 0 to 4096 to 0 to 4096. I don't get why at 3.3V/2 the input with the PMOD goes back to 0. I feel it's something very small but I'm not sure what's causing this to happen.

On the other hand, I was not able to change the transaction width of the QSPI beyond 8 bit in dual mode in the IP so I am not sure how to interface directly with QSPI without the PMOD library.

Thanks,

Rebel

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...