-
Notifications
You must be signed in to change notification settings - Fork 1k
Wire fixes for repeated start(slave) and multiple .write in onRequestEvent() #1221
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @DanielLiebler,
Thanks for your Pull Request.
After review, it looks good to me,
but I would like to test, specially because there are 2 major I2C Hardware implementation within STM32 families.
Can you tell me what you tested ? which boards ...
Can you tell me how you tested ? Which master with repeated start?
Can you share you sketch () ?
Thank I will test that. |
Thanks @DanielLiebler for this PR. Note: The CI core compilation issue is normal as I'm updating some dependencies and will be back to normal soon. |
8447ea4
to
f873eda
Compare
@fpistm should be done. I didnt know you could do such things, even though I guess you can mess up things really bad with squashing^^ |
Thanks @DanielLiebler |
f873eda
to
3624374
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tested on Nucleo F429ZI (I2C V1) and Nucleo F746ZG (I2C V2)
…stEvent() as Slave
…/no stop condition is sent in slave mode
3624374
to
65335d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Waiting @ABOSTM approval
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
This PR fixes/implements the following bugs/features
Description
The slave implementation doesn't seem to work with repeated starts, but this is also a quick fix by sending out an onReceiveEvent() when getting the new address callback.
In could'nt recieve integers at master from slave #488 it was mentioned to just use one write, but I think this is not good behavior, since it's not mentioned in the documentation. Nevertheless, it seems to be a quick fix, so I just created this PR.
How it works
When getting the address callback, the data which has been cached is sent to an onReceiveEvent, when still in SLAVE_MODE_RECEIVE mode.
We are resetting i2cTxRxBufferSize before calling i2c_onSlaveTransmit() in HAL_I2C_AddrCallback()
and modify the function i2c_slave_write_IT() to start writing in the i2cTxRxBuffer with the size of the buffer as offset and add up the sizes.