I2C Slave on ESP32 Returns 'endTransmission: 4'
Posted: Mon Dec 09, 2024 4:20 pm
I am working on an ESP32-based I2C Slave that communicates with a ESP32 Master device. The system involves receiving commands from the Master (e.g., "ON" or "OFF") to control an LED and sending back responses such as "LED ON" or "LED OFF" i.e., current status of LED. The functionality works, but the I2C communication intermittently reports an error:
endTransmission: 4
This is my current output from the Slave:
17:06:28.410 -> Received command: OFF
17:06:28.410 -> LED turned OFF
17:06:31.402 -> Sent response: LED OFF
17:06:31.402 -> endTransmission: 4
17:07:01.441 -> Received command: ON
17:07:01.441 -> LED turned ON
17:07:04.441 -> Sent response: LED ON
17:07:04.441 -> endTransmission: 4
The Slave successfully receives commands from the Master and executes them (e.g., turning the LED ON or OFF).
But, it sends responses back to the Master, but the error persists intermittently. How can I debug or eliminate the endTransmission: 4 error in this setup?
endTransmission: 4
This is my current output from the Slave:
17:06:28.410 -> Received command: OFF
17:06:28.410 -> LED turned OFF
17:06:31.402 -> Sent response: LED OFF
17:06:31.402 -> endTransmission: 4
17:07:01.441 -> Received command: ON
17:07:01.441 -> LED turned ON
17:07:04.441 -> Sent response: LED ON
17:07:04.441 -> endTransmission: 4
The Slave successfully receives commands from the Master and executes them (e.g., turning the LED ON or OFF).
But, it sends responses back to the Master, but the error persists intermittently. How can I debug or eliminate the endTransmission: 4 error in this setup?