Skip to content

NimBLE-Arduino -> Arduino "BLE" (3.3.x) migration#10164

Merged
vidplace7 merged 10 commits intopioarduinofrom
pioarduino-nimble
Apr 21, 2026
Merged

NimBLE-Arduino -> Arduino "BLE" (3.3.x) migration#10164
vidplace7 merged 10 commits intopioarduinofrom
pioarduino-nimble

Conversation

@vidplace7
Copy link
Copy Markdown
Member

With ESP-IDF 5.5.x NimBLE has been integrated, Arduino-ESP32 exposes this nimble via the BLE API. Needed for Arduino-ESP32 3.x migration.
Existing NimBLE code should be transitioned to the (similar but not identical) BLE API.

This PR attempts to port to the new NimBLE implementation recently integrated in Arduino-ESP32 3.3.x.
Just the simple renames for now, still plenty of failures.

Moved from original PR:

vidplace7 and others added 8 commits January 23, 2026 14:21
Device Name is exposed in two places:

- Advertisement data: this is set properly in startAdvertising.
- GATT attribute Device Name (0x2A00). This one is handled internally in NimBLE
  and comes from ble_svc_gap_device_name_set. This is set initially, but then
  BLEDevice::createServer calls ble_svc_gap_init which resets the device name.
  This causes the device to apparently "change name after pairing":

< ACL Data TX:... flags 0x00 dlen 7  #113 [hci0] 14.241149
      ATT: Read Request (0x0a) len 2
        Handle: 0x0003 Type: Device Name (0x2a00)
> ACL Data RX: Handle 2048 flags 0x02 dlen 11             #115 [hci0] 14.269050
      ATT: Read Response (0x0b) len 6
        Value[6]: 6e696d626c65   # "nimble"

Workaround this by setting the device name once again after
BLEDevice::createServer.
WIP NimBLE-Arduino -> Arduino "BLE" (3.3.x) migration
@vidplace7 vidplace7 added the enhancement New feature or request label Apr 14, 2026
@vidplace7 vidplace7 marked this pull request as draft April 14, 2026 22:17
@github-actions github-actions Bot added the needs-review Needs human review label Apr 14, 2026
@cpatulea
Copy link
Copy Markdown
Contributor

Investigating whether remaining BLE Android issues might be related to espressif/esp-idf#18126

…arent ESP-IDF Bluetooth bug when re-connecting to Pixel 8 Android devices.

Initial pairing works, but after ESP32 is rebooted, phone fails to reconnect. Meshtastic app shows it as disconnecting immediately. LightBlue shows a more detailed error "Peripheral Connection - Warning: onConnectionStatusChange: status 61" (0x3D - MIC Failure).

Bug report to Espresssif: espressif/esp-idf#18126 (comment)
…ndroid reconnect.

Crash looks like this:
  [ 11966][E][BLEAdvertising.cpp:341] setScanResponseData(): ble_gap_adv_rsp_set_data: 22
  [ 11975][E][BLEAdvertising.cpp:1554] start(): Host reset, wait for sync.
  ERROR | ??:??:?? 11 BLE failed to start advertising
  Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

  Core  0 register dump:
  PC      : 0x420e6190  PS      : 0x00060730  A0      : 0x820e158b  A1      : 0x3fce50c0
  A2      : 0x00000000  A3      : 0x3fcb8600  A4      : 0x3fcb85cc  A5      : 0x00000000
  A6      : 0x00000000  A7      : 0x00000c03  A8      : 0x00000000  A9      : 0x3fce50b0
  A10     : 0x0000000e  A11     : 0x00000000  A12     : 0x00000010  A13     : 0x3fce50e0
  A14     : 0x00000c03  A15     : 0x00000001  SAR     : 0x0000001e  EXCCAUSE: 0x0000001c
  EXCVADDR: 0x00000000  LBEG    : 0x400570e8  LEND    : 0x400570f3  LCOUNT  : 0x00000000

  Backtrace: 0x420e618d:0x3fce50c0 0x420e1588:0x3fce5110 0x420dfe87:0x3fce5200 0x420dfefb:0x3fce5220 0x420dff3f:0x3fce5240 0x4219602b:0x3fce5260 0x4037b0e5:0x3fce5280 0x4201edf3:0x3fce52a0

Connection seems fast enough even without this. We'll investigate the
reason for the crash and re-enable once it's safe.
@vidplace7 vidplace7 changed the title WIP NimBLE-Arduino -> Arduino "BLE" (3.3.x) migration NimBLE-Arduino -> Arduino "BLE" (3.3.x) migration Apr 21, 2026
@vidplace7 vidplace7 marked this pull request as ready for review April 21, 2026 12:56
@vidplace7 vidplace7 merged commit 9da0ee9 into pioarduino Apr 21, 2026
48 of 67 checks passed
@vidplace7 vidplace7 deleted the pioarduino-nimble branch April 21, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants