dennisma Posted May 16, 2014 Report Share Posted May 16, 2014 I have been experiencing hanging and have been going through the code attempting to resolve it. I noticed in the I2Cdev::readBytes() method that the implementation for Arduino versions > 100 there is a call to Wire.beginTransmission() without a subsequent call to endTransmission(). For Arduino < 100 it is there. You can see this starting on line 280: Wire.beginTransmission(devAddr); Wire.requestFrom(devAddr, (uint8_t)min(length - k, BUFFER_LENGTH)); for (; Wire.available() && (timeout == 0 || millis() - t1 < timeout); count++) { data[count] = Wire.read(); #ifdef I2CDEV_SERIAL_DEBUG Serial.print(data[count], HEX); if (count + 1 < length) Serial.print(" "); #endif } } Also I've never seen requestFrom called from within a beginTransmission/endTransmission block. Maybe it will cause no problems but this seems to be where I hang often. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.