Skip to content

Add optional LE Coded PHY upgrade for established Bitle BLE links - #9

Open
SHLOK333 wants to merge 1 commit into
bitleproject:mainfrom
SHLOK333:feat/ble-coded-phy-upgrade
Open

SHLOK333 wants to merge 1 commit into
bitleproject:mainfrom
SHLOK333:feat/ble-coded-phy-upgrade

Conversation

@SHLOK333

Copy link
Copy Markdown

Once a direct BLE link to another Bitle node is confirmed via a signature-verified ANNOUNCE (using the existing is_infra TLV, already trusted for clock-authority decisions), this change opportunistically requests the Link Layer PHY Update procedure to LE Coded PHY for that connection, improving link margin at the edge of range.

This change never affects phone connections or advertising: the PHY update is only requested after an authenticated ANNOUNCE confirms the peer is another Bitle relay, not a phone, and legacy 1M discovery and advertising remain unchanged. The request is non-binding (BLE_GAP_LE_PHY_CODED_ANY leaves the S=2/S=8 coding decision to the Bluetooth Link Layer), so either controller may decline it, in which case the connection simply continues on its existing PHY. The PHY update is attempted at most once per connection using per-link state.

Expected behavior:

  • If both Bitle nodes and their Bluetooth controllers support LE Coded PHY, the implementation requests a PHY update shortly after mutual infrastructure authentication.
  • If the request is rejected or unsupported, the connection continues unchanged on its existing PHY. This is treated as normal operation rather than an error.
  • Phone discovery, advertising, and phone↔Bitle connections are unaffected.
  • This does not increase discovery range between Bitle nodes; discovery still occurs over the existing legacy 1M PHY. It improves the robustness of a connection that has already been established.
  • No protocol or packet format changes are introduced.

Verification:

  • Builds cleanly on ESP-IDF v6.0 for both esp32c3 and esp32s3.
  • No new compiler warnings introduced in the modified files.
  • API usage was verified against ESP-IDF's vendored NimBLE implementation (ble_gap_set_prefered_le_phy, BLE_GAP_LE_PHY_CODED_ANY, BLE_GAP_EVENT_PHY_UPDATE_COMPLETE) and Apache Mynewt's reference implementation.

Not yet hardware-validated on physical Bitle nodes. The implementation builds cleanly and the API usage has been verified, but successful PHY negotiation should be confirmed with a real two-node test before merge, particularly given the historical issues around LE Coded PHY support in NimBLE.

Once a direct BLE link to another Bitle node is confirmed via a
signature-verified announce (the existing is_infra TLV, already trusted
for clock-authority and OTA-offer decisions), opportunistically request
the Link-Layer PHY Update procedure toward LE Coded PHY on that
connection for better link margin at the edge of range.

This never touches phone connections or advertising: the request only
fires once an authenticated announce shows the peer is another Bitle
relay, not a phone, and legacy 1M discovery/advertising is unchanged.
It is a non-binding preference (BLE_GAP_LE_PHY_CODED_ANY leaves the
S=2/S=8 coding choice to the Link Layer) — either side's controller may
decline, and the link simply continues on whatever PHY it already had.
Attempted at most once per connection via a per-link settle state.

Not yet hardware-validated on real Bitle nodes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant