The ble_addr_toggle snippet application demonstrates how to change the Bluetooth MAC address. The app starts advertising with the default MAC address on the board. Pressing the user button on the WICED eval board will toggle the MAC address between two predetermined MAC addresses. Please note that the MAC addresses used are for demonstration only and do not follow the specifications for MAC address. To follow the demonstration, you will need two combo WICED based eval boards, or a WICED based eval board and a Bluetooth enabled device to scan for the MAC address.

 

Step by Step Walkthrough:

If using a non-WICED device to scan for your BT MAC address, skip to step 4.

 

  1. Configure your wifi_config_dct.h in the demo.bt_smartbridge folder. The WICED board will need to connect to an access point to display the scan data.
  2. Build and run the demo.bt_smartbridge app on your first WICED device using the target "demo.bt_smartbridge-<PLATFORM> download run".
  3. Disconnect the WICED board or the next steps might be applied to this board instead of the second board.
  4. Download the attached file and unzip the folder into apps/snip.
  5. Build and run the ble_addr_toggle app on your second WICED device using the target "snip.ble_addr_toggle-<PLATFORM> download run".
  6. Reconnect the first WICED board or start your non-WICED device to start scanning to Bluetooth devices.
  7. Start two instances of a terminal program (e.g. teraterm, putty, etc) to view the output from the boards.
  8. Open a web browser and navigate to the SmartBridge Demo Application web page. The IP address can be found on the terminal output from the board running the bt_smartbridge app.
  9. web1.PNG
  10. Connect/reset the board running the ble_addr_toggle app. The board will start advertising with the default MAC address and a device name of "HELLO".
  11. cmd1.PNGweb2.PNG
  12. Press the button on the WICED board (SW2) to change the MAC to the first of the predetermined addresses. This by default is 00:00:00:00:00:00.
    You can uncomment the last line in ble_addr_toggle.mk to inclue the wiced_bt_cfg.h file. This file will override the first predetermined MAC address with the one defined in wiced_bt_cfg.h. The address, by default, is 11:22:33:AA:BB:CC.
    NOTE: The app may seem unresponsive because 10 seconds are allocated to deinitialize and reinitialize the Bluetooth stack.
  13. Press "Rescan" on the webpage to scan and update the list of Bluetooth devices.
  14. wiced_bt_cfg not inlcuded:
    cmd2.PNGweb3.PNG
    wiced_bt_cfg included:
    cmd4.PNG
    web5.PNG
  15. Press the button on the WICED board again to change the MAC address to the second predetermined MAC address. This by default is FF:FF:FF:FF:FF:FF.
  16. Press "Rescan" on the webpage to scan and update the list of Bluetooth devices.
  17. cmd3.PNG
    web4.PNG
  18. Pressing the button further will continue to toggle the MAC address between the two preconfigured addresses.

 

The API call to change the Bluetooth address is wiced_bt_set_local_bdaddr ( wiced_bt_device_address_t )