Add an nRF52 2.4GHz bridge that mirrors the ESP-NOW one - #3219
Draft
ViezeVingertjes wants to merge 1 commit into
Draft
Add an nRF52 2.4GHz bridge that mirrors the ESP-NOW one#3219ViezeVingertjes wants to merge 1 commit into
ViezeVingertjes wants to merge 1 commit into
Conversation
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.
Bridging already works on nRF over RS232, but the wireless transport was ESP32-only. This adds the nRF equivalent using Nordic's 1 Mbit proprietary mode: one fixed address every bridge shares, no pairing or acknowledgement, which is what ESP-NOW's broadcast peer amounts to.
The two radios are not compatible on air. An nRF bridge only pairs with another nRF bridge.
Same behaviour as ESP-NOW
Same frame format (magic
0xC03E, Fletcher-16, XOR withbridge_secret), same duplicate suppression, samebridge.delay/bridge.source/bridge.enabledhandling.bridge.channelkeeps its Wi-Fi 1-14 numbering and maps onto the same centre frequencies, so a channel means the same thing on either platform and the persisted prefs are unchanged. An out-of-range channel is refused rather than corrected, matching ESP-NOW, whereesp_wifi_set_channel()rejects it and the bridge does not start.get bridge.typereturnsnrf, and the advert features byte uses0x05. Clients decoding that byte need to learn the new value.Interrupt context
RADIO reports frames in an interrupt rather than on a driver task, and the packet pool, inbound queue and seen-packet table have no locking. The handler copies the frame into a small ring buffer and
loop()turns those into mesh packets on the main task. This is the one structural difference fromESPNowBridge, which can do that work in its callback.SoftDevice
The nRF52 has one RADIO and the SoftDevice owns it whenever BLE is up, so the bridge refuses to start while the SoftDevice is enabled, and
start otanow stops the bridge before bringing it up. That guard helps ESP32 too, where OTA wants the Wi-Fi interface ESP-NOW is holding.Testing
Unit tests cover the channel mapping. Builds clean for
RAK_4631_repeater_bridge_nrf(15.1% RAM, 53.3% flash), and the RS232 and ESP-NOW targets still build.