Jump to content
I2Cdevlib Forums

Arduino Wire endTransmission readBytes not working

Recommended Posts


in readBytes() in I2Cdev.cpp the register to read from is written and then before reading the actual value a new transmission is started.

This is not working for the MPR121.


Currently it does this:

Wire.requestFrom(devAddr, (uint8_t)min(length - k, BUFFER_LENGTH));

Here is explained that the endTransmission is needed to actually send the regAddr.

But this is not working for the MPR121 because I guess it forgets the register you want to read from when the transmission is closed.

So on the request it always answers with the content of register 0x00.

So obviously all the mpr functions to read from special registers don't work. For example the testConnection() is not working.


It must be like this:

Wire.requestFrom(devAddr, (uint8_t)min(length - k, BUFFER_LENGTH));

Then the regAddr is sent but the connection is not closed. This way everything works fine.


It took me quite a while to figure this out. And it also made me create my own library, but I hate competing libraries :-)

So I would like to contribute this to the devlib, but I'm not experienced how to do this. Should I sent a pullrequest on github? And how could I make sure not to break the behavior with other i2c devices. I don't think it would break, but how can I be sure of this?

Since I will heavily use the mpr I will be happy to contribute some more mpr related stuff like functions and examples, I guess this could be done with pullrequests as well.


edit: The same problem seems to exist with the FastWire implementation.




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.

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.

  • Create New...