-
Notifications
You must be signed in to change notification settings - Fork 1k
Wire (I2C) library: support 10 bits address mode #2468
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
Comments
Hi @blazej222 The address you used rely on the 10 bits addressing: Moreover this is the HAL and hardware which handle that so nothing could be done here. If you really think it is an issue (don't think so) you can file an issue on the STMicroelectronics GitHub organization. Mainly on STM32CubeF1 repository. |
My apologies, I might have worded this issue badly. 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. As a result, there's no proper way to communicate with devices that use 10bit addressing from STM32duino. The problem itself isn't present in HAL library - on native STM32 cube all you have to do is configure the interface into I understand that Arduino library does not explicitly provide 10bit addressing support - however, on native Arduino library it's possible to communicate with 10bit I2C devices by simply splitting the address into two bytes. Probably a check would have to be implemented in STM32duino that configures HAL into 10bit addressing mode when applicable. |
Hi @blazej222 Ref: https://www.arduino.cc/reference/en/language/functions/communication/wire/ |
Describe the bug
When STM32 is I2C master, any
beginTransmission(x)
call for x like0b1111 0xxx
withoutwrite()
call in between will cause subsequentendTransmission()
call to returnI2C_NACK
, despite slave device sending ACK on SDA line.This is due to the fact that STM32 automatically detects addresses starting with
0b1111 0xxx
as 10 bit addresses, and in that case, does not setI2C_FLAG_ADDR
flag which is being checked after sending the first byte of address.Arduino_Core_STM32/system/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c
Lines 3578 to 3605 in 5e4f220
To Reproduce
I2C master code:
I2C slave code:
Steps to reproduce the behavior:
Additionally, if you uncomment
Wire.write(1)
call in I2C master code, I2C slave will report receiving a242
byte, but only once and won't report again until reset.This causes a simple example of I2C scanner ineffective for those addresses and ultimately makes communciation with those addresses impossible without modifying underlying framework's core code.
Expected behavior
I2C master should report ACK. With additional
Wire.write()
call uncommented, a slave device should report receiving1
every one second.The text was updated successfully, but these errors were encountered: