NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

WL18xx TI Bluetooth Stack BT2WIFI Demo App

From Texas Instruments Wiki
Jump to: navigation, search

Return to WL18xx AM335x TI Bluetooth Stack

NoteNote: This page is currently under construction.

Demo Overview[edit]

These instructions can be used to run this demo on the AM335x Platform.

This demo allows users to evaluate TI's WL18xx device. The BLE to WIFI sample application code is provided to enable a rich out-of-box experience to the user. The application allows the user to use the WiLink8 BLE Provisioning Application on Android to provision a device to a WIFI network using BLE to send the credentials.

It is recommended that the user visits the kit setup Getting Started Guide for AM335x pages before trying the application described on this page.


Hardware Requirements[edit]

  • (TBD)


Software Requirements[edit]


Software Overview[edit]

This sample application (LinuxBT2WIFI) differs from others in the BluetopiaPM structure as it has a companion Android APK and source code designed to run concurrently with it. This allows for the user to send Wifi credentials via Bluetooth Low Energy (BLE) to connect the WiLink8 device to a secure Wifi network.


Software components[edit]

LinuxBT2WIFI C Application[edit]

LinuxBT2WIFI is a C application that includes code to initialize BLE and wait for a valid JSON packet containing credentials from the Android app. The LinuxBT2WIFI application is designed to run without the use of a terminal and as such will perform the necessary setup, such as powering on the device, automatically. Once data is received this application will parse the data and try to connect to the Wifi network with the provided credentials. It then will acknowledge the connection status back to the android application.

WiLink8 BLE Provisioning Android Application[edit]

The WiLink8 BLE Provisioning application is responsible for collecting the credentials from the user, scanning for the WiLink8 BLE device, sending the credentials, and polling a characteristic for connection status updates.


Setup and Building[edit]

Adding LinuxBT2WIFI to the makefile build[edit]

1. Add "LinuxBT2WIFI" to PM_SAMPLES for PLATFORM_MANAGER in ~/AM335xBluetopiaLinuxProduction-4.2.1.0.1.0/build/proj/platform.mak

example:

ifeq ($(PLATFORM_MANAGER),y)
        PM_SAMPLES =  LinuxAUDM LinuxDEVM LinuxHDPM LinuxHDPM_11073
        PM_SAMPLES += LinuxHIDM LinuxHRPM LinuxOPPM LinuxPBAM LinuxSPPLE_PM LinuxBT2WIFI


2. Add the following under Platform Specific Rules Definitions in ~/AM335xBluetopiaLinuxProduction-4.2.1.0.1.0/build/proj/plat-rules.mak

$(PMBINDIR)/LinuxBT2WIFI:  $(OBJDIR)/LinuxBT2WIFI_C.o $(OBJDIR)/jsmn_C.o $(PMLIBDIR)/libBTPM_C.a   $($
        @echo LN $(^F) -o $(@F)
        @$(CC)  -L$(LIBDIR) $^ $(LDFLAGS) -o $@

3. Verify that "PLATFORM_MANAGER=y in ~/AM335xBluetopiaLinuxProduction-4.2.1.0.1.0/build/proj/proj-defs.mak


Building the Source[edit]

1. Download the project from (TBD)

2. Once downloaded, copy the contents of the files to a directory in BluetopiaPM/sample ex.

cp LinuxBT2WIFI/* ~/AM335xBluetopiaLinuxProduction-4.2.1.0.1.0/BluetopiaPM/sample/LinuxBT2WIFI/

3. Then change directories to the build dir and source the configure.sh

cd ~/AM335xBluetopiaLinuxProduction-4.2.1.0.1.0/build
source configure.sh

4. After that, you should be able to make all and then copy the contents from BlutopiaPM/bin/LinuxBT2WIFI to the actual AM335x device ex.

make all
scp ~/AM335xBluetopiaLinuxProduction-4.2.1.0.1.0/BluetopiaPM/bin/LinuxBT2WIFI root@<yourIP>:~/BluetopiaPM/bin/

Building with Bluetopia[edit]

After following the Getting Started Guide for AM335x. It is only a matter of modifying a few files to get the LinuxBT2WIFI project building.


Running the Bluetooth Code[edit]

Once the AM335x is initialized on the terminal and you are logged in as root, follow the following instructions.

1. Enter to the Sample Application folder

root@am335x-evm:~# cd BluetopiaPM/bin/

2. Start the Server and the Demo application

root@am335x-evm:~/BluetopiaPM/bin# ./SS1BTPM & ./LinuxBT2WIFI


Now that the program is running it should look similar to below

BTPM_Initialize() Success: 0.
DEVM_RegisterEventCallback() Success: 5.
echo 3 > /sys/class/gpio/export
sh: line 0: echo: write error: Device or resource busy
echo out > /sys/class/gpio/gpio3/direction
echo 0 > /sys/class/gpio/gpio3/value
echo 1 > /sys/class/gpio/gpio3/value
echo 0 > /sys/class/gpio/gpio3/value
echo 1 > /sys/class/gpio/gpio3/value
BT COMM PORT (/dev/ttyS1): 1
Changing HCI baud rate to 3000000
Status: Executing BTS Script /lib/firmware/TIInit_11.8.32.bts.
Status: BTS Script successfully executed.
DEVM_PowerOnDevice() Success: 0.

Device Powered On.
GATM>DEVM_EnableBluetoothDebug(TRUE) Success.
DEVM_EnableSCOnly() Success: 0.
SC Only mode is on - LE Legacy pairing will be rejected.
DEVM_RegisterAuthentication() Success: 5.
GATM_RegisterEventCallback() Success: 1.
 Registering Service, UUID: BC65B80102957A8B1410526C8154FE6A
 Registered Service, Service ID: 1.
 Registered Characteristic, UUID: BC65B80102957A8B1410526C414DFE6A
 Registered Characteristic, UUID: BC65B80102957A8B1410526C9651FE6A
 Registered Characteristic, UUID: BC65B80102957A8B1410526C8B52FE6A
 Service Registered.
******************************************************************
   Service Start Handle: 0x4000
   Service End Handle:   0x4006

 Characteristic: : BC65B80102957A8B1410526C414DFE6A
Characteristic Declaration @ Handle: 0x4001
Characteristic Value       @ Handle: 0x4002
 Characteristic: : BC65B80102957A8B1410526C9651FE6A
Characteristic Declaration @ Handle: 0x4003
Characteristic Value       @ Handle: 0x4004
 Characteristic: : BC65B80102957A8B1410526C8B52FE6A
Characteristic Declaration @ Handle: 0x4005
Characteristic Value       @ Handle: 0x4006
******************************************************************

Local Device Properties Changed.
Device Flags: 0x80020000
LE Scan Mode:    FALSE, 0x00000000
LE Adv Mode:     TRUE, 0x000186A0
GATM>
LE Advertising Started.
GATM>DEVM_StartAdvertising() Success: Duration 100000 seconds.
Advertising Started: SUCCESS


Running the Android Application[edit]

This section provides a description of how to use the demo application to connect the Android Application to the AM335x and communicate over Bluetooth.

This demo uses a simple Client-Server connection process. We will set up the WiLink8 device as a server and android cell phone as a client. We will then initiate a connection from the client to the server. Once connected, we can transmit data between the two devices over Bluetooth.

1. Verify that the WiLink8 device has started advertising but looking for a success message in the console after starting the LinuxBT2WIFI demo, as explained above.

2. Download and install the Android WiLink8 BLE Provisioning Application.

3. Launch application, and enter the Wi-Fi SSID and password, and select "SCAN FOR BLE DEVICE"

4. Select the wilink8 device (NOTE: this app filters all BLE devices and only lists names matching `*WL18*`)

5. Observe the output of the connection attempt it should either return Connection Success or Connection Error when it is done connecting.


Licensing Information[edit]

jsmn- [1]

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article WL18xx TI Bluetooth Stack BT2WIFI Demo App here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article WL18xx TI Bluetooth Stack BT2WIFI Demo App here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article WL18xx TI Bluetooth Stack BT2WIFI Demo App here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article WL18xx TI Bluetooth Stack BT2WIFI Demo App here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article WL18xx TI Bluetooth Stack BT2WIFI Demo App here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WL18xx TI Bluetooth Stack BT2WIFI Demo App here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WL18xx TI Bluetooth Stack BT2WIFI Demo App here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article WL18xx TI Bluetooth Stack BT2WIFI Demo App here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article WL18xx TI Bluetooth Stack BT2WIFI Demo App here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity