Jump to content
  • 0

Pmod Ad5


1116345

Question

Hello

I am using the Pmod AD5 to convert my analog signals from light sensor to be able to feed it into the fpga. Any one has an idea of how can i proceed? I tried by testing the AD5 by inputting an analog input but i cannot get to the digital output...any help would be highly appreciated..Thanks

Link to comment
Share on other sites

Recommended Posts

The Pseudo bit is in the Configuration Register (register '010' ), bit 18 (page 27 of the datasheet). The power-on-reset value for the register is 0x000117. We want it set to 0x040117 (well, if we only want to set the Pseudo bit), or 0x040110 if the gain of 1x is desired, as per Mr Colvin's post.

 

To do this, we need to write over the SPI interface. Whenever a new write to the ADC occurs, the first byte goes to the Communications Register (see page 22). These are the bits that need to be sent:

 

0 - active low write enable for the Communication Register

0 - active low write command

0 - REN(2),- The address of the register to write to

1 - REN(1) - The address of the register to write to

0 - REN(0) - The address of the register to write to

0 - continuous read off.

0 0 - must be 0.

 

This is then followed up with the data that will be written to the Configuration Register ( in this case - 0x040110)

 

So the stream of bits we want to send out are:

0001 0000 0000 0100 0000 0001 0001 0000

 

In the FPGA design code above,this can be done by setting the initial values of the shift registers:

 

   signal cs_shift_reg   : std_logic_vector(63 downto 0) :=   x"FF000000007FFFFF";
   signal mosi_shift_reg : std_logic_vector(63 downto 0) := x"0010040110000000";

[code=auto:0]

 

So here what it looks like in simulation, as these registers are written while the design starts up:

 

post-35-0-73711500-1417770637_thumb.gif

 

Just to reiterate, I don't have access to the PMOD, so all of this code has not been tested other than by me eyeballing that the simulation waveforms match what I think they should look like. You will need to do a lot of checking against the datasheet - you will need to read it very closely, and double check everything! 

 

Also, my initial understanding was that you only needed to read only one channel. To read many channels the design will get a lot more complex and may need to be structured differently, to include a more complex FSM to switch to different channels.

 

Mike

 

Link to comment
Share on other sites

The bit stream that hamster has provided is exactly what you would want to provide when you want to have the AD5 use a pseudo differential input with pin "A0" on the 6x2 header on the Pmod.

 

When using the pseudo differential input though, you will also need to provide a a voltage reference on the pin "ACOM" on the 6x2 header on the Pmod. Because the Analog Devices chip on the Pmod is by default operating in bipolar mode, and with a gain of 1 as we have configured the Pmod, I would recommend using a voltage reference of 2.5V.

 

As per the "Data Output coding" section on page 33 of the reference manual, bipolar mode will actually only convert the analog signal into 23 bits with the 24th bit (the first one in the string of bits in the acting as the sign bit. This sign bit will indicate if the analog signal you are sending the AD5 is above or below the ACOM reference voltage.

 

It is fairly easy to enable other analog input channels by turning on their bits (such as CH1, CH2, etc in the Configurations register on page 27), but as Mike mentioned, the design can get more complicated as we start needing to read from multiple registers like the Data register and the Status register in order to tell us which channel the information in the Data Register applies to.

 

Let me know if you have any more questions.

 

Thanks,

JColvin

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...