Post Go back to editing

AD5252 I2C Issues

Hi there,

I was hoping to get some help with issues I am experiencing with the I2C protocol for the AD5252 chip.

I am trying to communicate with the chip using the MCP2221 chip.

For reference:

AD5252--> 50K potentiometer

AD1 is set low (0) and AD0 is set high (1)

Defualt resistance WA: 24.7K

Defualt resistance WB: 24.7K

Defualt resistance AB: 49.7K

MCP221 i2C write: 0x92

MCP2221 i2C read: 0x93

--------------------------------------------------------------------------------------------

I have setup the slave address as 0x5A--> 01011 (base address) + 01 (AD1, AD0) + 0 (W/R: write--> 01011010

I have seen other scripts that have used 0x2C (0101101) as the slave address, but it does not account for the read/write bit, granted they were using Arduino ido whereas I am using Python, so I am not sure if that would account for that discrepancy ( I am not very familiar with Arduino code structure).

For the instruction byte, I am assuming I need to write to the RDAC register in this case 00000001--> 0x01 ( CMD=0, EE=0)

I also thought to write/store the data to the EEMEM register: 00100001 --> 0x21 (CMD=0, EE=1)

Based off the formula for calculating R(WB)- based off of a value between 0-255, the user can choose the resistance (0-50K ohms).

def set_resistance(self, value: int = 255):

resWB = (value) / 256 * 50000 + 75 #simply included for expected value
bytes_out = int(value)

self.i2cWrite(0x5A, [0x01, data])
self.i2cWrite(0x5A, [0x21, data])

return (resWB)

I have tried different combinations as well trying 0x2C as a slave address due to a lack of success with 0x5A

The goal is to be able to digitally control the resistance from 0-50K. Any help would be appreciated

Best regards,

Tayeb

Parents
  • Have you checked the I2C lines on the oscilloscope? If yes, please share the scopeshots.

  • The oscilloscope is undergoing maintenance at the moment. When it becomes available I will test out the I2C lines.

    In the mean time, would you be able to indicate whether the way I am going about it (the i2c script order) is correct.

    Whether I can directly write to the RDAC register or if I have to write to the EEMEM register first.

    BTW, the "data" in the I2Cwrite code is supposed to be bytes_out.

    Thank you once again

  • You can write into the RDAC register directly. While the address frame 0x5A is correct, you need to check whether your I2C python library is appending R/W into the frame or not. That is why the need for an oscillscope to verify the digital waveforms. Further you need to check whether you have configured the I2C for the correct address width and data width.

    It does not matter which platform you are using whether Python or Arduino uno. All you need is that the I2C command for read and write are exactly as given in the datasheet, while meeting the datasheet specifications including timing parameters.

  • Thank you for all your help. 

    I was using the I2c buses on the ARD00698 microchip USB module. It turns out that the I2C bus on the 4562 were not working, causing all of the issues with the 5252.

    It took a while to repair the scope but when I checked the I2c lines on the oscilloscope it was clear where the problem was 

    I used a new module along with the 5253's I purchased because the 5252's are out of stock and the I2c protocol worked.

    Thank you once again.

    Twahidi

Reply
  • Thank you for all your help. 

    I was using the I2c buses on the ARD00698 microchip USB module. It turns out that the I2C bus on the 4562 were not working, causing all of the issues with the 5252.

    It took a while to repair the scope but when I checked the I2c lines on the oscilloscope it was clear where the problem was 

    I used a new module along with the 5253's I purchased because the 5252's are out of stock and the I2c protocol worked.

    Thank you once again.

    Twahidi

Children
No Data