nRF51 SDK: Beacon Application for Eval Board

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Beacon Application for Eval Board

# Beacon Transmitter Sample Application

The Beacon Transmitter Sample Application is a firmware example that implements a transmitter beacon using the Nordic nRF51822 evaluation board.

The source code and project file can be found in the `<InstallFolder>\Nordic\nrf51822\Board\pca10001\s110\ble_app_beacon` folder.

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

This information includes:

- A 128-bit UUID to identify the beacon's provider.
- An arbitrary Major value for coarse differentiation between beacons.
- An arbitrary Minor value for fine differentiation between beacons.
- The RSSI value of the beacon measured at 1 meter distance that can be used for estimating the distance from the beacon.

Note
  This application is not power optimized!

# Setup

LED assignments:

- LED 0: Advertising

# 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 and to populate the major and minor values. Whenever the values need to be updated, the user would have to 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.

Byte ordering used while reading UICR

See Testing for more on 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 https://mfi.apple.com. Once the specification is obtained, this application can be modified to fit the requirements of iBeacon.

# Testing

The Beacon Transmitter Sample Application can be tested using the Master Control Panel as follows:

1. Compile and program the application. Observe that the Advertising LED is lit.
2. After starting discovery in the Master Control Panel main window, observe that the Beacon is advertising with its Bluetooth device address as its Device Name.
3. Click the plus sign next to the Beacon's address to view the full advertisement data.
4. Observe that the Advertising Type is 'Non-connectable' and the Advertising Data is as it is set in the application.
5. Define the compiler define USE_UICR_FOR_MAJ_MIN_VALUES and recompile and flash.
6. Using nrfjprog tool write the value 0xabcd0102 to the UICR register as follows.
   `nrfjprog --snr <Segger-chip-Serial-Number> --memwr 0x10001080 --val 0xabcd0102`

7. Reset the board and observe the bytes in bold below are seen in the Manufacturer Specific Data field of the advertisement 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