There are a number of reasons why you may not be able to connect to a Bluetooth device, such as a phone or headset.
Some Bluetooth devices block connections by default, or require you to change a setting to allow connections to be made. Make sure that your device is set up to allow connections.
Linux Device Drivers: Tutorial for Linux Driver Development Programming a device driver for Linux requires a deep understanding of the operating system and strong development skills. To help you master this complex domain, Apriorit driver development experts created this tutorial. As a starting point I am attempting to write a driver for an independent device (Mindstorms NXT. Yes, I know there are userspace alternatives, but that is not what I am looking for.) that may be connected to the host either by USB or Bluetooth. The aim is to expose a common interface as a character device, independent of the underlying connection.
If your distribution doesn’t already have Bluetooth set up for you, you will first need to install Bluez, which contains the driver stack for Bluetooth adapters as well as utilities for the CLI administration of Bluetooth. After installing Bluez, you may need to install a Bluetooth manager. More information with hciconfig -a. Hciconfig -a provides way more information, including Bluetooth version. $ hciconfig -a hci0: Type: Primary Bus: USB BD Address: 00:1A:7D:DC:70:13 ACL MTU: 310:10 SCO MTU: 64:8 UP RUNNING PSCAN RX bytes:1013 acl:0 sco:0 events:60 errors:0 TX bytes:4890 acl:0 sco:0 commands:60 errors:0 Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87 Packet type: DM1 DM3 DM5.
Your Bluetooth adapter or dongle may not have been recognized by the computer. This could be because drivers for the adapter are not installed. Some Bluetooth adapters are not supported on Linux, so you may not be able to get the right drivers for them. In this case, you will probably have to get a different Bluetooth adapter.

Make sure that your Bluetooth adapter is switched on. Open the Bluetooth panel and check that it is not disabled.
Check that Bluetooth is turned on on the device you are trying to connect to, and that it is discoverable or visible. For example, if you are trying to connect to a phone, make sure that it is not in airplane mode.
Many computers do not have Bluetooth adapters. You can buy an adapter if you want to use Bluetooth.
- Custom Kernel/Backports
- Bluetooth profiles
- BlueZ - C API
- PyBluez
This article describes how to use Bluetooth in Embedded Linux. For modules that don't come with Bluetooth hardware on-module, support can easily be added by using a USB Bluetooth module. The table below presents the modules with integrated Bluetooth:
Toradex SoMs featuring the Azurewave AW-CM276NF Wi-Fi / Bluetooth module:
System on Module | Version |
---|---|
Apalis iMX8 QuadMax 4GB Wi-Fi / Bluetooth IT | V1.0A and newer |
Apalis iMX8 QuadPlus 2GB Wi-Fi / Bluetooth | V1.0A and newer |
Apalis iMX8X QuadXPlus 2GB Wi-Fi / Bluetooth IT | V1.0A and newer |
Verdin iMX8M Mini Quad 2GB Wi-Fi / Bluetooth IT | V1.0A and newer |
Colibri iMX8X QuadXPlus 2GB Wi-Fi / Bluetooth IT | V1.0A and newer |
Colibri iMX8X DualX 1GB Wi-Fi / Bluetooth | V1.0A and newer |
Colibri iMX6ULL 512MB Wi-Fi / Bluetooth IT | V1.1A and newer |
Colibri iMX6ULL 512MB Wi-Fi / Bluetooth | V1.1A and newer |
Toradex SoMs featuring the Wi2Wi WM828CC6 Wi-Fi / Bluetooth module:
Note: Wi2Wi WM828CC6 has been replaced by Azurewave AW-CM276NF on newer Toradex SoMs.
System on Module | Version |
---|---|
Colibri iMX6ULL 512MB Wi-Fi / Bluetooth | V1.0x |
Wi-Fi adapter characteristics summary:
Wi-fi Adapter | Wi-Fi Standards | Bluetooth version | Adapter's Chipset | Antenna Configuration |
---|---|---|---|---|
AzureWave AW-CM276NF | 802.11 a/b/g/n/ac | 5.0 compliant with 2.1 | Marvell 88W8997 | Dual-Band 802.11ac 2x2 MU-MIMO |
Wi2Wi WM828CC6 | 802.11 a/b/g/n/ac | 4.2 | Marvell 88W8887 | Dual-Band 802.11ac 1x1 spatial stream |
BSP 2.7b4 and newer
Since the BSP 2.7b4, Bluetooth support is added to the Toradex pre-built image through the kernel driver backports with BlueZ 5 bluetooth software stack. Please see the article below for instructions about how to cross-compile the driver backports:
BSP 2.7b3 and older
Bluetooth support was either compiled into the kernel, or not shipped at all. Please see the details below:
BlueZ 5 is already shipped in the Toradex pre-built image and is the software stack used for Bluetooth interaction.
Additional user space utilities can be added to a custom Linux image. For this an OpenEmbedded build is required. Please refer the following article for setup of the same:
An example is provided with some useful packages. Add the following to '~/oe-core/build/conf/local.conf':
Build the image for the module to be used and flash the image on the module.
A USB Bluetooth module should be detected after connecting it to the USB port (if using a Bluetooth USB dongle):
There is a systemd Bluetooth service already enabled. Start it:
Enable the Bluetooth device using ConnMan.
hciconfig should show the connected bluetooth devices up and running. Other information such as the MAC address and device bus are also provided.
For a USB dongle:
For an SDIO module:
See below instructions for BSP release 2.7b3 and older:
Starting with BSP version 2.7, bluetoothctl was added to the Linux image. It enables scanning, pairing and connecting to devices, among other features.
Start bluetoothctl:
List all available options:
Scan for Bluetooth devices:
After you enable scanning, it will begin to list available devices:
The device number listed is the device MAC address. In the example above its value is 98:39:8E:1B:D8:88. You can stop scanning once you find the device you are looking for:
Pair to the device using its MAC address:
Confirm that the passkey is the same as displayed on your device:
Trust paired device:
Connect to the Bluetooth device:
List the connected device information, including supported services:
BlueZ - C API
Warning: obexftp and other old utilities like rfcomm or sdptool don't seem to work correctly with BlueZ 5+ unless you do the following procedure.
In our BSP 2.8, we updated the BlueZ stack into version 5.46. However, this meant that, by default, most of the older available tools that use the C API won't work out of the box.
However, you can change the Bluetooth service to launch the Bluetooth daemon with the compatibility mode to enable the use of this older API.
Edit the Bluetooth service to enable the compatibility mode
Then we change the line ExecStart from:
to
Finally, we save the file and reload the daemon Download dallas semiconductor maxim driver.
Using SPP
SPP, known as Serial Port Profile, is one of the most basic Bluetooth profiles that could confirm the operation between both devices.
Linux Developer Community Bluetooth Devices Driver Updater
At this point, you should have your Bluetooth enabled, the compatibility mode enabled and, for simplicity, have both devices paired and trusted already.
Warning: Since the following tools are based on the older C API, with BlueZ 5 the compatibility mode must be used.
Add the SPP to the list of Bluetooth profiles. In the example below the Bluetooth channel number to access this profile is 1:
Enable the background listening for raw connections on the channel 1:
Check the manual pages of rfcomm and sdptool for more complete information.
On the other device, connect to the Toradex module by using an SPP compatible application. We have tested to be working with:
- Serial Bluetooth Terminal - Android
- Bluetooth Serial Terminal - Windows 10 (Needs some configuration on Windows)
- From another rfcomm
At this point you should be able to send and read information through the rfcomm port with the echo and cat commands.
'Hello World from Toradex' should appear on the other end.
And if we send something from the other end, we can read it like this:
Linux Developer Community Bluetooth Devices Driver Windows 7
Warning: Disclaimer: As we have no control of what it is included or removed on BlueZ, there is a chance that in future revisions the compatibility mode might be removed. We recommend to use the newer D-bus API for new developments. However, we don't expect to make any revision changes on our 2.8 BSP.
BlueZ - D-bus API
At the moment of writing this documentation (Q4 2019), there are not many newer tools updated tools that use the D-bus API and therefore, for an out-of-the-box experience, it is very likely that you would want to enable the compatibility mode of the C API (See above).
You may find more information about this under BlueZ 5 D-Bus API Documentation.
Merely as an example, here is a project of an SPP echo server and client that will make the serial port service available for other devices:SPP BlueZ5 example
This program will capture the messages sent through SPP from another device and send them back to it. It is just a mere PoC, but feel free to use it as reference for your development.
PyBluez is a Python module that allows access to system Bluetooth resources. See how to add it to a custom Linux image in the section Custom Image above. Check the project GitHub page for documentation.

If you would like to test the samples provided by PyBluez, clone the git repository to the board:
Beceem driver download for windows xp. Then you can run the samples using the Python interpreter:
You must pair to another device before transferring files. Please see the Bluetoothctl section above for an example on how to pair.
Alternatively, a Python sample for pairing is provided below. Currently it only works with BSP version 2.5 and bluez4.
On an Android Lollipop device install an application like Bluetooth File Transfer which provides the obexftp service. Rf-embedded driver download for windows. Enable Bluetooth and open the Bluetooth File Transfer application for enabling obexftp service on the Android device.
For some Android devices running Icecream Sandwich, the obexftp service might be available by default which could be enabled from the Bluetooth settings or elsewhere depending on the device.
From the module a file can be transferred as follows.
The transferred file is now available on the device and is shown by the Bluetooth File Transfer application.
The python packages python-dbus, python-pygobject and python itself are added for using D-Bus with Python in the simple-agent python script which is used for pairing. On a device with limited NAND flash like the Colibri VF50 it is possible that the generated image with these packages included, might not fit in the flash memory. It should be possible to do what the simple-agent python script does using the low-level D-Bus C API.
