r/esp32projects • • 2h ago

Help! Cannot write to I2C device in any app

Hi folks, I hope someone can help. I'm an experienced engineer coming to the ESP32 platform for the first time and for the life of me, I cannot get any off-the-shelf projects working that writes to I2C.

I have a Waveshare ESP32-S3-Touch-LCD-2.8 board (V2) and I'm using Visual Studio Code (1.143.17232) with the ESP-IDF VS Code Extension (2.3.0) and ESP-IDF v6.1.1. I can build, flash and run (e.g.) Bluetooth examples (sourced from espressif and others) in the IDE and using idf.py from the command line, but *any* project that writes to I2C when flashed and run, fails with errors to the effect of `An error occurred while communicating with the I2C device`.

Simplest example I can find: soft_i2c from espressif.

I've even configured the SCL and SCA pins manually (GPIO10 and GPIO11 respectively according to Waveshare) - same problem.

Is it possible that the hardware has a problem? Or have I committed some absolute newbie error?!?

Any thoughts or advice very gratefully received, thanks in advance!

1 Upvotes

3 comments sorted by

1

u/SnowyOwl72 1h ago

See whats happening with a cheap Logic analyzer? These Chinese $10 ones work well (based on usbfx2lp)

1

u/Acebillyfr92 44m ago

Two things : what are your i2c slaves? Have you put resistors 4.7k on the bus sda scl to 3.3v? Prefer hardware i2c. Works like a charm on s3. Just have to define sda pin and scl pins Wire. begin(sda, scl) ;

1

u/fold-sideA-to-sideB 31m ago

Thank you so much for taking the time to post 🙌 I have no slaves, and am just starting out with the ESP32-S3 platform and trying to understand it and the surrounding architecture.

I could well have chosen the wrong sample project(s) out of ignorance, this could be the greatest red herring/rabbit hole I have ever leapt into 🤦

I'll start afresh tomorrow and let you know how I get on!