NimBLE-Arduino: Crashes in v1.3.5 when connecting/disconnecting/writing to/reading from BLE device
After upgrading from v1.3.4 to v1.3.5 in one of my projects, I’m periodically getting crashes that look like the following:
3318 V: Connecting to device at 60:a4:23:f1:ed:72
lld_pdu_get_tx_flush_nb HCI packet count mismatch (1, 2)
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400932bc PS : 0x00060130 A0 : 0x80093396 A1 : 0x3ffcc4f0
A2 : 0x01000000 A3 : 0x00000001 A4 : 0x00000d3f A5 : 0x80000020
A6 : 0x00000003 A7 : 0x00060023 A8 : 0x00000003 A9 : 0x3ffcc4b0
A10 : 0x00000001 A11 : 0x00000000 A12 : 0x3ffbd394 A13 : 0x00000000
A14 : 0x3ffbd42c A15 : 0x3ffbb170 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x01000014 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
ELF file SHA256: 0000000000000000
Backtrace: 0x400932bc:0x3ffcc4f0 0x40093393:0x3ffcc530 0x40090b2a:0x3ffcc560
#0 0x400932bc:0x3ffcc4f0 in prvProcessReceivedCommands at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/timers.c:485
#1 0x40093393:0x3ffcc530 in prvTimerTask at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/timers.c:485
#2 0x40090b2a:0x3ffcc560 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
Interestingly, the crashes always invoke something timer-related and only happen when connecting to/reading/writing to/disconnecting from a BLE device. Here’s another crash when trying to send data to a device:
615991 V: Connecting to device at 60:a4:23:f1:ed:72
616315 V: Connected to: 60:a4:23:f1:ed:72, RSSI: -66
616316 V: Sending command to unlock device (write_gatt_attr)
617676 Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4009377d PS : 0x00060f30 A0 : 0x800932c6 A1 : 0x3ffcc4d0
A2 : 0x3ffdbc05 A3 : 0x00000000 A4 : 0x3ffbd394 A5 : 0x00000000
A6 : 0x3ffbd3cc A7 : 0x3ffbb170 A8 : 0x343ffdbc A9 : 0x00003300
A10 : 0x78000000 A11 : 0x00000000 A12 : 0x3ffcb64c A13 : 0x00000001
A14 : 0x00060f20 A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00003308 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
ELF file SHA256: 0000000000000000
Backtrace: 0x4009377d:0x3ffcc4d0 0x400932c3:0x3ffcc4f0 0x40093393:0x3ffcc530 0x40090b2a:0x3ffcc560
#0 0x4009377d:0x3ffcc4d0 in uxListRemove at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/list.c:214
#1 0x400932c3:0x3ffcc4f0 in prvProcessReceivedCommands at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/timers.c:485
#2 0x40093393:0x3ffcc530 in prvTimerTask at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/timers.c:485
#3 0x40090b2a:0x3ffcc560 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
And another:
6104 V: Connected to: 60:a4:23:f1:ed:72, RSSI: -72
7469 V: Read port 0, characteristic f1849d4b-a033-4d97-a988-3259a3498b95 as value: 18925
Preapring to disconnectGuru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400933cc PS : 0x00060933 A0 : 0x800ed6a1 A1 : 0x3ffce6e0
A2 : 0x010114e9 A3 : 0x3ffc0fa4 A4 : 0x3ffce6f4 A5 : 0x00000001
A6 : 0x00060b20 A7 : 0x00000000 A8 : 0x800933cc A9 : 0x3ffce6b0
A10 : 0x00000001 A11 : 0x3ffce8fc A12 : 0x00000001 A13 : 0x00000001
A14 : 0x00060920 A15 : 0x00000000 SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x010114fd LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffa
ELF file SHA256: 0000000000000000
Backtrace: 0x400933cc:0x3ffce6e0 0x400ed69e:0x3ffce700 0x400d87dd:0x3ffce750 0x400d8cc5:0x3ffce770 0x400d8cfd:0x3ffce7d0 0x400d90be:0x3ffce800 0x400d978e:0x3ffce820 0x40104c2c:0x3ffce840 0x40090b2a:0x3ffce860
#0 0x400933cc:0x3ffce6e0 in xTimerIsTimerActive at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/timers.c:957
#1 0x400ed69e:0x3ffce700 in NimBLEClient::disconnect(unsigned char) at .pio/libdeps/m5stack-atom-lite/NimBLE-Arduino@src-21d326ddac6723274e648607cb71496d/src/NimBLEClient.cpp:471
(inlined by) NimBLEClient::disconnect(unsigned char) at .pio/libdeps/m5stack-atom-lite/NimBLE-Arduino@src-21d326ddac6723274e648607cb71496d/src/NimBLEClient.cpp:357
#2 0x400d87dd:0x3ffce750 in disconnectFromServer(NimBLEClient*) at src/ktGATT.cpp:410
#3 0x400d8cc5:0x3ffce770 in read_gatt_attr(unsigned char, char const*, unsigned short&) at src/ktGATT.cpp:410
Rolling back to v1.3.4 results in the code becoming stable again.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 25 (21 by maintainers)
If it’s still not up I guess I’ll start manually publishing releases to pio, which is a shame, I liked that it’s been automatic so far.
Thanks! You’re very welcome.
That’s what I like to hear! 😃
1.3.6 seems to be working perfectly for me thus far!
You may already know this, but if you want to use it before Platformio’s registry picks it up, you can replace
h2zero/NimBLE-Arduino @ 1.3.5withhttps://github.com/h2zero/NimBLE-Arduino.git#1.3.6in platformio.iniI had the exact same issue as mentioned in the issue. I am using PlatformIO and for the time being I decided to rollback to 1.3.4. I will wait for PlatformIO to show up 1.3.6 in the updates and then try that out. I will test and post should I come across any issues.
Btw can’t thank @h2zero enough for this excellent library. It’s not just one of the best libraries but his support in getting issues solved has been nothing short of AWESOME!!!
@thorrak Just pushed release 1.3.6, hopefully all is well now 😄
Looks like it was instantly updated, hopefully all is well now.
I manually published the release to the platformio registry. It could take 24hrs, let’s see if it works 😄. I’ll get on the github actions for this process for the next release.
Great, that was a bug that I have heard of before and thought those changes would fix it but I had no way to test. It’s very timing related so if you don’t have any crashing I would appreciate the feedback so I can incorporate the changes.
I have also identified a patch in the master branch related to the original crashing: 4cacd370bcd252c0fecc91a9c92b356a76ae9136 I will update the release with this as well