Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO7 bug hacking #96

Open
siteswapjuggler opened this issue Jul 20, 2023 · 6 comments
Open

GPIO7 bug hacking #96

siteswapjuggler opened this issue Jul 20, 2023 · 6 comments

Comments

@siteswapjuggler
Copy link

Concerning this warning

Some people have reported an undocumented bug that can potentially corrupt the I2C bus. It occurs if an MCP230XX input pin state changes during I2C readout. This should be very rare. For more information, see this forum post and this knowledge base article.

It may appear that you can bypass this problematic by using the software interrupt and the interrupt capture register. Doing so you simulate a buffer that avoid the real time change bug which affect the SDA line.

Just a thought by now that I've to test, but first I have to found a solution to replicate the bug efficiently.

@caternuson
Copy link
Contributor

Also posted here:
https://forums.adafruit.com/viewtopic.php?t=203060

@siteswapjuggler
Copy link
Author

The adafruit forum thread refer to the same problem but didn't mention any possible solution. That's I try to push with this issue.

@siteswapjuggler
Copy link
Author

I did also open a ticket with the microchip support in order to know if the other I2C members of the MCP230XX family like MCP23009 and MCP23018 are also affected or not.

Please notice that the MCP230XX start with all gpio as inputs so the bug can occur even if we don't use the 7th bit in our project. To avoid any problem you may have to set GPIOs 7 to output or activate internal pullup to avoid floating state on this gpio before any reading of the gpio state.

The other solution may be to never read the gpio state register but only use the interrupt capture register which is not affected by the real time change that cause the I2C crash.

@siteswapjuggler
Copy link
Author

I try to reproduce this I07 bug by feeding a pwm signal into the GPIO7 of a MCP23008 and was unable to get any I2C crash. Btw I also tested the getCapturedInterrupt() method and it works great so definitively a good workout for this potential problem.

@jokinpaha
Copy link

I think Microchip has circumvented this problem by making GPA7 and GPB7 output only for MCP23017 as it says in the datasheets first page and in pin descriptions.

@siteswapjuggler
Copy link
Author

They circumvented nothing they cover the mistake by announcing that GPx7 could not be used as input despite they are suppose to be built for this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants