You are here

U2C_SetClockSynchTimeout()

U2C_RESULT U2C_SetClockSynchTimeout(
      HANDLE hDevice,
      WORD Timeout
);

The U2C_SetClockSynchTimeout() function configures timeout value for I2C bus clock synchronization.

Clock synchronization (clock stretching) is used in situations where I2C slave device is not able to cooperate on the clock speed provided by the U2C-12 I2C master and needs to slow down the I2C bus. I2C slave holds down the SCL line low and in that way signals the I2C master about a wait state. To avoid waiting deadlock (if some problem occurs with I2C slave device) timeout value was introduced into U2C-12 I2C interface. If I2C slave device doesn't release the clock within the given timeout interval, U2C-12 adapter returns the U2C_I2C_CLOCK_SYNCH_TIMEOUT error value.

The U2C_SetClockSynchTimeout() function doesn't enables or disables clock stretching functionality. It only changes the clock stretching timeout value. Clock stretching should be enabled with U2C_SetClockSynch() function.

[Warning]Warning
I 2 C bus clock synchronization (clock stretching) is implemented for I 2 C bus frequencies up to 100kHz. See U2C_SetI2cFreq() to learn how to change I 2 C bus frequency.

Parameters:

hDevice

Handle to the U2C-12 device.

Timeout

Clock synchronization (clock stretching) timeout value specified as multiple of 100 microseconds.

Return values:

U2C_SUCCESS

The I2C bus clock synchronization timeout value was successfully set.

U2C_HARDWARE_NOT_FOUND

U2C-12 device referenced by hDevice handle was not found.

Rating: 
No votes yet

Languages

User login