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

Add "capability flag" for 0 length I2C transfers #174

Open
multiplemonomials opened this issue Jul 23, 2023 · 2 comments
Open

Add "capability flag" for 0 length I2C transfers #174

multiplemonomials opened this issue Jul 23, 2023 · 2 comments

Comments

@multiplemonomials
Copy link
Collaborator

Even though 0-length I2C transfers (where the MCU just sends an address, waits for an ACK, and then stops) are useful (e.g. for scanning the I2C bus for devices), they are a bit of a corner case in the I2C protocol. Some MCUs simply do not support them:

  • STM32 v2 I2C peripheral allows transactional transfers with 0 length, but not single-byte transfers
  • RP2040 does not allow 0-length transfers at all in any shape or form

We need a way for MCUs to have "I2C capabilities" that they can share with the application and the test suite, and there should be capabilities for single-byte 0 length transfers and transactional 0 length transfers.

@JohnK1987
Copy link
Member

What is it good for other than finding an address? From my experiences one dummy byte is working solution.

error = i2c.write(address<<1,0x00,1);

@multiplemonomials
Copy link
Collaborator Author

Yeah but, sometimes (though rarely) writing that byte might change the behavior of the device.

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