WT32 ET01 issue with MCP23017

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
phillip89
New user
Posts: 6
Joined: 22 Jul 2023, 13:12

WT32 ET01 issue with MCP23017

#1 Post by phillip89 » 22 Jul 2023, 13:41

Hello,

I'm using ESP easy for different projects for a while together with IOBroker. I've started a new project were I need at least 10 GPIO's and an ethernet connection, therefore I have flashed ESP Easy to an WT32 ETH01 board and everything works as usual. However I'm not able to get the MCP23017 running correctly.

MCP connections:
PIN 12 SCL -> ESP IO14
PIN 13 SDA -> ESP IO15
PIN 15 -> ESP GND
PIN 16 -> ESP GND
PIN 17 -> ESP GND
PIN 18 -> ESP 3,3V
PIN 28 GPA7 -> Relais Board Input

I have followed the instructions on
https://espeasy.readthedocs.io/en/lates ... /P009.html

I2C Address set to 0x20
For Port I have tried several Ports, ie. PA0, PA7
I have enabled the device

I2C Scan in the Tools section shows an connected device with the 0x20 address

However trying to switch the states of the MCP GPIOs doesn't work.
I have played around with MCPGPIO,7,0 // ,7,1 // ,8,0 // ,6,0....

sometimes I got 'failed' messages, sometimes it shows a change of state, sometimes it sets the status to -1.

I also tried to use different GPIOs on the MCP, I've tried another MCP23017, I have changed the relais board to an simple LED but I cannot get this running.

Somewhere is a mistake which I'm not able to find, I hope someone can assist.

THANK YOU!

BR
Phillip
Last edited by phillip89 on 22 Jul 2023, 14:27, edited 1 time in total.

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: WT32 ET01 issue with MCP23017

#2 Post by Ath » 22 Jul 2023, 14:02

The plugin you are pointing at is intended for getting input from a MCP GPIO pin, not for enabling output. In fact, by enabling that plugin, the pin is configured to be used as an input pin.

You will have to send a command, like you mention already, to set a pin on or off. By using the command MCPGPIOToggle,<pin> you can easily flip the state from on to off, or off to on. That's the easiest way of checking if it works as expected.

NB: The pin connections are somewhat confusing, not sure why you connect so many GND pins to the ESP, there won't be flowing big currents here ;)
And the pin numbers on the MCP23017 side may differ from board to board, best is to only mention the signal labels like SDA, SCL etc.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WT32 ET01 issue with MCP23017

#3 Post by TD-er » 22 Jul 2023, 14:05

See: https://espeasy.readthedocs.io/en/lates ... e-on-esp32

As stated there, both pins you picked for I2C will output some bogus signals at boot.
Not sure which one you set as SDA and SCL as you copy/pasted the same SCL ;)

Since I2C is a bit odd in that the clock can be just about anything from near DC signal to the max. frequency for the connected devices, you may end up in a completely unknown state right after boot..

phillip89
New user
Posts: 6
Joined: 22 Jul 2023, 13:12

Re: WT32 ET01 issue with MCP23017

#4 Post by phillip89 » 22 Jul 2023, 14:32

Not sure which one you set as SDA and SCL as you copy/pasted the same SCL ;)
Ups, I've corrected it, thx :-)
As stated there, both pins you picked for I2C will output some bogus signals at boot.
Alright, so I better should use other Pins?! Then I will check which ones are available and not in use due to Ethernet.
Thanks for the links to the pinout

NB: The pin connections are somewhat confusing, not sure why you connect so many GND pins to the ESP, there won't be flowing big currents here ;)
Well as I understood, the way you connect the Pins 15-17 will set the I2C address on the MCP, for 0x20 all three pins have to be on GND. Or am I wrong?
You will have to send a command, like you mention already, to set a pin on or off. By using the command MCPGPIOToggle,<pin> you can easily flip the state from on to off, or off to on. That's the easiest way of checking if it works as expected.
Okay I will try to use that command instead and see what will happen.


Thank you both in advance!!!

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: WT32 ET01 issue with MCP23017

#5 Post by Ath » 22 Jul 2023, 14:48

phillip89 wrote: 22 Jul 2023, 14:32 Well as I understood, the way you connect the Pins 15-17 will set the I2C address on the MCP, for 0x20 all three pins have to be on GND. Or am I wrong?
AFAIK, 0x20 is the default address for this chip, even when nothing is connected (internal pull-down).

besides MCPGPIOtoggle, you can also use the MCPGPIOrange,<start>,<end>,<state> command like mcpgpiorange,0,255,1 to switch on all pins and see if the device responds at all 8-)
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WT32 ET01 issue with MCP23017

#6 Post by TD-er » 22 Jul 2023, 14:53

You don't have a lot of pins left over on the WT32-ETH01.
And keep in mind that GPIO 34-39 are input-only.
I suggest to at least have the SCL connected to a pin that doesn't show PWM signals at boot up.
For the SDA this is less of a problem.

Also some pins have (and need) a pull-down resistor, which makes them unusable for I2C.

GPIO-12 is also made available on that board, but keep in mind to NEVER! have that pin pulled-up or -down as the state of that pin during boot determines the voltage applied to the flash chip.
So either you end up with a module not booting, or burning up the flash chip when having the wrong state present on your board.
You could measure the default state, to see if that specific board you're having is either configured with a pull-up or -down resistor, so you might be able to use it if it is intended to have a pull-up resistor.
Just make sure no connected device will ever pull it down during boot.

phillip89
New user
Posts: 6
Joined: 22 Jul 2023, 13:12

Re: WT32 ET01 issue with MCP23017

#7 Post by phillip89 » 23 Jul 2023, 14:48

Thank you both for the tips.
I've tried to follow them, changing the Pins first as you suggested, however ESPeasy tells me now, that no I2C device can be found.
Even going back to my initial GPIO pins doesn't help, I'm not getting the MCP23017 connected anymore :(

Any thoughts?

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WT32 ET01 issue with MCP23017

#8 Post by TD-er » 23 Jul 2023, 15:15

Which pins are you now using for I2C?
Do these have a pull-up resistor present?
Something like 4k7 or 10k between 3V3 - SDA and 3V3 - SCL.

phillip89
New user
Posts: 6
Joined: 22 Jul 2023, 13:12

Re: WT32 ET01 issue with MCP23017

#9 Post by phillip89 » 23 Jul 2023, 15:24

Now I'm using
SCL -> ESP IO14
SDA -> ESP IO15

again as it worked in the beginning.
I haven't attached any resistor to it.

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WT32 ET01 issue with MCP23017

#10 Post by TD-er » 23 Jul 2023, 15:37

And not mixed up SDA and SCL while soldering?
You could simply test this by swapping those in the settings in ESPEasy.

phillip89
New user
Posts: 6
Joined: 22 Jul 2023, 13:12

Re: WT32 ET01 issue with MCP23017

#11 Post by phillip89 » 23 Jul 2023, 15:47

I haven't soldered anything yet, as I'm using a breadboard at the moment to test things first.
I double checked the connection with the ESP easy settings and it matches.

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WT32 ET01 issue with MCP23017

#12 Post by TD-er » 23 Jul 2023, 15:52

Hmm sounds like some I2C device on your bus is then blocking stuff.

First thing would be to completely power cycle everything on that board and maybe also remove and re-insert all (4) wires related to this MCP chip:
3V3
SDA
SCL
GND

Just to be sure the wires are all plugged in well and no bogus setting is left in a chip due to some capacitor keeping its charge.

Do you have any other I2C device to check whether the MCP chip may have received some damaging (static) discharge?

phillip89
New user
Posts: 6
Joined: 22 Jul 2023, 13:12

Re: WT32 ET01 issue with MCP23017

#13 Post by phillip89 » 23 Jul 2023, 16:15

I have switched everything off, wired everything from scratch and checked with mulimeter if all connections are working correctly.

I got the same result.

The only I2C devices I have are these MCP23017, as I bought a pack of 5, I tried a different one, still the same result...

Really strange this behaviour as ESP easy recognized the MCP yesterday...

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 34 guests