Page 1 of 1

I2C fallback  Topic is solved

Posted: Thu Jan 16, 2020 8:17 am
by wurstnase
Hi,

I've posted this before, but maybe it's a better idea to open a new bug report.

With reverting the bug #1060, the I2C fallback hang, when timeout is INFINITE.

My suggestion look like this:

Code: Select all

diff --git a/os/hal/lib/fallback/I2C/hal_i2c_lld.c b/os/hal/lib/fallback/I2C/hal_i2c_lld.c
index f324333dc..e3e3ec86f 100644
--- a/os/hal/lib/fallback/I2C/hal_i2c_lld.c
+++ b/os/hal/lib/fallback/I2C/hal_i2c_lld.c
@@ -94,6 +94,9 @@ static inline msg_t i2c_check_arbitration(I2CDriver *i2cp) {
 
 static inline msg_t i2c_check_timeout(I2CDriver *i2cp) {
 
+  if (i2cp->start == i2cp->end)
+      return MSG_OK;
+
   if (!osalTimeIsInRangeX(osalOsGetSystemTimeX(), i2cp->start, i2cp->end)) {
     i2c_write_stop(i2cp);
     return MSG_TIMEOUT;
@@ -105,6 +108,7 @@ static inline msg_t i2c_check_timeout(I2CDriver *i2cp) {
 static msg_t i2c_wait_clock(I2CDriver *i2cp) {
 
   while (palReadLine(i2cp->config->scl) == PAL_LOW) {
+    if (i2cp->start != i2cp->end)
     if (!osalTimeIsInRangeX(osalOsGetSystemTimeX(), i2cp->start, i2cp->end)) {
       return MSG_TIMEOUT;
     }

Re: I2C fallback

Posted: Sat Jan 18, 2020 11:53 am
by Giovanni
Hi,

Fixed as bug #1069.

Giovanni