Closed marcelstoer closed 2 years ago
Hi @marcelstoer
Sorry for the long delay. Do you have access to a logic analyzer or oscilloscope to see whats happening on the bus?
Do you happen to have any indication as to what might be the root cause of this with your hardware? Have you seen this before?
Bus busy may indicate clock stretching? I'm not sure if the SCD4x does clock stretching in certain cases.
When I2C communication fails, the CO2 reading I get out of readMeasurement() is 16300-something in https://github.com/Sensirion/arduino-i2c-scd4x/blob/master/examples/exampleUsage/exampleUsage.ino#L108. I think it should be internally reset to zero/0 so that your sample code would skip it.
This is a good point. But if readMeasurement
fails you actually shouldn't access co2, temperature or humidity as shown in the example. But we should initialize the values in the example anyways.
Thanks for your feedback Raphael. I don't have access to the device anymore as I've since given it away, sorry. Unfortunately, I don't have access to a logic analyzer either yet (currently being shipped to me). Hence, the point of raising this issue was simply to see if it's an issue you had come across before.
if
readMeasurement
fails you actually shouldn't access co2, temperature or humidity as shown in the example
Absolutely. I didn't analyze why the uninitialized co2
value becomes 16300-something in case of error. To be on the safe side I am now skipping CO2 readings outside the [1,10'000] range.
https://github.com/Sensirion/arduino-i2c-scd4x/blob/f055511173928e380a2d2b722f93ac7ce8db544a/examples/exampleUsage/exampleUsage.ino#L110
Occasionally
readMeasurement()
prints "Received NACK on transmit of address" or "Wrong CRC found" on one of my test devices. It's a SEK-SCD41 kit connected to an ESP32 using the excellent wires that come with the kit.These errors are accompanied by ESD-IDF I2C messages when it's a NACK issue, and only then:
Do you happen to have any indication as to what might be the root cause of this with your hardware? Have you seen this before?
When I2C communication fails, the CO2 reading I get out of
readMeasurement()
is 16300-something in https://github.com/Sensirion/arduino-i2c-scd4x/blob/master/examples/exampleUsage/exampleUsage.ino#L108. I think it should be internally reset to zero/0 so that your sample code would skip it.