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

i2c::I2c methods are unreliable in 'release' builds #19

Closed LeonardMH closed 5 years ago

LeonardMH commented 5 years ago

When performing I2C transactions in 'release' builds, the time between setting the run bit and checking the busy bit is too short and the busy bit is not reliably set by the time you get there.

It can take up to 8 clock cycles for the run to begin so this commit adds an 8 cycle delay in the i2c::busy_wait! macros before checking any I2C hardware registers.

Signed-off-by: Michael Leonard maybeillrememberit@gmail.com

thejpster commented 5 years ago

Thanks!