SLAU846B June 2023 – November 2024 MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G3105 , MSPM0G3106 , MSPM0G3107 , MSPM0G3505 , MSPM0G3506 , MSPM0G3507
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. The upper 8 bits of the count value are software programmable through the I2CTIMEOUT_CTL register. The CNTL value programmed in the I2CTIMEOUT_CTL.TCNTLA register has to be greater than 0x01 to enable the timeout feature . Please note that the low timeout configuration needs to be set only during initialization and not during active state.
The application can program the eight most significant bits of the counter to reflect the acceptable cumulative low period in a transaction. Each count is equal to a timeout period of (1 + TPR) × 12 of functional clocks FCLK where the TPR is the programmable timer period. The Timeout counter A counts for the entire time SCL is held Low continuously. When SCL is high, the Timeout counter A is reloaded with the value in the I2CTIMEOUT_CTL.TCNTLA register bit, and begins counting down from this value at the falling edge of SCL.
The BUSSCLK clock generated for the timeout counter keeps running irrespective of the programmed I2C speed even if SCL is held low on the bus.
The I2C clock low timeout period is calculated as follows:
As an example, if the BUSSCLK: clock is 20MHz and the I2C module was operating at 100kHz speed, the TPR would be equal to 19. See Section 20.2.1.1 on how TPR is calculated. One timeout period is equal to (1 / 20MHz) × ( 1 + 19) × 12 or 12µs. Programming the I2CTIMEOUT_CTL.TCNTLA register to 0xDA would translate to the value 0xDA0, because the lower 4-bits are set to 0x0. This would translate to a decimal value of 3488 clocks or a cumulative clock low period of 3488 × 12µs, or 41.856ms at 100kHz.
The TIMEOUTA bit in the I2C Controller Raw Interrupt Status (RIS) register is set when the clock timeout period is reached, allowing the controller to start corrective action to resolve the remote target state. In addition, the BUSBSY bit in the I2C Controller Status MSR register is set. This bit is cleared after I2C goes to idle or during the I2C controller reset. The status of the raw SDA and SCL signals are readable by software through the SDA and SCL bits in the I2C Controller Bus Monitor MBMON register to help determine the state of the remote target.
In the event of a timeout condition, application software must choose how it intends to attempt bus recovery. If a timeout is detected before the end of a transfer (receive or transmit), software should flush the FIFO before initializing the next transfer. The clock low timeout is needed for SMBus and PMBus implementation.