Does the Jetson nano i2c support clock stretching(with ADC MAX11614)?

Hello,

When Jetson nano reads data from ADC MAX11614 device with i2c, clock stretching function is required.
Does the Jetson nano i2c support clock stretching?

Thank you.

For the kernel driver about the clock stretching support, we have added a timeout logic in our Tegra driver to avoid the system hang if the transaction fails. The timeout logic in the release code is as follows.
File - $TOP/kernel/kernel-4.9/drivers/i2c/busses/i2c-tegra.c

static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, u8 *buffer,
                u32 tx_len, u32 rx_len)
{
...
        if ((tx_len > I2C_PIO_MODE_MAX_LEN || rx_len > I2C_PIO_MODE_MAX_LEN) &&
                        i2c_dev->tx_dma_chan && i2c_dev->rx_dma_chan) {
                if (i2c_dev->curr_direction & DATA_DMA_DIR_TX) {
                        time_left = wait_for_completion_timeout(
                                        &i2c_dev->tx_dma_complete,
                                        TEGRA_I2C_TIMEOUT);
...
}

The above example is for DMA transfer from master to slave but the same API has the other wait_for_completion calls for DMA receive from slave to master and PIO mode.
The TEGRA_I2C_TIMEOUT is a compile-time macro. This can be tuned to get the desired response. The default value supported is 10s or 10000ms.
In the case of a timeout scenario, the i2c controller is reinitialized to bring the i2c lanes and the controller to a sane state.

1 Like

Hello,

It seems that clock stretching is supported, is that correct?

Thank you.

Suppose yes.

1 Like

Hello,

Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.