nRF5 SDK v15.0.0
Beacon Transmitter Sample Application
This example requires one of the following SoftDevices: S112, S132

Important: Before you run this example, make sure to program the SoftDevice.

The Beacon Transmitter Sample Application is an example that implements a transmitter beacon using the hardware delivered in the nRF5 Development Kit.

The beacon broadcasts information to all compatible devices in its range as Manufacturer Specific Data in the advertisement packets.

This information includes:

Note
This application is not power optimized!

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\ble_peripheral\ble_app_beacon

Configuring Major and Minor values

This example implements an optional feature which allows the change of Major and Minor values used in the advertisement packets without the need to recompile the application each time. To use this feature, the compiler define USE_UICR_FOR_MAJ_MIN_VALUES should be defined during compilation. If this is done, the application uses the value of the UICR (User Information Configuration Register) located at address 0x10001080 to populate the major and minor values. Whenever the values need to be updated, the user must set the UICR to a desired value using the nrfjprog tool and restart the application to bring the changes into effect. The byte ordering used when decoding the UICR value is shown in the image below.

ble_app_beacon_maj_min_from_uicr.svg
Byte ordering used while reading UICR

See Testing for more information about how to use this feature.

Note
This application can be used as a starting point to write an iBeacon application. The procedure for creating an iBeacon application and the specification should be available at mfi.apple.com. Once the specification is obtained, this application can be modified to fit the requirements of iBeacon.

Testing

Test the Beacon Transmitter Sample Application with nRF Connect by performing the following steps:

  1. Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
  2. After starting discovery in nRF Connect, observe that the beacon is advertising with its Bluetooth device address without a Device Name.
  3. Click on Details under the beacon's address to view the full advertisement data.
  4. Observe that the Advertising Type is 'Non-connectable' and the Manufacturer Specific Data field of the Advertising Data is as follows:

    59-00-02-15-01-12-23-34-45-56-67-78-89-9A-AB-BC-CD-DE-EF-F0-01-02-03-04-C3

  1. Define the compiler define USE_UICR_FOR_MAJ_MIN_VALUES and recompile and flash.
  2. Use the nrfjprog tool to write the value 0xabcd0102 to the UICR register as follows:
    nrfjprog -f nrf52 --snr <Segger-chip-Serial-Number> --memwr 0x10001080 --val 0xabcd0102
  3. Reset the board and observe the bytes in bold below are seen in the Manufacturer Specific Data field of the Advertising Data. This indicates that the Major and Minor values have been picked up from the UICR register written in the above step.

    xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-AB-CD-01-02-xx


Documentation feedback | Developer Zone | Subscribe | Updated