Description
Hello,
The problem was found with using u8g2 or Adafruit GFX OLED display library and BLE at a time.
It is enough to just call .begin() in u8g2 and BLE.scan() with result in crash after random amount of time (in dense environments it happens after a second or so)
It does not seem to be connected with I2C itself, since using software I2C does not resolve the issue, but make crashes more often (supposedly due to longer loop() execution time when I send buffer).
Using only u8g2 or only BLE does not crash Mbed
Thread stacks looks fine:
19:21:09.026 -> Heap size: 19248/186424
19:21:09.026 -> Stack size thr536941612: 624/32768
19:21:09.026 -> Stack size thr536941980: 424/512
19:21:09.026 -> Stack size thr536879632: 392/1024
19:21:09.064 -> Stack size thr536941912: 104/768
19:21:09.064 -> Stack size thr536883712: 168/1024
Second one looks a bit dangerous but removing u8g2 does not affect it
I've tried Core versions from 1.1.3 to latest 1.3.1, same behavior
My board is Arduino Nano 33 BLE
As the example of sketch to cause a crash- standart scan example can be used, just add u8g2 references:
#include <U8g2lib.h>
#include <U8x8lib.h>
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
void setup() {
// start scanning for peripheral
BLE.scan();
u8g2.begin();
}
Error code from Mbed crash dump is 0x80FF013D:
++ MbedOS Error Info ++
00:58:57.398 -> Error Status: 0x80FF013D Code: 317 Module: 255
00:58:57.398 -> Error Message: Fault exception