I am porting an existing working project from a Wemos D1 to the Arducam ESP-uno board.
The I2C bus is scanned on power up and any devices found reported to the serial console. When running the code on the Arducam ESP-uno board the devices are not detected. Running the same code on the Wemos works fine.
Both boards use the same pins 21 + 22 as SDA + SCL respectively, both boards have pins 21 + 22 in same physical location.
What I get is the following error…
[E][Wire.cpp:513] requestFrom(): i2cRead returned Error 263
What am I missing? It appears as if the pins are incorrect but all of the documentation I can find shows them as correct.
Here’s the code that I’m using to scan the I2C bus.
Further to the above. The previously noted error actually comes from the code immediately following the scan where it attempts to communicate with an ADS1115. But the root cause is the same in both cases. It cannot see anything on the I2C bus.
I modified the above code as follows to print out the error received on each iteration of the for loop…
5 is a ‘STOP’ error which is described as a ‘Timeout waiting for stop condition to be detected’. There’s a further description of the bus transactions as follows…
“Once the device has successfully written all the data it wants to send to the peripheral (or read back all the data that it requested), it signals the completion of the transaction with a stop condition: while SCL is high, SDA is released to go high too (the waveform has a rising edge). This releases the bus for other devices to make use of it. Again, the device checks that this stop signal has been sent correctly. If it has not, then this error will be issued.”
I have read elsewhere about issues with SDA being held low by the Arducam. I suspect that this is a similar issue although the cause may be of my own doing and related to the pullup resistors as after reviewing the shield these are missing. I suspect that the Wemos board had the SDA and SCL lines tied high somewhere which masked the omission of the pullup resistors.
I’m now wondering if this is a compiler issue. I’m using vscode / platformio and have the board set to ESP32DEV which always worked on the Arduino platform albeit I’ve not previously used I2C on this board before. The project compiles and uploads fine but I’m thinking that perhaps the I2C aspect of the firmware is different. The big issue here is that I cannot find any info on how to set up the Arducam ESP32 Uno board in platformio.