Trouble with the MCP23xxx module #4582
Replies: 1 comment
-
Posted at 2018-01-16 by @allObjects I did quite extensive work on the MCP23017... the only challenge I faced was a spike when I added interrupt extension caused by Espruino pin mode change. This is now though fixed (1v95). I started with the available module to learn the MCP23017. Wading through the code made me though apply some changes... last but not least because I wanted add the interrupt functionality. Take a look at Exploring adding setWatch/clearWatch (inerrupt handling) to MCP23017 (MCP2308) Portexpander Ports. It includes a rewrite of the module. You can ignore the interrupt part... Posted at 2018-01-16 by @gfwilliams Maybe you could post your full code? Could you try setting the address to Posted at 2018-01-16 by consolenaut Updating to 1v95 is a good shout, as is setting the address to 0 instead of 0x20, I've tried setting the address to 0 (along with 1 to 7 for make sure I'm not on the wrong address) but I'm still getting the same error unfortunately. I've just updated to 1v95 this moment and re-tested and I'm getting the same issue, full code is below, it's pulled almost verbatim from the example: Code:
Error:
I've also attached a potato-quality photo of my wiring, note the reset pin is not connected - I've tried it both with and without, each result in the same error Attachments: Posted at 2018-01-16 by @gfwilliams The wiring all looks fine to me - and you're sure it's a MCP23017 and not a MCP23S17 (the SPI one?). You don't seem to have wired up the reset wire to A8 though - you could give that a try. Other thing you could try is swapping Posted at 2018-01-16 by consolenaut Definitely 23017 not 23S17, I checked that last night before posting to make sure I'd covered as many potentially silly issues as possible :). Tried the software I2C trick, changed from I2C2 to new I2C() and everything worked perfectly. Then I tried changing back to hardware I2C and it worked perfectly too, so then I tried power-cycling and trying hardware I2C and it still works - I can't really explain what fixed the issue, perhaps establishing a solid software I2C link kicked something in the MCP chip and got it in a good state, but it's working now. I'll keep an eye on it and monitor for any instability, thanks for your help :) Posted at 2018-01-16 by consolenaut Okay, to keep you posted, issue is re-occurring now after waiting for 5 minutes and re-sending the hardware sketch to the pico on I2C2 pins B10 & B8 - Out of the blue I decided to try I2C1 pins B8 and B9 and they seem to work fine Posted at 2018-01-16 by @gfwilliams It could actually just have been a bad connection on one of the pins? These things happen, especially with breadboard :) Posted at 2018-01-16 by consolenaut Damn, thought we had this sorted but I've come across some other weirdness -_- First off, thanks again for all your help, I know everyone here is busy so I appreciate the time. Second, I've come across a couple of issues interfacing with two MCP23017s, one on address 0b0000101 and one on address 0b0000111, I'll list them below:
I'm almost certain there's something underpinning all of this weirdness, but it feels like I'm working in the dark in terms of debugging - things seem to be happening at random Cheers -JBL Posted at 2018-01-17 by @gfwilliams Going back to a single chip, do you still have instability? I'm not sure what to suggest really. Perhaps you could try putting a capacitor across the MCP23017's power pins just in case there are some fluctuations on the power rail? The bitrate should default to 50000 so that shouldn't be an issue, but I guess you could try going faster with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-01-15 by consolenaut
Hi there!
I'm trying to interface and Espruino Pico with an MCP23017 and I'm running into a little trouble with the I2C communication (I2C2, pins B10 & B3, MCP device address 0x20)
The error I'm getting is as follows:
I've tried manually reading data from the MCP chip and that works as far as I can tell, my original assumption was incorrect wiring but I've been over half a dozen times and everything looks sound, 10k pullup resistors included on the i2c lines etc, and I can read data from the chip.
The problem only seems to occur when something tries to write to the chip, I've tested two different chips both giving the same error, does anyone think they could lend me a hand with this? It'll likely be something forehead-slappingly simple I've overlooked but on the off chance it isn't, I figured I'd post here
Cheers!
-Josh
Beta Was this translation helpful? Give feedback.
All reactions