update on PR Added the repeated-start feature in I2C driver #590 #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Hi @jmchiappa,
Thanks for your PR.
I had a look at the source code and it seems that using I2C_NO_OPTION_FRAME may cause issue:
{
hi2c->XferSize = hi2c->XferCount;
xfermode = hi2c->XferOptions;
}
. . .
/* Send Slave Address and set NBYTES to read */
I2C_TransferConfig(hi2c, DevAddress, hi2c->XferSize, xfermode, xferrequest);
But 0xFFFF0000 is not a valid value to write to register.
So I discussed with our I2C expert, and we finally reach a new proposal:
for both RX and TX:
if (sendStop == 0) {
_i2c.handle.XferOptions = I2C_OTHER_FRAME;
} else {
_i2c.handle.XferOptions = I2C_OTHER_AND_LAST_FRAME;
}
Unfortunately F0 and F2 do not yet have those defines but it should come in the future,
also F1/F3 will have it soon (next release).
So we propose to update your proposal with the solution from our expert, only when I2C_OTHER_FRAME define is available.
And keep former solution for other families (i.e. stop condition always present, and uncompatible for now with device like your accelerometer).
I made a Pull Request on top of yours, in your fork.
I tested this with I2C EEPROM 24LC256 and with Thermal sensor LM75 on NUCLEO_L476RG to be sure there is no regression. Test are passed.
Would it be possible for you to test with your MMA8451 accelerometer ... if you get it ?