After last changes in I2C, it seems the logic of the busy_wait macro is not correct.
I've been able to patch it locally and will push a clean proposal tomorrow (@thejpster asked me to file an issue).
Basically, checking for BusBusy everywhere is not correct as it will always be set between START and STOP, so during a transaction, we should not return an error (that's what I'm currently seeing).
Previous code was basically adapted from stm32f30x-hal and I see that the busy_wait macro has been changed (no more flag as parameter) and is not really busy_waiting on anything but the BUSY bit. The macro is now wrapped in loop{}. Was is not better to have the busy wait inside the macro ? Maybe there's something I'm not seeing here.
The original code was doing things like:
wait for busbsy to be clear
do something
wait for busy to be clear
do something
....
I see that previous code was wrongly looking at all mcs bits without waiting for busy to be clear, but maybe the cleaning went too far ? At least with my patch that reverts back the logic above, my application is working correctly again.
After last changes in I2C, it seems the logic of the busy_wait macro is not correct. I've been able to patch it locally and will push a clean proposal tomorrow (@thejpster asked me to file an issue).
Basically, checking for BusBusy everywhere is not correct as it will always be set between START and STOP, so during a transaction, we should not return an error (that's what I'm currently seeing).
Previous code was basically adapted from stm32f30x-hal and I see that the busy_wait macro has been changed (no more flag as parameter) and is not really busy_waiting on anything but the BUSY bit. The macro is now wrapped in
loop{}
. Was is not better to have the busy wait inside the macro ? Maybe there's something I'm not seeing here.The original code was doing things like:
busbsy
to be clearbusy
to be clearI see that previous code was wrongly looking at all
mcs
bits without waiting forbusy
to be clear, but maybe the cleaning went too far ? At least with my patch that reverts back the logic above, my application is working correctly again.