stickbreaker / arduino-esp32

Arduino core for the ESP32

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gross Timeout occuring

stickbreaker opened this issue · comments

@jlhavens is encountering Gross Timeouts, the debug out shows the ISR completing but i2cProcQueue() is timing out in the xEventGroupGetBits().

[E][esp32-hal-i2c.c:1643] i2cProcQueue():  Gross Timeout Dead st=2492, ed=2542, =50, max=50 error=1
[E][esp32-hal-i2c.c:1103] dumpI2c(): i2c=0x3ffc1040
[E][esp32-hal-i2c.c:1104] dumpI2c(): dev=0x60013000
[E][esp32-hal-i2c.c:1105] dumpI2c(): lock=0x3ffd343c
[E][esp32-hal-i2c.c:1106] dumpI2c(): num=0
[E][esp32-hal-i2c.c:1107] dumpI2c(): mode=1
[E][esp32-hal-i2c.c:1108] dumpI2c(): stage=3
[E][esp32-hal-i2c.c:1109] dumpI2c(): error=1
[E][esp32-hal-i2c.c:1110] dumpI2c(): event=0x3ffd34c0 bits=0
[E][esp32-hal-i2c.c:1111] dumpI2c(): intr_handle=0x3ffd08d4
[E][esp32-hal-i2c.c:1112] dumpI2c(): dq=0x3ffe1734
[E][esp32-hal-i2c.c:1113] dumpI2c(): queueCount=1
[E][esp32-hal-i2c.c:1114] dumpI2c(): queuePos=0
[E][esp32-hal-i2c.c:1115] dumpI2c(): byteCnt=4
[E][esp32-hal-i2c.c:1120] dumpI2c(): [0] 90 W STOP buf@=0x3ffc3542, len=3, pos=3, eventH=0x0 bits=0
[E][esp32-hal-i2c.c:1468] i2cDumpInts(): row  count   INTR    TX     RX
[E][esp32-hal-i2c.c:1471] i2cDumpInts(): [01] 0x0001 0x0002 0x0004 0x0000
[E][esp32-hal-i2c.c:1471] i2cDumpInts(): [02] 0x0001 0x0200 0x0000 0x0000
[E][esp32-hal-i2c.c:1471] i2cDumpInts(): [03] 0x0004 0x0040 0x0000 0x0000
[E][esp32-hal-i2c.c:1471] i2cDumpInts(): [04] 0x0001 0x0080 0x0000 0x0000

I recommended he increase the default Gross Timeout from +50ms to +500ms.
in esp32-hal-i2c.c:1596

chuck.

@jlhavens and I have narrowed this problem down to a FreeRTOS time Daemon being starved. The current code uses EventGroups to pass control from the ISR back to the waiting APP task. When the ISR attempts to indicate it is done with an xEventGroupSetBitsFromISR() it receives a pdFAIL indicating the Daemon had no entries available to queue the SetBits message. This caused the waiting APP task to respond as if the ISR timedOut. I have written a work around EventGroup Failure Patch.
Using it AND delaying the initial I2C transactions until the WIFI stabilizes (5 seconds) after the ESP32 boots has shown results in error free operation. But He also disable his OneWire sensor (BMP180?) and DS18B20. I do not know how reinstalling them will affect operation.

Chuck.

The latest merge commit includes fixes for handling if the xEventGroupSetBits() from the ISR fails.