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.

TPS65987D: I2C sample code to perform dynamic control

Part Number: TPS65987D


Hello,

I would like you to confirm whether you have sample code to control TPS65987D by using external i2c host.

I know you have application customization tool for developing TPS65987D. But, since I also want to control TPS65987D dynamically, I asked about above.

BR,

  • Hello Prajith-san,

    Thank you for your reply.

    >You can find pseudo code in https://www.ti.com/lit/an/slvae21a/slvae21a.pdf?ts=1602677995950&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FTPS65987D 

    I also confirmed this doc. But it seems that this doc include how user can update external SPI flash by using I2C.(This means TPS65987D receive ASC command via I2C and convert it to SPI which this device has.)

    It seems that there is no description about how user can access internal SRAM via I2C. Do you NOT have this example code ?

    Best Regards 

  • Hello,

    Could you please give your feedback ?

    Best Regards,

  • Hi Ryuuichi-San,

    We do not have sample code for I2C interaction w/ PD controller. I have prepared some guidelines for you, please find it below.

    At a high-level, the I2C interaction is based on interrupt events (INT.EVENTx you can find all available events in TRM). PD controller assert IRQn signal when the interrupt event occurs (to alert MCU). MCU shall read interrupt event registers to identify and clear the interrupt event. 

    1. Register interrupt

    Code snippet for registering VMDReceived (I2C1) interrupts as below:

    //Register interrupts

    0x16 IntMask1: Interrupt mask bit field corresponding to IntEvent1

     //set bit 11(INT_EVENTx.VDMReceived) in 0x16

    uint8_t     indatamask[MAX_BUF_BSIZE] = {0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

    retVal = WriteRegP1(pData->mask_reg, REG_LEN_INTMASK1, &indatamask[0]);

    RETURN_ON_ERROR(retVal);  

    retVal = WriteRegP2(pData->mask_reg, REG_LEN_INTMASK1, &indatamask[0]);

    RETURN_ON_ERROR(retVal);

     2. Identify interrupt event and port by reading 0x14 (I2C1)

    0x14 IntEvent1: Interrupt event bit field for I2C_IRQ1 (output is low if any bit in this register is set).

    Read interrupt event register 0x14 of both ports to identify interrupt event and interrupt source (Port-0/Port-1)

    3. Clear interrupt

    //clear interrupts

    0x18 IntClear1: Interrupt clear bit field for IntEvent1. Bits set in this register are cleared from IntEvent1

    uint8_t     indataclear[MAX_BUF_BSIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

    retVal = WriteRegP1(pData->clear_reg, REG_LEN_INTCLEAR1, &indataclear[0]);

    RETURN_ON_ERROR(retVal);

    retVal = WriteRegP2(pData->clear_reg, REG_LEN_INTCLEAR1, &indataclear[0]);

    RETURN_ON_ERROR(retVal);

    This code snippet shows how to clear all interrupts. Similarly, you can selectively clear an interrupt after that particular event occurs. 

    Thanks

    Prajith

  • Hello Prajith-san,

    Thank you for your reply.

    Let me confirm about following two.

    1.

    According to TRM of TPS65987D(I am refering "slvubh2b.pdf"), byte 10 of bit 11 is defined "reserved"

    How can I understand byte 10 of bit 11 is defined "VMDReceived" ?

    uint8_t     indatamask[MAX_BUF_BSIZE] = {0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

    2.

    I understood that you do not have any sample code for i2c.

    However, in case of Application customization tool, user can access internal SRAM via i2c.

    If you have any document about how to access SRAM ?

    Best Regards,

  • Hello,

    1. This is a pseudo code for your reference. You can follow the sequence to use any of the I2C interrupt events mentioned in the TRM.

    2. No, we do not have a document for that. You can sniff the I2C bus and implement the same. May I know why you want to access SRAM? 

    Thanks
    Prajith 

  • Hello Prajith-san,

    Thank you for your reply.

    For 2,

    >You can sniff the I2C bus and implement the same.

    You mean that I should use analyzer tool such as beagle to sniff i2c bus ?

    >May I know why you want to access SRAM? 

    When user use custom board with binary file which user create by using application customization tool, if user use flash ROM, there is possiblity user need to repeat "write Flash" <=> "reboot" to adjust setting.

    If user can access SRAM directly, user do not need to perform reboot or may not need to perform power up sequence. This sequence is very useful.

    Best Regards,

  • Hi Ryuuichi-San,

    Got it. For reboot, you can send GAID command to PD controller. 

    Unfortunately, we don't have a document for SRAM access. 

    Thanks

    Prajith