Page 1 of 1

i2c

Posted: Sat Oct 23, 2021 9:05 pm
by Stuart
I'm struggling to get a simple i2c thing working on an esp32. I'm using pins2 (sda) and 15 (scl). Is there any reason why this won't work?

Also, it is very hard to search for i2c in this forum as the system won't allow short search terms!

Stuart
I'm back after a break over the summer as lots of other things to do.

Re: i2c

Posted: Sat Oct 23, 2021 10:35 pm
by PeterN
Hi Stuart,

seems that at GPIO15 there is a PWM signal at startup. Does that cause your problem?
Why can't you take gpio 21 and 22 for I2c?

https://randomnerdtutorials.com/esp32-p ... nce-gpios/
[Local Link Removed for Guests]

Re: i2c

Posted: Sun Oct 24, 2021 10:10 am
by Stuart
Thanks for the suggestion. I'm not using the pins 21/22 as they are used for my display. It is clearly stated in various places that 'almost any' GPIO pins can be used. Unfortunately, 'almost' isn't defined but certainly includes the flash circuitry. I will explore your point about PWM.

Re: i2c

Posted: Sun Oct 24, 2021 11:26 am
by Electroguard
If your display is already using 21 and 22 then maybe it's an i2c OLED or similar, in which case you can connect additional items to the existing i2c pins.

If the new module isn't working then no pins will work, whereas if you know the module is working then finding suitable pins is easier... so it might be useful to temporarily re-purpose 21 and 22 (which you know are working) to test your i2c module while using wlog to check output.
Don't forget to use 4.7K i2c pullups if the new module doesn't already include them.
And don't forget that adding resistors to control pins such as gpio0, gpio2, TX, RX, EN, RST etc can affect their operation.

Re: i2c

Posted: Tue Oct 26, 2021 9:05 pm
by Stuart
Well after some rejigging it turns out that the module was a dud. Possibly caused when I changed the header, though it seems physically OK. Now working with a spare.