Open khogeland opened 2 years ago
The esp-lib
has given me lots of headaches with I2C. It looks like you have sda_pullup_en
and scl_pullup_en
disabled. NVM, you said you tried out different configurations.
There's a few things to try. I had a lot of difficulty with I2C on esp-lib
which is what Nesper wraps around. AFAICT, it's with the esp-lib
itself and not the Nesper wrappers. The Arduino libraries define a pretty sane set of defaults for dealing with NACK
and ACK
's while the esp-lib
version are much lower level.
I actually moved to using esp-idf-lib
I2C drivers in my latest Nesper projects because it was more reliable. They wrap the ACK
/NACK
's for you and it works for most proper I2C devices. You can see an example on the devel
branch here.
100_000.Hertz
which is a bit slow for some devices, they sometimes prefer 400_000.Hertz
ACK
vs LAST_NACK
can be the difference. Most devices do a NACK
on the final read byte writeByte
where you may need to do a writeByte(ack=false)
Also, you might consider trying Nephyr as it supports a lot of ESP32 features but is much more stable. It's what I'm using these days for new projects. :-)
Though for Nesper I'd recommend the esp-idf-lib
I2C driver as the way to go.
I'm trying to use a peripheral from Adafruit which communicates over I2C. The same setup works fine with their Arduino library. I copied the protocol from there, and I can't see anything wrong with my implementation, but it doesn't work via Nesper 🤷♂️ I've tried messing with the clock speed, different pins, different pullups, etc. I can tell there's some communication happening, because any other address hangs the system (wish I had an oscilloscope), but all I get is
0xFF
back for every byte for every register I try.Any ideas? Am I doing something wrong?