Configuring the Bluetooth device address in CYW20706
Anonymous
Not applicable
Jan 24, 2018
10:47 PM
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Jan 24, 2018
10:47 PM
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:
- Using the API wiced_bt_set_local_bdaddr(wiced_bt_device_address_t bda, wiced_bt_ble_address_type_t addr_type)
- This API needs to be called after the stack is initialized, i.e. after the BTM_ENABLED_EVT.
- This API takes 2 parameters: the 6-byte device address and the address type.
- This is useful when you want to change the BD_ADDR during runtime.
- Using the BT_DEVICE_ADDRESS make option during build
- In the make target, you can include this optional parameter to set the BD_ADDR to the desired value.
- For example, demo.hello_sensor-CYW920706WCDEVAL download BT_DEVICE_ADDRESS=AABBCCDDEEFF.
- The BT_DEVICE_ADDRESS can also be set to random to make use of a random address.
- Using the Factory_Commit_BD_ADDR VSC (Vendor Specific Command) to store the device address in flash.
- There are 2 steps to this procedure:
- 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.
- 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.
- The Factory_Commit_BD_ADDR VSC has the below format:
- Opcode: 0xFC10
- Parameters Length: 7 bytes
- Parameters: 6 byte address followed by 0x00
- Example: 01 10 FC 07 AA BB CC DD EE FF 00
- You can either send this HCI command over HCI UART or use wiced_bt_dev_vendor_specific_command WICED API in your application.
- Example: wiced_bt_dev_vendor_specific_command(0x10, 7, bd_addr_param, addr_callback);
- 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.
- 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.
- This method is most suitable for setting unique address for every device during production.
- There are 2 steps to this procedure:
Labels
Rate this article: