rust-embedded-community / tm4c-hal

An Embedded HAL and general chip support for the TM4C123/LM4F120. Replaces the old lm4f120 crate.
Apache License 2.0
40 stars 26 forks source link

Fix i2c busy / bus busy handling #35

Closed dkm closed 3 years ago

dkm commented 3 years ago

Restore previous logic where a transaction starts by waiting for the controler to be ready and the bus available and then only wait for the controller to be ready at intermediate step (not the bus to be available as it will be busy). Modify the i2c_busy_wait to implement this behavior.

fix #34

thejpster commented 3 years ago

To be clear, this basically reverts https://github.com/rust-embedded-community/tm4c-hal/pull/29/commits/4d50753d21331a667a97bc585f83fe6b5d7cf26c

dkm commented 3 years ago

Not true ! :) It keeps most of these changes, only it won't raise an error when busbsy is set everytime the macro is used, only when the extra argument is provided (eg. at beg of transaction). It still spins on busy to be clear before reading other bits (which the patch you link fixes).

thejpster commented 3 years ago

I appreciate the clarification. I find Github diff mode quite hard to grok :/

dkm commented 3 years ago

No problem ! And I may still have overlooked something, so feel free to question my choices :) I can still say that previous try to use i2c always failed with the BusBusy error since the @dtwood's changes and now it works correctly for hours. Not a clear proof it fixes something, but at least, it works here :)

dkm commented 3 years ago

Great, thanks ! I can say that before your changes, i2c was really unstable, after your fix it does not work at all, and the combination of your fix and these changes makes it work flawlessly on my app. It is simple, so can't say it's a very robust test, but it is testing basic things...