-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[I2C] TI HDC2080 temp/humidity sensor not working over ESP32 I2C interface #2597
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
Comments
@pwntr There is an error in your library. I just glanced through it, and found one error in the Chuck. uint8_t HDC2080::readReg(uint8_t reg)
{
openReg(reg);
uint8_t reading; // holds byte of read data
Wire.requestFrom(_addr, 1); // Request 1 byte from open register
Wire.endTransmission(); // Relinquish bus control
if (1 <= Wire.available())
{
reading = (Wire.read()); // Read byte
}
return reading;
} the uint8_t HDC2080::readReg(uint8_t reg)
{
openReg(reg);
uint8_t reading; // holds byte of read data
Wire.requestFrom(_addr, 1); // Request 1 byte from open register
if (Wire.lastError() != I2C_ERROR_OK){
log_e("Request from failed reg=%d, err=%d(%s)",reg,Wire.lastError(),Wire.getErrorText(Wire.lastError()));
reading = 0;
}
else {
reading = Wire.read();
}
return reading;
} |
@stickbreaker thank you SO much for the quick and thorough help with this! It works flawlessly, with 1.0.1 and 1.0.2 rc1. You, sir, deserve a 🥇.
For anyone interested, the revised lib that contains the changes can now be found right here. |
Hardware:
Board: ESP32 dev module, home brew PCB
Core Installation version: tested 1.0.1 and 1.0.2 rc1. < 1.0.0 works
IDE name: Arduino IDE and PlatformIO
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10, Max OS X 10.13, Ubuntu 18.04
Description:
Using current versions of the esp core (> 1.0.0) results in bogus sensor data returned/interpreted for the HDC2080 from TI. Other sensors (Bosch BME280, BME680, both on their own breakout board externally) work fine on the same board (attached via SDA and SCL breakout pins) and with the current cores.
All things being equal (hardware, OS, libraries, IDEs), using an old core from January 2018 (relevant I2C files attached, exact version number hard to determine...?), the HDC2080 and the other sensors work as expected. Only the cores > 1.0.0 break functionality for the HDC2080 (after @stickbreaker changes were merged?).
Old I2C core files that I suspect to be relevant: oldcore_jan2018.zip
Cross-checking with the same sketches and libraries on an Arduino Nano clone, all three sensors work right away, (attaching the SDA and SCL pins on my board to A4 and A5 on the Nano to use it as a slave breakout board of sorts). Here are the relevant sections of the pcb (sensor and pullups in the upper left, SDA and SCL breakout pins lower right.):

I tested various pullup resistors on SDA and SCL (2.7k, 6.7k, 10k), all with the same result: old core works fine, newer core returns bogus data from HDC2080.
Sketch:
HDC2080 Arduino library: HDC2080.zip
I ordered a logic analyzer to further submerge myself into the I2C rabbit hole. Currently I can't make any sense out of this behavior. Please let me know how I can help with the investigation.
This issue seems related based on the symptoms: #2408
Thanks a ton for your help :)!
Debug Messages:
Arduino Nano with ESP32 home brew pcb attached OR ESP32 home brew board standalone with the old core release (working fine after the first reading, desired target output basically):
ESP32 home brew board with core v. 1.0.1 stable (verbose):
ESP32 home brew board with core v. 1.0.2 dev (verbose, #define ENABLE_I2C_DEBUG_BUFFER in enabled in esp32-hal-i2c.c):
The text was updated successfully, but these errors were encountered: