AoA Sender

Table of Contents

Introduction

The AoA_Sender software project implements a simple Bluetooth low energy peripheral device with GATT services and sends out special angle of arrival packets to enable real time locationing. This project can be run on the CC2640R2 Launchpad or any other CC2640R2F platforms. In order to have a meaningful demo, we recommend running this demo with AoA_Receiver software project.

Hardware Prerequisites

The default AoA Sender configuration uses the LAUNCHXL-CC2640R2 The required hardware is shown in the below image:

Software Prerequisites

For information on what versions of Code Composer Studio and IAR Embedded Workbench to use, see the SimpleLink CC2640R2 SDK release note located in the docs folder. For information on how to import this project into your IDE workspace and build/run, please refer to The CC2640R2F SDK Platform section in the BLE-Stack User’s Guide for Bluetooth 4.2.

Functional Description

Software Overview

This section describes software components and the corresponding source file.

Application

Project Files Description
aoa_sender.c Top level application. Initialization of hardware, connection settings, button handling and AoA packets scanning.
AOA.c Implements the AoA control functions. Extracts IQ data, rssi value and channel from the received packets and translates the phase difference into angle.

Upon choosing AoA Advertising, CC2640R2F will send out special packets which contains AoA header, AoA padding bytes,

TI company ID and followed by a tone(0xFF). You can find the packet setup in AOA.c

If you want to have more than one sender and for the receiver to be able to distinguish them, then you can use advData[5:10], which are padding bytes, to customize your AoA packets.

    static void transmitterInitAdvData(uint8_t *advData, uint8_t packetId)
    {
        // Initialize header
        advData[0] = AOA_ADV_HDR_LEN + AOA_ADV_PADDING_LEN + AOA_ADV_TONE_LEN;
        advData[1] = 0xFF;
        advData[2] = (COMPANY_ID_TEXAS_INSTRUMENTS & 0xFF);     // TI Company ID
        advData[3] = (COMPANY_ID_TEXAS_INSTRUMENTS >> 8);       // TI Company ID
        advData[4] = packetId;   // Packet ID, for receiver to filter

        for (uint8_t i = AOA_ADV_TONE_OFFSET; i < AOA_ADV_LEN; i++)
        {
          advData[i] = 0xFF;    // DF_extension, first 2 bytes are still for padding
        }
    }

Also the whitening of the packet is turned off, which is set in AOA.c

    // CMD_BLE_Advertisor
    rfc_CMD_BLE_ADV_NC_t RF_cmdBleAdvNc =
    {
        .commandNo = CMD_BLE_ADV_NC,
        .status = 0x0000,
        .pNextOp = 0,             // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .channel = 37,
        .whitening = 0,
        .pParams = &RF_bleAdvPar,
        .pOutput = NULL,
    };

The AoA_Sender has AoA Service(AOAPROFILE_SERVICE_UUID) with one characteristic AOAPROFILE_AOA_START. When the AOAPROFILE_AOA_START is set to 1, the AoA_Sender will send out AoA packets without any button press. When the AOAPROFILE_AOA_START is set to 0, the AoA_Sender will stop sending out AoA packets.

In order to have correct timing for the AoA packets, it’s recommended to turn off UART logging when running the demo, so the application overhead between each TX packet can be minimized.

Usage

This application uses the UART peripheral to provide an interface for the application. This document will use PuTTY to serve as the display for the output of the CC2640R2 LaunchPad. The following default parameters are used for the UART peripheral for display:

UART Param Default Values
Baud Rate 115200
Data length 8 bits
Parity None
Stop bits 1 bit
Flow Control None

Once the AoA_Sender sample application starts, the output to the terminal will report its address and the fact that it is initialized and ready to begin discovery, as shown below:

As shown, the left button (BTN-1 on the CC2640R2 LaunchPad) can be pressed to swtich from sending normal advertising packets to AoA advertising packets.

Then press the right button (BTN-2 on the CC2640R2 LaunchPad) after switching to AoA Scan, if there is any AoA Packets transmitting, you will see the following from terminal.

How to interpret the numbers :

Variable Value Range Description
channel 37 or 38 or 39 Advertising channel that sends AoA packets
ID 3 or 4 3 is for AoD packets, 4 is for AoA packets