i2c

Here we can discuss about the problem found
Post Reply
Stuart
Posts: 40
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 1 time
Been thanked: 6 times

i2c

Post 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.
User avatar
PeterN
Posts: 142
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 56 times
Been thanked: 75 times
Contact:

Re: i2c

Post 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?

[External Link Removed for Guests]
[Local Link Removed for Guests]
Stuart
Posts: 40
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 1 time
Been thanked: 6 times

Re: i2c

Post 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.
User avatar
Electroguard
Posts: 276
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 55 times
Been thanked: 129 times

Re: i2c

Post 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.
Stuart
Posts: 40
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 1 time
Been thanked: 6 times

Re: i2c

Post 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.
Post Reply