User Tools

Site Tools


theory:digilent_pmodia

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

theory:digilent_pmodia [2020/03/15 16:04] (current)
Line 1: Line 1:
 +===== Digilent PmodIA Impedance Analyzer =====
  
 +//The Digilent PmodIA((Digilent PmodIA, [[http://store.digilentinc.com/pmodia-impedance-analyzer/]])) (Revision A) is an impedance analyzer built around the Analog Devices AD5933 12-bit Impedance Converter((Analod Devices, 1 MSPS, 12 Bit Impedance Converter Network Analyzer, [[http://www.analog.com/en/products/rf-microwave/direct-digital-synthesis-modulators/ad5933.html]])). There is also an evaluation kit from Analog Devices((Analog Devices, AD5933 Evaluation Board, [[http://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/EVAL-AD5933.html]])), but there is no experience with that.//
 +
 +==== Board and chip ====
 +
 +  * Digilent PmodIA reference website((Digilent PmodIA reference website, [[https://reference.digilentinc.com/reference/pmod/pmodia/start]]))
 +  * PmodIA Reference Manual((PmodIA Reference Manual, [[https://reference.digilentinc.com/reference/pmod/pmodia/reference-manual]]))
 +  * PmodIA schematics((PmodIA schematics, [[https://reference.digilentinc.com/_media/pmod/pmod/pmodia_sch.pdf]]))
 +  * Analog Devices AD5933 datasheet ((Analog Devices AD5933: 1 MSPS, 12-Bit Impedance Converter, Network Analyzer, [[http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf]]))
 +  * Analog Devices Application note AN-1252((How to Configure the AD5933/AD5934 by Miguel Usach, [[http://www.analog.com/media/en/technical-documentation/application-notes/AN-1252.pdf?doc=cn0349.pdf]]))
 +
 +<imgcaption Earlobe|Digilent PmodIA Impedance Analyzer board is based on the Analog Devices AD5933 chip>{{pmodia-0.png?200}}</imgcaption>
 +
 +==== Connecting to a computer ====
 +
 +The board is connected to a computer using a Bus Pirate v3.5c((Dangerous Prototypes, Bus Pirate, [[http://dangerousprototypes.com/docs/Bus_Pirate]])). The wiring is as follows:
 +
 +<tabcaption PmodIA_to_BusPirate|Connecting the Bus Pirate v3.5c to the PmodIA>
 +^  Bus Pirate  ^  PmodIA  ^  Function  ^
 +| GND | GND | Ground  |
 +| +3V3 | VCC | 3.3V power supply 
 +| VPU | VCC | Pull-up resistors for I<sup>2</sup>
 +| CLK | SCL | I<sup>2</sup>C SCL  | 
 +| MOSI | SDA | I<sup>2</sup>C SDA  | 
 +</tabcaption>
 +
 +
 +<imgcaption ConnectingTheBoards|Connecting the boards>{{connectingtheboards.png?400}}</imgcaption>
 +
 +To communicate from a Mac to the Bus Pirate, the ZTerm application is used((ZTerm Macintosh Modem Communications, [[http://www.dalverson.com/zterm/]])), but any serial communication tool is an option (like the serial monitor from Arduino). The settings are:
 +  * Baud rate: 115200
 +  * Data bits: 8
 +  * Stop bits: 1
 +  * Parity: none
 +  * Flow control: Xon/Xoff
 +
 +After opening the terminal, the connection is tested with a "?" command, and the Bus Pirate responds correctly with its help menu. The next test is to searach for I<sup>2</sup>C devices by the following commend sequence:
 +
 +<code>
 +HiZ>m 4 3    -- to set the Bus Pirate to the I2C mode using a speed of 100kHz
 +I2C>W P v    -- to switch on the power and the pull-up resistors, and measure the voltages subsequently
 +I2C>(1)      -- to run the macro that identifies all I2C devices on the bus
 +I2C>p w m 1  -- to switch off the supplies and switch back to HiZ mode
 +</code>
 +
 +After the second line of switching on the powers and measuring the voltages, the VPU pin should read something like $3.3V$. After line 3, the PmodIA board should respond with:
 +
 +<code>
 +Searching I2C address space. Found devices at:
 +0x1A(0x0D W) 0x1B(0x0D R)
 +</code>
 +which means the AD5933 chip is found correctly at I<sup>2</sup>C hexadecimal address 0x0D, which becomes 0x1A for write and 0x1B for read (according to the I<sup>2</sup>C protocol. 
 +
 +Now read the control register of the AD5933:
 +
 +<code>
 +HiZ>m 4 3             -- switch to I2C mode
 +I2C>W P               -- to switch on the power and the pull-up resistors 
 +I2C>[0x1A 0xB0 0x80]  -- address chip 0x0D for write, and set a pointer to address 0x80, the control register. 0xB0 is the command code for setting a pointer
 +I2C>[0x1B r]          -- address chip 0x0D for read, which gives the content of the register at the pointer (control register)
 +I2C>p w m 1           -- to switch off the supplies and switch back to HiZ mode
 +</code>
 +
 +The resulting byte is 0xA0 which is indeed the default value of the control register according to the data sheet. It means the chip is in power down mode.
 +
 +
 +Now read the temperature of the AD5933:
 +
 +<code>
 +HiZ>m 4 3                     -- switch to I2C mode
 +I2C>W P                       -- to switch on the power and the pull-up resistors 
 +I2C>[0x1A 0xB0 0x8F] [0x1B r] -- Read status register 0x8F
 +I2C>[0x1A 0x80 0x90]          -- Write 0x90 to the control register upper byte to start a temperature measurement
 +I2C>[0x1A 0xB0 0x8F] [0x1B r] -- Read status register 0x8F to check if the measurement is finished
 +I2C>[0x1A 0xB0 0x92] [0x1B r] -- Read temperature upper byte
 +I2C>[0x1A 0xB0 0x93] [0x1B r] -- Read temperature lower byte
 +I2C>[0x1A 0x80 0xA0]          -- Write 0xA0 to the control register upper byte to enter power down mode
 +I2C>p w m 1                   -- to switch off the supplies and switch back to HiZ mode
 +</code>
 +
 +The resulting bytes are 0x02 and 0xF9 which is $761$ and corresponds to $761/32 = 23.8^{\circ} C$.
 +
 +==== Block read and write ====
 +
 +Some examples of writing registers and blocks from the Bus Pirate:
 +
 +<code>
 +I2C>[0x1A 0x82 0xAA] -- Write to start frequency byte 1
 +I2C>[0x1A 0x83 0x77] -- Write to start frequency byte 2
 +I2C>[0x1A 0x84 0x33] -- Write to start frequency byte 3
 +
 +I2C>[0x1A 0xB0 0x82] [0x1B r] -- Read start frequency byte 1
 +I2C>[0x1A 0xB0 0x83] [0x1B r] -- Read start frequency byte 2
 +I2C>[0x1A 0xB0 0x84] [0x1B r] -- Read start frequency byte 3
 +
 +I2C>[0x1A 0xB0 0x82] [0x1A 0xA0 0x03 0x00 0xF3 0xC5] -- Block write start frequency bytes 1 through 3
 +
 +I2C>[0x1A 0xB0 0x82] [0x1A 0xA1 0x03 [0x1B r:3] -- Block read start frequency bytes 1 through 3
 +</code>
 +
 +==== Calibration ====
 +
 +According to the PmodIA Reference Manual((PmodIA Reference Manual, [[https://reference.digilentinc.com/reference/pmod/pmodia/reference-manual]])), the gain factor has to be determined first. This is done using the programming sequence as explained in AN-1252((How to Configure the AD5933/AD5934 by Miguel Usach, [[http://www.analog.com/media/en/technical-documentation/application-notes/AN-1252.pdf?doc=cn0349.pdf]])).
 +
 +<code>
 +HiZ>m 4 3             -- Switch to I2C mode
 +I2C>W P               -- to switch on the power and the pull-up resistors 
 +I2C>[0x1A 0x80 0xB1]  -- Write 0xB0 to the control register upper byte to enter standby mode (0xB0) and set gain to 1x with an excitation voltage of 2Vpp (0x01)
 +I2C>[0x1A 0x81 0x10]  -- Write 0x10 to the control register lower byte for reset and internal system clock
 +I2C>[0x1A 0xB0 0x82] [0x1A 0xA0 0x03 0x00 0xF3 0xC5] -- Write start frequency 0x00F3C5 = 1950Hz at MCLK=16.776MHz to registers 0x82 0x83 0x84 
 +I2C>[0x1A 0xB0 0x85] [0x1A 0xA0 0x03 0x00 0x79 0xE2] -- Write frequency increment 0x0079E2 = 975Hz at MCLK=16.776MHz to registers 0x85 0x86 0x87 
 +I2C>[0x1A 0xB0 0x88] [0x1A 0xA0 0x02 0x00 0x0A]      -- Write number of increments 0x000A = 10 to registers 0x88 0x89
 +I2C>[0x1A 0xB0 0x8A] [0x1A 0xA0 0x02 0x00 0x0C]      -- Write number of settling time cycles 0x000C = 12 to registers 0x8A 0x8B (12 cycles at f_max of 12kHz will result into a delay of 12/12kHz = 1ms, which is the conversion time) 
 +I2C>[0x1A 0x80 0x11]  -- Write to the control register upper byte to initialize start frequency (0x10) and set gain to 1x with an excitation voltage of 2Vpp (0x01)
 +I2C>[0x1A 0x80 0x21]  -- Write to the control register upper byte to start frequency sweep (0x20) and set gain to 1x with an excitation voltage of 2Vpp (0x01)
 +
 +Now loop:
 +I2C>[0x1A 0xB0 0x8F] [0x1B r]  -- Read status register and check 0x02 is high (no? --> read again), check if 0x04 is high (no? --> next frequency, yes --> end of sweep)
 +I2C>[0x1A 0xB0 0x94] [0x1A 0xA1 0x04 [0x1B r:4] -- Read four bytes starting at 0x94 (2-bytes real, 2 bytes imag)
 +I2C>[0x1A 0x80 0x31]  -- Write to the control register upper byte for next frequency sweep (0x30) [or do 0x40 for same frequency in case of avaraging] and set gain to 1x with an excitation voltage of 2Vpp (0x01)
 +
 +To repeat, enter standby mode first:
 +I2C>[0x1A 0x80 0xB1]  -- Write 0xB0 to the control register upper byte to enter standby mode (0xB0) and set gain to 1x with an excitation voltage of 2Vpp (0x01)
 +To switch off, enter power down mode:
 +I2C>[0x1A 0x80 0xA0]  -- Write 0xA0 to the control register upper byte to enter power down mode (0xA0)
 +
 +I2C>p w m 1           -- to switch off the supplies and switch back to HiZ mode
 +</code>
 +
 +==== LabVIEW program ====
 +
 +
 +
 +<imgcaption LabViewAnalyzer|A program in National Instruments LabVIEW that automates the scripting to the BusPirate>{{labviewanalyzer.png?500}}</imgcaption>
 +
 +
 +
 +==== Downloads ====
 +
 +^ File ^ Program ^ Version ^ Description ^
 +| [[http://www.geertlangereis.nl/data_extra/Impedance_Spectroscopy_AD5933_LabVIEW_2018.zip| Impedance_Spectroscopy_AD5933_LabVIEW_2018.zip]] | LabVIEW 2018 |  1.0  | LabVIEW vi for an impedance sweep (polar or Bode plot) on a AD5933 using a BusPirate for I2C |
theory/digilent_pmodia.txt ยท Last modified: 2020/03/15 16:04 (external edit)