i2c: increase read/write timeout

The sht21 temperature and humidity sensor holds the i2c bus while
an ADC conversion is in progress. For example, a temperature
measurement is requested, a read operation is started, and the
sht21 doesn't respond to the read request until the result of
the measurement is ready. The conversion time isn't constant.
On rare occations (one in hundreds of samples) the timeout in the
i2c driver expires returning an error.

The example code from Sensirion, the sht21's manufacturer, suggests
a bus timeout of 1 second to accommodate the sht21. This commit
increases the bus timeout to 1 second. The timeout is only reached
when chips do not respond normally, so the change doesn't affect the
performance of any other drivers.

Change-Id: I57b0f958a5d0b69b221af380b771fe67401ff604
This commit is contained in:
Thomas Cort 2013-09-16 19:16:12 -04:00
parent 75bd3009d3
commit cb5e2921b3

View file

@ -319,8 +319,8 @@ omap_i2c_poll(uint16_t mask)
spin_t spin; spin_t spin;
uint16_t status; uint16_t status;
/* poll for up to 250 ms */ /* poll for up to 1 s */
spin_init(&spin, 250000); spin_init(&spin, 1000000);
do { do {
status = omap_i2c_read_status(); status = omap_i2c_read_status();
if ((status & mask) != 0) { /* any bits in mask set */ if ((status & mask) != 0) { /* any bits in mask set */