Closed caternuson closed 3 years ago
This seems like it is also related to reset behavior.
Here's a trace for a case that works as expected:
RED = reset()
, GREEN = startContinuousMeasurement()
There's no hiccup between the call to reset()
and the next call to startContinuousMeasurement()
. Neat....but...wait....zoom in on that reset()
call, enhance:
The reset call failed! It NAK'd after sending the first byte of the reset command, 0xD304
. Not sure why that happens, but it does not reset as a result.
Here's a trace for a case that fails: CYAN = "the hiccup"
And zooming in on reset call:
In this case, the reset command actually went through. So it did its reset, made the weird hiccup, and the next I2C traffic is wonky.
The serial debug feature of the BusIO library is pretty handy. Here's the serial monitor output for the same cases above with that enabled.
WORKS (reset fails)
Adafruit SCD30 test!
I2CWRITE @ 0x61 :: 0xD3, 0x4,
Failed to send!
I2CWRITE @ 0x61 :: 0x0, 0x10, 0x0, 0x0, 0x81,
I2CWRITE @ 0x61 :: 0x46, 0x0, 0x0, 0x2, 0xE3,
SCD30 Found!
Measurement Interval: I2CWRITE @ 0x61 :: 0x46, 0x0,
I2CREAD @ 0x61 :: 0x0, 0x2,
2 seconds
I2CWRITE @ 0x61 :: 0x2, 0x2,
I2CREAD @ 0x61 :: 0x0, 0x1,
Data available!
I2CWRITE @ 0x61 :: 0x3, 0x0,
I2CREAD @ 0x61 :: 0x44, 0xAC, 0xA, 0x1E, 0x28, 0xBD, 0x41, 0xD6, 0x5E, 0x24, 0x60, 0x65, 0x41, 0xF4, 0xBA, 0x6B, 0xE0, 0xF,
Temperature: 26.77 degrees C
Relative Humidity: 30.55 %
CO2: 1376.942 ppm
I2CWRITE @ 0x61 :: 0x2, 0x2,
I2CREAD @ 0x61 :: 0x0, 0x0,
I2CWRITE @ 0x61 :: 0x2, 0x2,
I2CREAD @ 0x61 :: 0x0, 0x0,
I2CWRITE @ 0x61 :: 0x2, 0x2,
I2CREAD @ 0x61 :: 0x0, 0x0,
FAILS (reset works)
Adafruit SCD30 test!
I2CWRITE @ 0x61 :: 0xD3, 0x4,
I2CWRITE @ 0x61 :: 0x0, 0x10, 0x0, 0x0, 0x81,
Failed to send!
Failed to find SCD30 chip
wanna do same thing as before, skip reset?
@ladyada yah, tried that and it didn't seem to work as well here. still got the works / doesn't work / works / doesn't work cycle with each upload.
Gonna call this nominally fixed for now based on response in thread linked in first post.
This looks inconsistent with the approach taken in the CircuitPython library. It has a 100ms pause after reset()
And that reset()
is not called in __init__()
.
Is this causing an issue?
None that I'm aware of. I've not used this device myself.
Re this thread: https://forums.adafruit.com/viewtopic.php?f=19&t=175159
I can recreate this using the test example sketch: https://github.com/adafruit/Adafruit_SCD30/blob/master/examples/adafruit_scd30_test/adafruit_scd30_test.ino
It may initially work:
but by simply re-uploading the sketch and re-opening serial monitor:
Re-upload it again and it's back to working, etc.