Skip to content

Update Wire peripheral handler #605

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

Closed
wants to merge 0 commits into from
Closed

Conversation

stonehippo
Copy link

The existing onService method for I2C peripheral (slave) implementation
swapped the sense of onRequest (master read) and onReceive (master
write) handlers. It also didn't handle writes correctly, requiring two
write operations to get bytes out of the buffer and in the onReceive
handler.

This implementation follows the SERCOM I2C flow defined for the
default clock-stretching case (CTRLB.SCLSM=0) as described in the
SAMD21 datasheet.

@stonehippo
Copy link
Author

I found a couple of issues that I've resolved, namely that NACKs needed to be sent at the end of the read or write logic to close down the connection. Should be all set now.

I'm using a version of this code locally to test out a custom peripheral and so far, it's working as expected (with the NACK fix in place).

@stonehippo
Copy link
Author

I've found bug here (the write NACK prevents reads). I'll fix that and push a revision to the PR.

@stonehippo
Copy link
Author

Ok, last bug (that I've found) smooshed. Would love a review of this and to see it get merged in.

@reufer
Copy link

reufer commented Feb 23, 2021

works for me!

@stonehippo
Copy link
Author

It’s been a while since I submitted this PR. The checks failed due to issue that had nothing to do with the changes here. Any idea how to get this re-checked and maybe merged in? @per1234?

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