Jump to content
I2Cdevlib Forums

Wire.beginTransmission() without endTransmission


Recommended Posts

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. 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...