adafruit / Adafruit_CCS811

Arduino driver for CCS811 digital gas sensor
MIT License
65 stars 36 forks source link

Sensor communication crashes randomly #14

Open jgrulich opened 5 years ago

jgrulich commented 5 years ago

I'm testing the OLED Demo now. I have ESP core 2.5.2 and CCS811 lib 1.0.2 and the sensor communication fails after some time. The SDA line remains LOW and therefor blocks I2C buss. The OLED therefor stops working too. I've tested both 80MHz and 160MHz CPU freq. I've tested than basic CCS811_test demo and it fails too. To bring it working again I need to hard reset the CCS811 board.

jgrulich commented 5 years ago

Based on some info about the I2C stretching, I've tried to use this: `
Wire.setClock(100000); Wire.setClockStretchLimit(500); Wire.begin(); delay(100);

if(!ccs.begin()){

` But no change. I've tried to use another sensor and ESP boards too.

ladyada commented 5 years ago

try on a non-ESP board. ESP has somewhat unusual I2C support

jgrulich commented 5 years ago

Don't have native Arduino to test. But it's confirmed that it is the lib what is wrong. I've used this one instead and it works now for 12 hours. https://github.com/LucAce/CCS811

ladyada commented 5 years ago

thanks, can you see what is different?

jgrulich commented 5 years ago

Guess that the ccs.available() is wrongly detected, probably from the previous data read and than remains active by mistake. Than it crashes when tried to read new data too soon. It's not so easy to identify, because the other lib is much more complex and the structure of commands is different. This ccs.available() command is not implemented there and it uses this instead: while (!ccs.isDATA_READY()) { delay(1000); ccs.readStatusRegister(); }

wangmings commented 4 years ago

Have the above problems been solved?

JaySee56 commented 2 years ago

Have the same problem with a ProMini, 8MHz, IDE 1.8.13, Adafruit_CCS811.h