Skip to content

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

Merged
vidplace7 merged 7 commits into
meshtastic:pioarduino-nimblefrom
vidplace7:pioarduino-nimble
Apr 14, 2026
Merged

WIP NimBLE-Arduino -> Arduino "BLE" (3.3.x) migration#9132
vidplace7 merged 7 commits into
meshtastic:pioarduino-nimblefrom
vidplace7:pioarduino-nimble

Conversation

@vidplace7

@vidplace7 vidplace7 commented Dec 31, 2025

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.

@vidplace7 vidplace7 added the enhancement New feature or request label Dec 31, 2025
@vidplace7 vidplace7 force-pushed the pioarduino-nimble branch 3 times, most recently from 34b9010 to 33f28b0 Compare January 2, 2026 15:19
@phaseloop

Copy link
Copy Markdown
Contributor

Linking upstream issue that causes BLE to not work:

espressif/arduino-esp32#12198

@vidplace7

vidplace7 commented Jan 13, 2026

Copy link
Copy Markdown
Member Author

Linking upstream issue that causes BLE to not work:

espressif/arduino-esp32#12198

Fixed upstream espressif/arduino-esp32#12234.
Awaiting arduino-esp32 3.3.6 release and pioarduino/platform-espressif32 55.03.36 release.

@vidplace7 vidplace7 force-pushed the pioarduino-nimble branch 17 times, most recently from e66d87b to 0d077d9 Compare January 23, 2026 19:09
@cpatulea

cpatulea commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

FYI build & run tested on Heltec v3

$ PLATFORMIO_BUILD_CACHE_DIR=.cache pio run -e heltec-v3 -t upload -t monitor
...
RAM:   [====      ]  37.3% (used 122308 bytes from 327680 bytes)
Flash: [=======   ]  70.0% (used 2340827 bytes from 3342336 bytes)
  • LoRa rx seems to work
  • Wifi seems to work
    • [edit] TLS seems to NOT work. Too much heap fragmentation
  • BLE NOT tested

I'm interested in this because NimBLE can unblock --> pioarduino (#9122) --> can unblock setting custom sdkconfig (CONFIG_MBEDTLS_DYNAMIC_BUFFER) --> can maybe fix Chrome web client TLS problems #6960

--

[edit] Comparing heap stats before (master branch) and after (pioarduino branch)

master:

Heap summary for capabilities 0x00000004:
  At 0x3fcb9558 len 197048 free 53168 allocated 137296 min_free 48076
    largest_free_block 51188 alloc_blocks 352 free_blocks 12 total_blocks 364
  At 0x3fce9710 len 22308 free 0 allocated 20432 min_free 0
    largest_free_block 0 alloc_blocks 71 free_blocks 0 total_blocks 71
  At 0x3fcf0000 len 32768 free 40 allocated 29244 min_free 40
    largest_free_block 0 alloc_blocks 171 free_blocks 3 total_blocks 174
  At 0x600fe02c len 8132 free 7740 allocated 0 min_free 7740
    largest_free_block 7668 alloc_blocks 0 free_blocks 1 total_blocks 1
  Totals:
    free 60948 allocated 186972 min_free 55856 largest_free_block 51188

pioarduino:

Heap summary for capabilities 0x00000004:
  At 0x600fe060 len 8056 free 7664 allocated 0 min_free 7664
    largest_free_block 7156 alloc_blocks 0 free_blocks 1 total_blocks 1
  At 0x3fce9710 len 22308 free 0 allocated 20272 min_free 0
    largest_free_block 0 alloc_blocks 81 free_blocks 0 total_blocks 81
  At 0x3fcf0000 len 32768 free 32020 allocated 0 min_free 32020
    largest_free_block 31732 alloc_blocks 0 free_blocks 1 total_blocks 1
  At 0x3fcb84c8 len 201288 free 22740 allocated 169516 min_free 17464
    largest_free_block 21492 alloc_blocks 505 free_blocks 10 total_blocks 515
  Totals:
    free 62424 allocated 189788 min_free 57148 largest_free_block 31732

@cpatulea

Copy link
Copy Markdown
Contributor

For the issue with Device Name changing to "nimble" after pairing: vidplace7#2

@cpatulea cpatulea mentioned this pull request Feb 24, 2026
cpatulea and others added 5 commits March 2, 2026 09:31
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  meshtastic#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             meshtastic#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.
@vidplace7 vidplace7 changed the base branch from pioarduino to pioarduino-nimble April 14, 2026 22:09
@vidplace7

Copy link
Copy Markdown
Member Author

Moving this to a branch in-org pioarduino-nimble

@vidplace7 vidplace7 marked this pull request as ready for review April 14, 2026 22:11
@vidplace7 vidplace7 merged commit d9ee3d6 into meshtastic:pioarduino-nimble Apr 14, 2026
10 of 19 checks passed
@vidplace7 vidplace7 deleted the pioarduino-nimble branch April 14, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants