I2C fallback Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
wurstnase
Posts: 121
Joined: Tue Oct 17, 2017 2:24 pm
Has thanked: 43 times
Been thanked: 30 times
Contact:

I2C fallback  Topic is solved

Postby wurstnase » Thu Jan 16, 2020 8:17 am

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;
     }
\o/ Nico

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: I2C fallback

Postby Giovanni » Sat Jan 18, 2020 11:53 am

Hi,

Fixed as bug #1069.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 12 guests