possible dependency issue in i2c.cpp
doebi opened this issue · comments
Christoph Döberl commented
Fresh clone with any board results in this error:
src/i2c.cpp: In function 'void i2c_scan()':
src/i2c.cpp:75:46: error: too few arguments to function 'int I2CDiscoverDevice(BBI2C*, uint8_t, uint32_t*)'
iDevice = I2CDiscoverDevice(&bbi2c, i);
^
In file included from include/i2c.h:5,
from src/i2c.cpp:3:
.pio/libdeps/usb/BitBang_I2C/src/BitBang_I2C.h:151:5: note: declared here
int I2CDiscoverDevice(BBI2C *pI2C, uint8_t i, uint32_t *pCapabilities);
^~~~~~~~~~~~~~~~~
Compiling .pio/build/usb/src/power.cpp.o
*** [.pio/build/usb/src/i2c.cpp.o] Error 1
Is this a dependency issue with the BitBang library?
Christoph Döberl commented
I was able to workaround the compile error by applying:
diff --git a/src/i2c.cpp b/src/i2c.cpp
index cc13910..e7bc51f 100644
--- a/src/i2c.cpp
+++ b/src/i2c.cpp
@@ -72,7 +72,7 @@ void i2c_scan(void) {
if (map[i >> 3] & (1 << (i & 7))) // device found
{
iCount++;
- iDevice = I2CDiscoverDevice(&bbi2c, i);
+ iDevice = I2CDiscoverDevice(&bbi2c, i, 0);
ESP_LOGI(TAG, "Device found at 0x%X, type = %s", i,
szNames[iDevice]); // show the device name as a string
}
But this results in a runtime error and reboot loop.
22:55:47.002 > Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
22:55:47.003 >
22:55:47.003 > Core 1 register dump:
22:55:47.003 > PC : 0x400dff46 PS : 0x00060330 A0 : 0x800d44ef A1 : 0x3ffcf440
22:55:47.003 > A2 : 0x00000001 A3 : 0x00100000 A4 : 0x00000000 A5 : 0x3ffc64bc
22:55:47.025 > A6 : 0x00000001 A7 : 0x00000000 A8 : 0x00000001 A9 : 0x3ffcf410
22:55:47.025 > A10 : 0x00000001 A11 : 0x00000001 A12 : 0x00000001 A13 : 0x3ffcf444
22:55:47.025 > A14 : 0x00000001 A15 : 0x00000001 SAR : 0x0000001c EXCCAUSE: 0x0000001d
22:55:47.059 > EXCVADDR: 0x00000000 LBEG : 0x400927f4 LEND : 0x4009280a LCOUNT : 0xffffffff
22:55:47.059 >
22:55:47.059 >
22:55:47.059 > Backtrace:0x400dff43:0x3ffcf4400x400d44ec:0x3ffcf470 0x400d57f1:0x3ffcf560 0x400eda8e:0x3ffcf640
22:55:47.059 > #0 0x400dff43:0x3ffcf4400 in I2CDiscoverDevice(mybbi2c*, unsigned char, unsigned int*) at .pio/libdeps/usb/BitBang_I2C/src/BitBang_I2C.cpp:854
Christoph Döberl commented
downgrading the BitBang_I2C library fixes the issue temporarily.
diff --git a/platformio_orig.ini b/platformio_orig.ini
index f1eba0c..64437f4 100644
--- a/platformio_orig.ini
+++ b/platformio_orig.ini
@@ -62,6 +62,7 @@ lib_deps_lora =
mcci-catena/MCCI LoRaWAN LMIC library @ ^4.1.1
lib_deps_display =
bitbank2/OneBitDisplay @ ^1.11.0
+ bitbank2/BitBang_I2C @ 2.1.5
ricmoo/QRCode @ ^0.0.1
bodmer/TFT_eSPI @ ^2.3.84
lib_deps_ledmatrix =
loratrak commented
I had the same issue some days ago, did a downgraded in BitBang and it works!!
Verkehrsrot commented
This should be fixed now.
30b56c8