This information applies to the following SoCs: nRF52833 and nRF52840.
This example does not support the SES compiler.
This example requires the following SoftDevice: S140
Important: Before you run this example, make sure to program the SoftDevice.
This BLE-Thread dynamic multiprotocol example requires you to run on the second board any complementary example that contains Thread CoAP Server functionality, for example:
For more information about multiprotocol support, see Multiprotocol support with BLE/Bluetooth.
This example application is based on the Eddystone example available in nRF5 SDK. It has been extended to support dynamic switching between two connection modes, BLE and Thread, at the same time (concurrently). Thread operates on the 802.15.4 radio during Bluetooth low energy radio's inactive time (using Timeslot API). Depending on the Bluetooth low energy connection interval, the nRF52 device can spend up to 99% of the radio time on the Thread protocol.
This example also supports the Thread CoAP Server role, as described in the CoAP Server example.
The application works similarly to ble_app_eddystone
, using Nordic's BLE Eddystone implementation.
- Note
- Transmitting and receiving data does not break connections from any of the used radio protocols (BLE or Thread).
Setup
You can find the source code and the makefile in the following folder: <InstallFolder>\examples\multiprotocol\ble_thread\ble_thread_dyn_coap_srv_eddystone
.
LED assignments
The publisher uses LED assignments as described in Thread BSP LED and button reference for the following LEDs:
- LED1 – Used to indicate the network connection state (on when advertising connectable advertisements).
- LED2 – Used to indicate the commissioning state (on when the device is in BLE connection).
The following LEDs reserved for user application purposes are assigned in this example on the server:
- LED3 – Blinking when provisioning is allowed.
- LED4 – Can be controlled by the CoAP client.
Button assignments
The following buttons reserved for user application purposes are assigned in this example on the server:
- Button 1 – Switch to connectable mode allowing for configuration from nRF Beacon for Eddystone.
- Button 4 – Allow provisioning.
The following buttons are assigned in this example on the client:
- Button 1 – Toggles LED4 on the server board (after provisioning).
- Button 2 – Toggles LED4 on the server board (before provisioning).
- Button 4 – Allow provisioning.
Testing
- Note
- The following testing procedure uses the nRF52840 device.
- Prepare two nRF52840 Preview Development Kits and an Android smartphone (you can also use an iOS smartphone).
- On the smartphone, install nRF Beacon for Eddystone.
- Run the following commands to flash the CoAP Client example to one of the boards:
$ cd <InstallFolder>/examples/thread/simple_coap_client/hex
$ nrfjprog -f nrf52 -r --program nrf52840_xxaa_pca10056.hex --chiperase
- Install Install micro-ecc. This library is required by the Cryptography library .
- Build the example according to the instructions in Building examples.
- Flash SoftDevice and the example according to the instructions in Running examples.
- You can toggle LED4 on server boards in the network by pressing Button 2 on the client board.
- You can provision a client with the server by pressing Button 4 on the server board and then pressing Button 4 on the client board.
- Once the boards are provisioned, you can toggle LED4 on the server board by pressing Button 1 on the provisioned client board.
- Android phones will detect Eddystone beacons using the Nearby service, but you can also use nRF Connect to view the Eddystone beacons.
- Press Button 1 and open nRF Beacon for the Eddystone app.
- Go to Update tab and tap Connect.
- Select nRF5x_Eddys and tap Unlock when prompted.
You can now configure your Eddystone beacon.