Hi,NXP
We attempted to leverage the I2C_MASTER_EVENT_PIN_LOW_TIMEOUT event to implement recovery for a slave device that holds SDA low. During testing, we observed that the pin-low timeout interrupt is turned off once a transfer completes or an abnormal condition is detected.
Hello @wuxianlong ,
Thank you for the detailed description and for pointing to the driver code.
Your observation is correct: in the current RTD implementation, LPI2C_IP_MASTER_PIN_LOW_TIMEOUT_INT is enabled as part of the master transfer interrupt handling and it is disabled again when the master transfer is ended. This means that the RTD driver does not keep this interrupt enabled as a permanent bus-monitoring mechanism after transfer completion.
From the hardware point of view, the S32K3 LPI2C module supports the pin-low timeout feature. The timeout threshold is configured by MCFGR3[PINLOW], and the MSR[PLTF] flag can be set when the selected SCL or SDA line remains low longer than the configured threshold. The reference manual also states that this flag can be set even when the LPI2C controller is idle.
However, this hardware capability does not necessarily mean that the RTD driver keeps the corresponding interrupt enabled continuously. The current RTD implementation appears to manage this event in the context of an active master transfer.
For continuous I2C bus monitoring after transfer completion, the recommended approach is to handle this at the application level, for example by checking the MSR[PLTF] status as part of the bus recovery logic. Please also note that the pin-low condition itself must be resolved by software. The PLTF flag cannot be cleared while the low condition is still present, and it must be cleared before a new START condition can be generated.
Best regards,
Pavel