This project implements a dual-MCU system for capturing BLE advertisements and forwarding them into a Wirepas Mesh network. It uses:
- EFR32MG26 (Silicon Labs) for BLE scanning and CBOR encoding.
- nRF9151 (Nordic) for receiving this data over UART, framing it using WAPS (Wirepas Application Protocol for Serial), and injecting it into the mesh.
This solution is ideal for BLE beacon harvesting, low-power wide-area sensing, and distributed mesh communication scenarios.
- A[BLE Advertisement] --> B[EFR32MG26 BLE Scanner]
- B --> C[CBOR Encoding]
- C --> D[UART WPC Transmission]
- D --> E[nRF9151 Dual-MCU App]
- E --> F[WAPS Frame Creation]
- F --> G[Mesh Network via Wirepas Stack]
- Scans BLE advertisements (legacy + extended).
- Extracts MAC address, RSSI, and payload.
- Encodes the data using CBOR for compact serialization.
- Transmits it via UART using a custom WPC protocol format.
See
BLEScanner.c,handle_scanner_event,encode_ble_advertisement_to_cbor, andsend_ble_data_via_wpc.
- Receives encoded CBOR data via UART.
- Parses it using WAPS (DSAP, MSAP, HSAP handlers).
- Injects it into the Wirepas Mesh using the correct endpoints.
See
dual_mcu_app,waps_uart.c, anddsap_data_tx_req_tusage.
-
EFR32MG26 passively scans BLE advertisements using Silicon Labs’ Bluetooth stack.
-
On receiving an ad:
- It parses the MAC, RSSI, and data.
- Encodes the result in CBOR.
- Sends the payload using a WPC-compatible UART frame.
-
nRF9151 receives this data via UART.
- SLIP decoding and CRC verification occur.
- It wraps the payload in a
waps_frame_tstructure (DSAP). - The data is injected into the mesh via the Wirepas stack.
- BLEScannerTask: Initializes serial port and starts BLE scanning.
- sl_bt_on_event: Dispatches events from the Bluetooth stack.
- handle_scanner_event: Extracts, logs, encodes, and transmits BLE data.
- encode_ble_advertisement_to_cbor: Compresses advertisement info.
- send_ble_data_via_wpc: Formats the payload and sends it over UART.
sl_bt_evt_scanner_legacy_advertisement_report_idsl_bt_evt_scanner_extended_advertisement_report_id
-
Dual-MCU setup with
Dualmcu_lib_init()to manage UART reception. -
Uses
waps_frame_twith:DSAP_DATA_TX_REQUEST_CODE- Matching source/destination endpoints
-
No dynamic provisioning: All credentials (network address, channel, keys) are hardcoded in
config.mk.
default_network_address ?= 5000
default_network_channel ?= 1
default_network_authen_key ?= 0x12,...,0x12
default_network_cipher_key ?= 0x12,...,0x12Provisioning must be completed at build time.
-
Encoding: SLIP with CRC
-
Structure:
sfunc,sfid,splen, payload (CBOR)
-
Data is placed in
dsap_data_tx_req_t:
req->apdu_id = frame.sfid;
req->src_endpoint = BLE_SCAN_ENDPOINT;
req->dst_endpoint = BLE_SCAN_ENDPOINT;
req->apdu_len = cbor_len;
memcpy(req->apdu, cbor_buf, cbor_len);- Silicon Labs Bluetooth SDK
- Wirepas Protocol Controller SDK
- CBOR library
- FreeRTOS
- UART driver
- Wirepas SDK (dual MCU stack)
- WAPS (waps_uart.c, waps.c)
- HAL for UART and GPIO
- SLIP/CRC utilities
project_root/
├── efr32_ble_scanner/
│ ├── BLEScanner.c
│ ├── app.c
│ └── cbor_utils.c
├── nrf91_wirepas_node/
│ ├── source/
│ │ └── reference_apps/dualmcu_app/
│ ├── libraries/dualmcu/waps/
│ ├── config.mk
├── README.md
- Use
printf()or UART/RTT output for logs. - EFR32: Logs BLE packet reception, CBOR encoding steps.
- nRF9151: Can log frame reception and parsing.
- Wireshark (with a Wirepas sniffer node) can be used for mesh analysis.
- UART Settings: Match baudrate and flow control on both MCUs.
- Endpoints: Define custom
BLE_SCAN_ENDPOINTfor application routing. - CBOR Fields: Modify
encode_ble_advertisement_to_cborto include additional sensor or tag fields.