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.

MSPM0G3507: How to know and then reset if I2C SCL is held low abnormally

Part Number: MSPM0G3507

Tool/software:

Hi champs,

I am asking this for our customer.

The user uses I2C as target mode to implement PMBus 1.2.

When the I2C SCL is held low abnormally, how does the user know and then reset I2C module?

For example, the host I2C hangs and keeps held SCL low and then resets itself, but it seems MSPM0G3507 I2C target would be stuck and keep waiting because SCL is low.

Ideally, MSPM0G3507 should reset I2C module while the host I2C is resetting itself.

Is there any register for the user to check SCL status and then reset I2C module if SCL keeps low and exceeds some time?

We are aware of 

18.2.3.6 SCL Clock Low Timeout

TIMEOUTA

but still confused if and how to use it to handle this.

If TIMEOUTA can be used for this purpose, do we have an example code?

  • Method 1:

    enable I2C controller mode in this target I2C(I2C support enable controller and target mode at the same time)

    Read I2C register 20.3.39 CBMON Register (Offset = 1234h) [Reset = 00000003h] to periodically check SDA status

    Method 2:

    connect SDA to another GPIO/Timer input, using GPIO read function or Timer capture function to check SDA status.

  • Hi Helic,

    I am confused.

    Here we meant SCL rather than SDA.

    You said SDA above.

    Is that a typo or you meant a different method?

  • sorry, same method for SCL and SDA.

    It's my mistake.

  • Hi Helic,

    Since you mentioned I2C Controller mode and Target Mode can be used at the same time, we have some more questions below.

    1. TIMEOUTA can only be used in I2C controller, but cannot be used in I2C target mode. Is it right?

    2. Because TIMEOUTA can be used to detect SCL is low for a timeout time, can the user just use it (enable both I2C control and I2C target modes) to detect SCL low using TIMEOUTA interrupt for a timeout time directly as the Method 3 besides (Method 1 and Method 2 you showed above)? Or is there any concern?

  • 1. TIMEOUTA can only be used in I2C controller, but cannot be used in I2C target mode. Is it right?

    20.2.3.6 SCL Clock Low Timeout, there are description for this function here.

    2. Because TIMEOUTA can be used to detect SCL is low for a timeout time, can the user just use it (enable both I2C control and I2C target modes) to detect SCL low using TIMEOUTA interrupt for a timeout time directly as the Method 3 besides (Method 1 and Method 2 you showed above)? Or is there any concern?

    Based on the question answer in 20.2.3.6, TIMEOUA is a function of I2C target.

    The I2C target can extend the transaction by pulling the clock low to slow down communication. The I2C module
    has a 12-bit programmable counter that is used to track how long the clock has been held low.

    This is a method to monitor the SCL.

    There is another issue need to notice in Errata: https://www.ti.com/lit/er/slaz742b/slaz742b.pdf    I2C_ERR_04 is related to this question.

  • Hi Helic,

    In fact, we've read 20.2.3.6 SCL Clock Low Timeout but are still confused if it's used in Target mode or Controller mode.

    From below in TRM, it seems to imply it's used in Controller mode implicitly.

    Would you please help confirm again?

    Or it can be used in either Controller or Target Mode?

  • In fact, we've read 20.2.3.6 SCL Clock Low Timeout but are still confused if it's used in Target mode or Controller mode.

    It can be used in both T and C mode.

    Test demo for target timeout

    i2c_target_Timeout_G3507.zip

    Disable auto ACK for data, 

    I2C_INST->SLAVE.SACKCTL = 0x00000003;
    Then Target will give a long time clock stretch, then Timeout A will be triggered.
    There is a BKPT in interrupt, you will hit this breakpoint in debug.

  • Hi Helic,

    Thank you for your support.

    Besides, we found the errata did matter. After disabling it, we find it works as expected.