I2C fallback doesn't work after first failure Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Tuxford
Posts: 25
Joined: Fri Nov 06, 2020 3:28 pm
Location: Salivonky UA
Has thanked: 4 times
Been thanked: 4 times

I2C fallback doesn't work after first failure  Topic is solved

Postby Tuxford » Tue Feb 15, 2022 8:01 am

I2C driver stop working after first failed command. E.g.

Code: Select all

    uint8_t addr = 0xFF << 1;
    i2cMasterReceiveTimeout(drv, addr, NULL, 0, TIME_S2I(2));

On oscilloscope i have next case. SCL is on low state and that's finish. No operations are allowed until restart of board.
tlv493d.png
tlv493d.png (11.34 KiB) Viewed 2790 times


I have added next fix and failed command doesn't brake I2C anymore.

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 e4ae9a9f9..37b3cb3ed 100644
--- a/os/hal/lib/fallback/I2C/hal_i2c_lld.c
+++ b/os/hal/lib/fallback/I2C/hal_i2c_lld.c
@@ -32,6 +32,8 @@
 
 #define CHECK_ERROR(msg)                                                    \
   if ((msg) < (msg_t)0) {                                                   \
+    palSetLine(i2cp->config->sda);                                          \^M
+    palSetLine(i2cp->config->scl);                                          \^M
     return MSG_TIMEOUT;                                                     \
   }


Any other opinions about this case?

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

Re: I2C fallback doesn't work after first failure

Postby Giovanni » Tue Feb 15, 2022 8:28 am

Hi,

Thanks for the patch, moving this topic in "bug reports".

Giovanni

User avatar
FXCoder
Posts: 384
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 180 times
Been thanked: 130 times

Re: I2C fallback doesn't work after first failure

Postby FXCoder » Sun Feb 20, 2022 6:50 am

Hi,
I use a wrapper API that creates a combined driver allowing mixed H/W and S/W I2C.
One of our team was experiencing this hang for a s/w driven device.

Thanks for the timely fix which saved me all sorts of debug time :-)

--
Bob

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

Re: I2C fallback doesn't work after first failure

Postby Giovanni » Mon Mar 14, 2022 1:44 pm

Hi,

Fixed as bug #1224.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 27 guests