Bluetooth devices have a 48-bit address which is usually termed as BD_ADDR. For BR/EDR devices, there are three parts to this address: NAP, UAP and LAP whereas for BLE devices, the BD_ADDR consists of two parts: Company-ID and Company Assigned part. For more information regarding BD_ADDR and their formats, kindly refer to the BLE SIG specification.

 

On CYW20706, a single BD_ADDR is defined which is common for both BLE and BR/EDR applications. The BD_ADDR can be configured in the following ways:

  1. Using the API wiced_bt_set_local_bdaddr(wiced_bt_device_address_t bda, wiced_bt_ble_address_type_t addr_type)
    1. This API needs to be called after the stack is initialized, i.e. after the BTM_ENABLED_EVT.
    2. This API takes 2 parameters: the 6-byte device address and the address type.
    3. This is useful when you want to change the BD_ADDR during runtime.
  2. Using the BT_DEVICE_ADDRESS make option during build
    1. In the make target, you can include this optional parameter to set the BD_ADDR to the desired value.
    2. For example, demo.hello_sensor-CYW920706WCDEVAL download BT_DEVICE_ADDRESS=AABBCCDDEEFF.
    3. The BT_DEVICE_ADDRESS can also be set to random to make use of a random address.
  3. Using the Factory_Commit_BD_ADDR  VSC (Vendor Specific Command) to store the device address in flash.
    1. There are 2 steps to this procedure:
      1. First, set the device address to all 0xFFs by making use of the BT_DEVICE_ADDRESS=FFFFFFFFFFFF in the make target and download your application.
      2. Then, send the Factory_Commit_BD_ADDR vendor specific HCI command. This needs to be done only for the first time after the device is programmed.
    2. The Factory_Commit_BD_ADDR VSC has the below format:
      1. Opcode: 0xFC10
      2. Parameters Length: 7 bytes
      3. Parameters: 6 byte address followed by 0x00
      4. Example:  01 10 FC 07 AA BB CC DD EE FF 00
    3. You can either send this HCI command over HCI UART or use wiced_bt_dev_vendor_specific_command WICED API in your application.
      1. Example: wiced_bt_dev_vendor_specific_command(0x10, 7, bd_addr_param, addr_callback);
      2. Note that if you are sending the HCI command over HCI UART, you will have to send a HCI reset command (01 03 0C 00) before sending the VSC.
    4. If the device address is configured using these steps, then this address can be overwritten only by reprogramming the device, not otherwise. However, the wiced_bt_set_local_bdaddr()  API can still be used to change the address to be used but this API does not overwrite the address stored in flash.
    5. This method is most suitable for setting unique address for every device during production.