8
A Embedded Wireless Solutions Support Center: http://ews-support.lairdtech.com www.lairdtech.com/wireless 1 © Copyright 2015 Laird. All Rights Reserved Americas: +1-800-492-2320 Europe: +44-1628-858-940 Hong Kong: +852 2923 0610 Bluetooth SPP Connection to Apple OS X BT900-US Application Note v1.0 INTRODUCTION This guide is designed to demonstrate how to connect the BT900-US to an Apple computer running OS X via the Serial Port Profile. We will connect the BT900-US via USB to the Apple computer, and then establish a Bluetooth connection with the computer’s native Bluetooth adapter. REQUIREMENTS BT900-US (with latest firmware https://www.lairdtech.com/products/BT900-US > Software Downloads) Macbook or Apple Computer with BT capabilities USB-C to multiple USB adapter (If needed to plug the BT900’s USB-A type connector into your computer) UWTerminalX software (https://github.com/LairdCP/UwTerminalX/releases) BT900-Applications-master.zip (https://github.com/LairdCP/BT900-Applications) HARDWARE AND SOFTWARE SETUP To begin, connect the BT900-US to the Apple computer via USB. If required, a USB-C hub can be used to provide the correct connector type to the computer for the BT900-US, as shown in Figure 1. Figure 1: BT900 (1) connected to USB hub (2), and hub connected to Apple computer via USB-C (3) 1 2 3

Bluetooth SPP Connection to Apple OS X · Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX. ... Figure 11: New terminal window and

  • Upload
    lymien

  • View
    227

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Bluetooth SPP Connection to Apple OS X · Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX. ... Figure 11: New terminal window and

A

Embedded Wireless Solutions Support Center: http://ews-support.lairdtech.com www.lairdtech.com/wireless

1 © Copyright 2015 Laird. All Rights Reserved

Americas: +1-800-492-2320 Europe: +44-1628-858-940

Hong Kong: +852 2923 0610

Bluetooth SPP Connection to Apple OS X BT900-US

Application Note v1.0

INTRODUCTION This guide is designed to demonstrate how to connect the BT900-US to an Apple computer running OS X via the Serial Port Profile. We will connect the BT900-US via USB to the Apple computer, and then establish a Bluetooth connection with the computer’s native Bluetooth adapter.

REQUIREMENTS ▪ BT900-US (with latest firmware https://www.lairdtech.com/products/BT900-US > Software Downloads) ▪ Macbook or Apple Computer with BT capabilities ▪ USB-C to multiple USB adapter (If needed to plug the BT900’s USB-A type connector into your computer) ▪ UWTerminalX software (https://github.com/LairdCP/UwTerminalX/releases) ▪ BT900-Applications-master.zip (https://github.com/LairdCP/BT900-Applications)

HARDWARE AND SOFTWARE SETUP To begin, connect the BT900-US to the Apple computer via USB. If required, a USB-C hub can be used to provide the correct connector type to the computer for the BT900-US, as shown in Figure 1.

Figure 1: BT900 (1) connected to USB hub (2), and hub connected to Apple computer via USB-C (3)

1

2 3

Page 2: Bluetooth SPP Connection to Apple OS X · Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX. ... Figure 11: New terminal window and

BT900-US SPP Connection to Apple OS X Application Note

Embedded Wireless Solutions Support Center: http://ews-support.lairdtech.com www.lairdtech.com/bluetooth

2

© Copyright 2017 Laird. All Rights Reserved

Americas: +1-800-492-2320 Europe: +44-1628-858-940

Hong Kong: +852 2923 0610

To communicate with the BT900-US, you’ll need to know the its associated serial port. To find all connected serial ports, open up the Apple Terminal. Issue the following command:

ls /dev/tty.*

The terminal will respond with a list of connected devices. In this case, the BT900-US is the device named usbserial-AI04C6YC, as shown in Figure 2. Make note of this name, because we will use this to connect to the device in UwTerminalX.

Figure 2: Apple terminal listing the connected BT900-US

Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX.

You may receive a warning that UwTerminalX can’t be opened, because it is from an unidentified developer, as shown in Figure 3. If you do, click the Apple menu and click System Preferences > Security and Privacy, and then click Open Anyway.

Figure 3: Unidentified developer warning; open the application in the Security & Privacy panel

When UwTerminalX opens, accept the Terms and Agreements in the About tab, and then click the Config tab to begin setup.

Page 3: Bluetooth SPP Connection to Apple OS X · Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX. ... Figure 11: New terminal window and

BT900-US SPP Connection to Apple OS X Application Note

Embedded Wireless Solutions Support Center: http://ews-support.lairdtech.com www.lairdtech.com/bluetooth

3

© Copyright 2017 Laird. All Rights Reserved

Americas: +1-800-492-2320 Europe: +44-1628-858-940

Hong Kong: +852 2923 0610

Select the device port that corresponds with the BT900-US, which was found earlier in the Apple Terminal as shown in Figure 4.

Figure 4: Selecting the tty.usbserial device in UwTerminalX

Click OK to be taken to the Terminal tab. Issue the following command to check your firmware version:

ati 3

Laird recommends you update to the latest production firmware version for the BT900-US.

In the UwTerminalX window, right click and then click Compile+Load+Run. In the file selector, navigate to the BT900-Applications-master folder and open $autorun$.SPP.UART.bridge.incoming.sb. The file will be compiled and loaded, and the terminal echoes OK when it is complete, as shown in Figure 5.

Figure 5: Application compiled and loaded in UwTerminalX

Page 4: Bluetooth SPP Connection to Apple OS X · Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX. ... Figure 11: New terminal window and

BT900-US SPP Connection to Apple OS X Application Note

Embedded Wireless Solutions Support Center: http://ews-support.lairdtech.com www.lairdtech.com/bluetooth

4

© Copyright 2017 Laird. All Rights Reserved

Americas: +1-800-492-2320 Europe: +44-1628-858-940

Hong Kong: +852 2923 0610

ENABLING BLUETOOTH IN OS X AND PAIRING WITH THE BT900 In the menu bar, click the Bluetooth icon, make sure you’ve turned Bluetooth on, and then click Open Bluetooth Preferences as shown in Figure 6.

Figure 6: Bluetooth preferences selection

In the preferences panel, the BT900 is visible and is advertising.

Figure 7: BT900 discovered in the Bluetooth Preferences panel

Note: There might be instances in which the wrong BT Friendly Name is displayed in the Bluetooth scan list. This is because OS X may cache friendly names, so if the BT900-US was previously connected with another friendly name programmed, that name may appear in place of the correct name. You can

Page 5: Bluetooth SPP Connection to Apple OS X · Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX. ... Figure 11: New terminal window and

BT900-US SPP Connection to Apple OS X Application Note

Embedded Wireless Solutions Support Center: http://ews-support.lairdtech.com www.lairdtech.com/bluetooth

5

© Copyright 2017 Laird. All Rights Reserved

Americas: +1-800-492-2320 Europe: +44-1628-858-940

Hong Kong: +852 2923 0610

compare the local name in the smartBASIC application to the entry in the Bluetooth scan list. Note that it’s possible to pair and connect even if the friendly name is displaying incorrectly.

If the Bluetooth list on your computer is not displaying the correct local name we recommend the following to clear the cached device(s):

▪ Select the ‘X’ button next to the connected Bluetooth device and remove. ▪ Turn the Bluetooth radio off and then back on.

If the recommendations above do not work, you can also try the following:

Note: The commands below may also remove all cached devices. We recommend backing up your host and/or re-pairing your other BT devices.

▪ Turn off the Bluetooth radio ▪ Delete com.apple.Bluetooth.plist from /Library/Preferences ▪ Delete com.apple.Bluetooth.’DeviceHexUUIDnumber’.plist from ~/Library/Preferences/ByHost

(note that this is the user preference folder, not the system one) ▪ Turn ON Bluetooth

To pair the BT900-US with your computer’s native Bluetooth, click the Pair button next to the BT900. In UwTerminalX, you will receive a prompt to type y to pair, n to decline, or cancel to cancel, as shown in Figure 8. Type y and press enter.

Figure 8: Prompt to pair in UwTerminalX

If pairing is successful, you will see confirmation in UwTerminalX and in the Bluetooth window.

Page 6: Bluetooth SPP Connection to Apple OS X · Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX. ... Figure 11: New terminal window and

BT900-US SPP Connection to Apple OS X Application Note

Embedded Wireless Solutions Support Center: http://ews-support.lairdtech.com www.lairdtech.com/bluetooth

6

© Copyright 2017 Laird. All Rights Reserved

Americas: +1-800-492-2320 Europe: +44-1628-858-940

Hong Kong: +852 2923 0610

Figure 9: Pairing completed in UwTerminalX

Note:

There is a discoverability timer set on this application. This module is no longer discoverable once timer expires.

If this occurs:

▪ Check/Uncheck the ‘Break’ option in UwTerminalX. This will reset the module back into command mode.

Another option is to perform the following:

▪ Unplug/re-insert BT900-US from host. ▪ Restart UwTerminalX ▪ Issue ‘AT+DIR’ to see the application loaded on this module ▪ Issue the application name you’d like to run then press ENTER ▪ Once the application loads, the module is discoverable in OS X

You are now paired and not “connected” even though Bluetooth Preferences displays the status “connected” next to the BT900-US. A serial port connection is now available.

To test this connection, open the Terminal application on your Apple computer. Issue the following commands:

ls /dev/tty.*

screen /dev/tty.LairdBT900-SerialPort

The first command lists all connectable serial ports, and the second opens the BT900-US port, as shown in Figure 10.

Page 7: Bluetooth SPP Connection to Apple OS X · Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX. ... Figure 11: New terminal window and

BT900-US SPP Connection to Apple OS X Application Note

Embedded Wireless Solutions Support Center: http://ews-support.lairdtech.com www.lairdtech.com/bluetooth

7

© Copyright 2017 Laird. All Rights Reserved

Americas: +1-800-492-2320 Europe: +44-1628-858-940

Hong Kong: +852 2923 0610

Figure 10: Terminal application with BT900 Serial port open command

When the second command is entered, a blank Terminal window opens for the serial connection, and UwTerminalX displays --- SPP Connect: (000000000) to signal a successful SPP connection.

Figure 11: New terminal window and SPP connection message

When characters are entered in one terminal window, they will echo through to the other terminal, demonstrating the functionality of the Serial Port Profile connection, as shown in Figure 12.

Note: The Apple terminal has a spacing issue that renders it unable to start a new line or properly space the characters and data as they are received. However, this is only a display error; the data is accurately received at the Apple terminal end.

Page 8: Bluetooth SPP Connection to Apple OS X · Download both UwTerminalX for OSX and the BT900-Applications-master.zip file. Then run UWTerminalX. ... Figure 11: New terminal window and

BT900-US SPP Connection to Apple OS X Application Note

Embedded Wireless Solutions Support Center: http://ews-support.lairdtech.com www.lairdtech.com/bluetooth

8

© Copyright 2017 Laird. All Rights Reserved

Americas: +1-800-492-2320 Europe: +44-1628-858-940

Hong Kong: +852 2923 0610

Figure 12: Characters entered on UwTerminalX echoed on the Apple terminal

REVISION HISTORY Version Date Notes Approver

1.0 3 Nov 2017 Initial Release Jennifer Gibbs