arduino / arduino/ArduinoCore-mbed

Mbed OS crashes if use BLE and u8g2 at a time

Open
#127 0 comments 0 reactions 0 assignees View on GitHub
nrf52
Dominant language
C
Stars
411
Forks
225
PR merge metrics
No merged PRs in 30d

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
#include

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
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the crash with the Arduino Nano 33 BLE sketch shown in the issue, using BLE.scan(), U8G2_SH1106_128X64_NONAME_F_HW_I2C, and u8g2.begin(). Compare behavior with each library used alone and inspect the reported Mbed crash code and stack information. Done means the combined BLE scan and OLED use no longer produces the fault.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.