bechtold Posted November 8, 2014 Report Share Posted November 8, 2014 Hi, 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.beginTransmission(devAddr); Wire.write(regAddr); Wire.endTransmission(); Wire.beginTransmission(devAddr); 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.beginTransmission(devAddr); Wire.write(regAddr); Wire.endTransmission(false); 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. Cheers bechtold Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.