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

fix(wire): support only 7 bits addressing mode #2493

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Aug 22, 2024

Arduino does not support 10 bits addressing mode.
The API is limited to an uint8_t address:
https://github.com/arduino/ArduinoCore-API/blob/4a02bfc0a924e1fec34c3bb82ffd5dfba7643a0c/api/HardwareI2C.h#L31
https://github.com/arduino/ArduinoCore-API/blob/4a02bfc0a924e1fec34c3bb82ffd5dfba7643a0c/api/HardwareI2C.h#L36

About the hack to use 10 bits on Arduino:

Normally on arduino, you can communicate with this device simply by doing something like this:

Wire.begin(0x79);
Wire.write(0x08);
//insert additional communication here
Wire.endTransmission()

However, when using the same code on STM32Duino this communication won't succeed.
First of all, 0xF2 (0x79 << 1) byte will appear twice on the bus (because we are configuring HAL's I2C interface in 7bit mode, however the MCU itself recognizes this address as the beginning of 10 bit address).

This is not possible as it is manage by hardware to follow I2C specification where:
11110xxx is reserved for 10-bit Slave Addressing.

Fixes #2468.

@fpistm fpistm added this to the 2.9.0 milestone Aug 22, 2024
@fpistm fpistm merged commit 0935852 into stm32duino:main Aug 22, 2024
23 checks passed
@fpistm fpistm deleted the 7bits_only branch August 22, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Wire (I2C) library: support 10 bits address mode
1 participant