Repository navigation
bledev.cpble: the CircuitPython backend over _bleio - #90
Merged
Merged
Conversation
Both roles. Waits are short polls of _bleio's objects; writes land in PacketBuffer (notify characteristics) or CharacteristicBuffer (the rest). Notifications go in as the header of an empty PacketBuffer.write(), which steps around CircuitPython 10.3's stall when NimBLE's buffer pool runs dry and keeps each notification whole. The reported MTU is capped at 247. auto picks cpble where _bleio exists; nus and midi accept a raw _bleio.adapter; midi's clock uses supervisor.ticks_ms on CircuitPython. The board scripts for nus, the GATT contract and midi run on CircuitPython, and cpfiles_client/cpfiles_discovery reach CircuitPython's own file service.
…rpreter; nus_client runs on CircuitPython
… the CircuitPython PacketBuffer draft
…ow-setup hint, sticky scan names, order across characteristics; board scripts and docs
This was referenced Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bledev.cpble, the CircuitPython backend over_bleio, both roles. Stacked on #88 (bledev-pairing).It works on
_bleiodirectly rather thanadafruit_ble: bledev already has the partsadafruit_bleadds (advertisement packing, a service model, a UART stream), so leaning on it would mean translating between two service models and installing a library for no gain. Every_bleiocall it makes is oneadafruit_blewould make anyway.What passed on hardware (LilyGO T-Embed, CircuitPython 10.3.0, laptop through bleak; details in
docs/bledev-internals.md, "CircuitPython (cpble)"). Every planted fault failed its gate.gatt_central.py --mtu 256), BLE-MIDI's 1,000-message gate (latency the same as against a MicroPython S3: 52.1 ms median, 13.3 ms with throughput parameters).bledev.filetransfer.connect(): it pairs by itself, 20 KB up and down byte for byte, and reconnects from the bond.tests/bledev_board/cpfiles_discovery.pyputs the board in discovery mode without a hand on the reset button.tests/test_bledev_cpble.py, beside stub-_bleiochecks of what cpble adds.A CircuitPython bug, and the build it needed. On the official 10.3.0 build,
PacketBufferon the ESP32 stalls a notification stream for good when NimBLE's buffers run dry, and can hard-fault the board after a refused notification (2 of 11 nus runs restarted in safe mode; the file service's 20 KB download stalled 2 of 2 times). cpble steps around the stall by writing each notification as theheader=of an empty write, but only a firmware fix removes the fault. The fix and an upstream draft are indocs/upstream-reports/cp-packetbuffer-notify-stall.{md,patch}, for Brad to post (not posted, not pushed anywhere). The gates above ran on 10.3.0 with that patch.Not finished: CircuitPython as central running the full nus gate against the LCD-7. In a probe it found, connected, discovered, subscribed and wrote, but
nus_client.pyitself hung, likely mpftp garbling the long paste (seen elsewhere in the run), and the LCD-7 went back to another session before it was settled.Also in here:
bledev.connect_and_set_uphonours a backend'smin_setup_ms(CircuitPython waits 2 s on every write with response, subscribing included);autopicks cpble; nus and midi take a raw_bleio.adapter.Packaging question left open: CircuitPython has no mip, so cpble ships in the
bledevmip package (one unused file on a MicroPython board) and in pydevices-desktop.