Repository navigation
ports/nrf: Add Zephyr BLE with on-core controller support. - #22
Merged
Merged
Conversation
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 5, 2026 04:34
209f127 to
e5ef1fe
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 5, 2026 04:34
0df0fe5 to
598f9f0
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 5, 2026 05:54
e5ef1fe to
1b4ef75
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 5, 2026 05:54
598f9f0 to
f02468d
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 5, 2026 06:33
1b4ef75 to
67b0f9a
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 5, 2026 06:33
f02468d to
324c1c8
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 5, 2026 06:54
67b0f9a to
ced1184
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 5, 2026 06:54
324c1c8 to
b666c34
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 5, 2026 12:38
ced1184 to
4442799
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 5, 2026 12:38
b666c34 to
5d82670
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 6, 2026 02:53
4442799 to
08fc8bd
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 6, 2026 02:53
5d82670 to
c02a8e5
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 6, 2026 06:26
08fc8bd to
4e2de49
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
2 times, most recently
from
March 6, 2026 23:09
abf7346 to
efca591
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 6, 2026 23:09
4e2de49 to
d00aaec
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 10, 2026 08:49
efca591 to
e047fb4
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
2 times, most recently
from
March 11, 2026 11:22
4545298 to
b3e9a17
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
2 times, most recently
from
March 11, 2026 12:08
574626e to
f40367e
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
2 times, most recently
from
March 16, 2026 05:11
cdaf654 to
e04c581
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 16, 2026 05:11
f40367e to
6d2d2a6
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 16, 2026 05:56
e04c581 to
3c83b20
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 16, 2026 05:56
6d2d2a6 to
a35d098
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 16, 2026 06:36
3c83b20 to
9fed0a4
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 16, 2026 06:36
a35d098 to
6821a72
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 16, 2026 08:09
9fed0a4 to
aa4123e
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 16, 2026 08:09
6821a72 to
1e5aef0
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 16, 2026 09:32
aa4123e to
f2f7cc8
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 16, 2026 09:32
1e5aef0 to
0f44af1
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
March 16, 2026 10:15
f2f7cc8 to
6492bd2
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
March 16, 2026 10:15
0f44af1 to
633fa4b
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-nrf
branch
from
April 20, 2026 21:04
633fa4b to
9be0165
Compare
andrewleech
force-pushed
the
pr/zephyr-ble-zephyr
branch
from
April 20, 2026 21:04
6492bd2 to
45850ad
Compare
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.
Summary
Adds Zephyr BLE support to the nRF port (PCA10056 DK and PCA10059 dongle) using the Zephyr BLE host stack with an on-core BLE controller. Unlike the RP2 and STM32 integrations which rely on external BLE controllers (CYW43, STM32WB M0+), the nRF52840 runs the Zephyr BLE controller directly on the application core alongside MicroPython.
This required building the full Zephyr BLE controller (link layer, radio HAL, ticker) against the HAL shim layer, plus IRQ management shims that bridge Zephyr's
irq_connect_dynamic()/irq_enable()/irq_disable()to NVIC operations. The controller's radio ISR and ticker timing run at hardware interrupt priority while the host stack processes events cooperatively from the main task viamp_sched_schedule_node().Also adds SysTick, soft timer, and PendSV dispatch infrastructure to the nRF port which were previously missing and are needed for the scheduler-based BLE polling.
Depends on #21.
Testing
12/12 BLE multitests passing on nRF52840 DK with PYBD as central, and 12/12 Z2Z (DK as peripheral + PCA10059 dongle as central). Bond persistence test passes via the SUSPENDED mode reactivation path (on-core controller can't cleanly restart after
bt_disable()).Performance: ~35ms/notification (GATT), ~2184 B/s (L2CAP) with PYBD; ~25ms/notification, ~2681 B/s Z2Z.
428KB flash (42%), ~220KB RAM (84%) on PCA10056.
Trade-offs and Alternatives
The on-core controller means
bt_disable()can't cleanly shut down and restart the radio — the Zephyr controller wasn't designed for this. Instead,ble.active(0)enters a SUSPENDED state that stops advertising/scanning/connections but leaves the stack running. This wastes some power but avoids the need for a full chip reset to reinitialise.The
hci_driver_wrapper.cwraps Zephyr'shci_driver.cto expose file-scope variables for RX polling, avoiding a submodule patch.Generative AI
I used generative AI tools when creating this PR, but a human has checked the code and is responsible for the description above.