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

Fixed MCP23016 register write function #113

Merged
merged 2 commits into from
May 20, 2021

Conversation

kaolpr
Copy link
Contributor

@kaolpr kaolpr commented May 20, 2021

mcp23016_write_reg was first reading 2 registers and than writing them back with one changed. Problem is that writing operation is done instantly after reading and MCP23016 seems to need some time to process stuff:
image
Removing extra read operations seems to fix #111 (guess when MCP is hot it gets sluggish). However, this should be explicitly taken into account when multiple operations are executed on the MCP chip. I will make a separate issue to address that.

Copy link
Member

@augustofg augustofg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use sizeof(cmd_data) instead of '2' (cmd_data already declared with the correct size)

@augustofg
Copy link
Member

augustofg commented May 20, 2021

I'm trying to understand why it was doing a read-modify-write operation in the first place as it seems completely unnecessary.

@kaolpr
Copy link
Contributor Author

kaolpr commented May 20, 2021

I'm trying to understand why it was doing a read-modify-write operation in the first place as it seems completely unnecessary.

I have no idea. I can't see any reason for it.

@augustofg
Copy link
Member

I'm merging this now as it seems obviously correct, but from my understanding of the mcp23016 datasheet it is supposed to held the SCL line low until it finishes processing the previous byte, making the microcontroller wait for the I2C bus to be free before doing the next transmission.

@augustofg augustofg merged commit 582f6ef into lnls-dig:afcv4-port May 20, 2021
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

Successfully merging this pull request may close these issues.

2 participants