-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2Cdev library reports wrong data from AD7746 chip. Using same library on ESP32 #770
Comments
The AD7746 library was contributed by another user, but after looking into this, I believe I know at least part of the problem. In your test code, you are reading three bytes starting from the 2nd register address (0x01). However, in the I2Cdev library's
Actually reads registers 0, 1, and 2 instead of reading registers 1, 2, and 3. This is a quirk of the AD7764 specifically, which says on page 12 about write operations:
...and about read operations:
So if you changed the line to this:
...you might get good data. This problem will occur using the existing AD7764 library code for any reads that do not begin at register 0, because the I2Cdev doesn't actually use the repeated start condition as the device requires. This could be fixed by exposing a mechanism to use repeated start via a new argument to the |
Thanks for your prompt answer. Indeed, the repeated start is missing. This issue has been reported before. I believe I will stick to a more barebones approach with regards to the Wire library (for the time being at least) |
Hi. Thank you for the great effort put into developing this set of libraries.
I have encountered a serious issue with the
I2Cdev.h
library where the values reported from the registers of an AD7746 chip are wrong.I have implemented a
read_register
method, similar to the already existingwrite_register
method from theAD7746
library.where
data
holds the 8-bit value from the requested register.The issue is that the retrieved data is wrong. If I change the implementation to a slightly more barebones approach, I get the right values:
Please note that I made some additional modifications to the
AD7746
library, where I pass a pointer to myWire
port (since the ESP32 board has multiple I2Cs).Here is a result of the mistaken data and the correct one. Here I merged both methods into one to retrieve the Chip ID from my AD7746, however, the implementation using
I2Cdev
fails every time reporting either0x02
or0x07
every time.Pay attention to the correct Chip ID
0x51
retrieved by my implementation (confirmed through the AD7746 Eval Board GUI App) while the one usingI2Clib.h
reports0x07
. In this case, I made a code that reads all registers from0x00
to0x13
hence why there are so many lines.Similarly, retrieving the capacitance reports completely wrong values. Since the original method
getCapacitance
uses theI2Clib.h
header, I decided to make some modifications and work on my implementation that avoids using it.Once again, I get the right values by NOT using the library but rather my proposed solution
The text was updated successfully, but these errors were encountered: