This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TPL1401: Writing TPL1401 registers

Part Number: TPL1401


Tool/software:

Good afternoon,

I'm having trouble initializing TPL1401 digital potentiometer, specifically trying to write GENERAL_CONFIG register and DPOT_POSITION register. Let me add some more context.

Like in my previous post I'm using e2_studio programming IDE, and I'm using synergy S7G2 micrcontroller, e2_studio provides low-layer drivers that controls in the background I2C addressing + R/W! bit, meaning you specify a 7 bit device address and then, depending on which method user uses (write/read), R/W! bit is set to 1 or 0 :

Reading TPL1401 datasheet, Address Byte is 8 bit long, AD6 AD5 AD4 AD3 AD2 AD1 AD0 R/!W, acording to datasheet first 4 bits are fixed (1001), following 3 bits depend on A0 pin, since I'm controlling 16 TPL1401 I have all possibilities:

000

001

010

011

Lastly, as mentioned before R/W! which is controlled using I2C low-layer methods. Knowing I have to set an Slave Address, all possible combinations are the following:

0x48 (1001 000) 7 bit long

0x49(1001 001) 7 bit long

0x4A(1001 010) 7 bit long

0x4B(1001 011) 7 bit long

If I want to perform I2C Update Sequence I need to send Address Byte + Command Byte + MSDB + LSDB (32bits), e2_studio manages first 8 bits in the background, so me as user i only have to send 24 bits.

If I want to perform I2C Read Sequence I need to send Address Byte + Command Byte(write request), then send a read request and store whatever TPL1401 returns.

Now, I could validate reading TPL1401 STATUS register and GENERAL_CONFIG register. When I try to read mentioned devices I get the following:

STATUS : 0000 0000 0001 0100 --> 0x14 which matches device_id[5:2] value

GENERAL_CONFIG: 0000 0001 1111 0000 -> which matches default configuration, DPOT_PDN[4:3] field is initialized to 10 (Power down to high impedance)

I assumed because of this I'm not able to write/read DPOT_POSITION register, so the logic thing would be to set DPOT_PDN[4:3] to 00: Power Up, problem is when I try to write this register it doesn't seem to be able to set desired value.

GENERAL_CONFIG is 16 bit long, so I assumed the correct register configuration would be 0000 0001 1110 0000, this can be placed inside a uint8_t array of two positions, for example

//TEST

data = 0xE0;

uint8_t i2c_data[2] = {0x01, data}; // MSB = 0x00, LSB = data

 

When I call my i2c method it seems to be performed correctly, but when I try to read the register it is still the same as the beginning, no changes are applied, so I'm wondering what I could be missing, I can provide the whole code if necessary.

In resum, my write petition is 24 bit long, Command Byte + MSB + LSB, but when reading same register value stays unchanged.

Greetings,

  • Hi Guillem, 

    Every register is 16-bits. It is a good sign that you can successfully read the STATUS register and the GENERAL_CONFIG register. Can you measure SDA and SCL during the write sequence to the DPOT_POSITION register and share a screenshot so I can verify that everything looks correct. Your assumption is correct, the total 16-bit write can be split into two uint8_t arrays. 

    Best,

    Katlynne Jones

  • Hi Katlynne,

    Thank you for your answer, today checking my code I realized I was using two i2c_write calls to send command byte + MSB + LSB, each call was 1 byte and 2 byte. Since Renesas OS controls first 8 bits I wasn't realizing everytime I was calling i2c_write method I was sending all over again device address. I tried sending all 3 bytes in the same call and I was able to write GENERAL_CONFIG register.

    Guess this solves the issue, thank you for your time!