esp-idf-lib
esp-idf-lib copied to clipboard
ACK issue in wake up command in SCD4x component
The issue
I have tried to connect my SCD41 and I uploaded the example code to my ESP32-C3-DevKitM-1 and I got this error:
E (282) i2cdev: Could not write to device [0x62 at 0]: -1 (ESP_FAIL)
After some troubleshooting, I found out that the issue is in scd4x_wake_up
function. So I checked the datasheet and section 3.10.4 has a description where it is mentioned that this command is not acknowledged by SCD4x:
Wake up the sensor from sleep mode into idle mode. Note that the SCD4x does not acknowledge the wake_up command. The sensor idle state after wake up can be verified by reading out the serial number (Section 3.9.2).
I've checked the code for the wake up function and it's using i2c_dev_write
function, which always enables ACK, which I think is why this function fails.
Which SDK are you using?
esp-idf
Which version of SDK are you using?
v5.1.1
Which build target have you used?
- [ ] esp32
- [ ] esp32s2
- [ ] esp32s3
- [ ] esp32c2
- [ ] esp8266
- [X] other
Component causing the issue
scd4x
Anything in the logs that might be useful for us?
No response
Additional information or context
No response
Confirmation
- [X] This report is not a question nor a request for drivers.
The issue
I have tried to connect my SCD41 and I uploaded the example code to my ESP32-C3-DevKitM-1 and I got this error:
E (282) i2cdev: Could not write to device [0x62 at 0]: -1 (ESP_FAIL)
I can confirm the same error, I have to remove ESP_ERROR_CHECK around scd4x_wake_up() to make it work.