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

I2C does not follow the embedded_hal::i2c::I2c::transaction contract #171

Open
dimpolo opened this issue Jan 5, 2025 · 2 comments
Open

Comments

@dimpolo
Copy link

dimpolo commented Jan 5, 2025

Hi everyone. Could you have a look at bundling same operations in your I2C implementation?
This is required for the pn532 crate to work correctly, see WMT-GmbH/pn532#27

Two consecutive reads should be bundled together.
Two consecutive writes should be bundled together.

Quote from the docs (emphasis mine):

Transaction contract:

  • Before executing the first operation an ST is sent automatically. This is followed by SAD+R/W as appropriate.
  • Data from adjacent operations of the same type are sent after each other without an SP or SR.
  • Between adjacent operations of a different type an SR and SAD+R/W is sent.
  • After executing the last operation an SP is sent automatically.
  • If the last operation is a Read the master does not send an acknowledge for the last byte.
  • ST = start condition
  • SAD+R/W = slave address followed by bit 1 to indicate reading or 0 to indicate writing
  • SR = repeated start condition
  • SP = stop condition
@dimpolo
Copy link
Author

dimpolo commented Jan 5, 2025

@golemparts
Copy link
Owner

Thank you for opening this issue. If anyone is willing to implement and test this I'm happy to merge in a PR, as I won't be able to work on this myself anytime soon due to other priorities.

@golemparts golemparts added the hal label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants