The blog is to run BlueZ stack on a linux  host machine to initialize Cypress Bluetooth Controller, which is connected to Ubuntu machine through UART transport. The blog contains the necessary packages to install, the commands to be send to configure the Ubuntu Host




-- CYW920706WCDEVAL Board (recommended to download an empty Application)

-- Linux System/  Linux Machine (preferably Ubuntu)



Setting up the Host Machine


1. Plugging in the board


Plug in the CYW920706WCDEVAL board to the Host Linux Machine(in my case i used a Ubuntu Laptop). Check the dmesg logs to see the device files generated to which the UART transport has bound. In my case, the CYW920706WCDEVAL board had a PUART and HCI UART. Hence, the dmesg displayed two device files.

Eg: dmesg log for enumeration



If the dmesg logs didn't display the device files to which the board had bound, then it could be because the fdti LKM(loadable Kernel Module) was not loaded in the kernel during boot. You could manually add it using the following command.

>>> modprobe ftdi_sio

Check whether the VID and PID parameters of the USB device is getting added to the following file


else add the PID and VID to the file the following location.

>>>echo <vid> <pid>  > /sys/bus/usb-serial/drivers/ftdi_sio/new_id


Replug the device back to the host machine and check the dmesg logs to see bonded device files.

After a reboot, the ftdio_sio LKM might get unloaded. To make the LKM load after every reboot, you could define a rule in the rules.d list.

To find about more about adding rules in the rules.d list , check the following page


2. Setting up BlueZ


Download the necessary packages for Bluez from the link given below and run the following commands. Additional packages  contains utilities to check the status of Bluez Daemon.

BlueZ » Download

>>>tar -xvf bluez-5.??.tar.xz
>>>cd bluez-5.??.tar.xz
>>>make install

Additional packages to download are given here.(if they are missing in your system).

>>>sudo apt-get install libdbus-1-dev libudev-dev libical-dev libreadline-dev bluetooth bluez-tools rfkill rfcomm

Once done with the download, check whether the Bluetooth adapter is unblocked.

>>> rfkill list all
>>> rfkill unblock all

Check the status of the corresponding systemd(system daemon) service:

>>>systemctl status bluetooth.service

The daemon can be reloaded with the following commands:

>>>systemctl daemon-reload
>>>systemctl restart bluetooth

3. HCI UART bring-up


Use hciattach command to attach the serial device via HCI UART to the BlueZ stack.


>>>sudo hciattach  /dev/ttyUSB0 -t 10 any 115200 noflow nosleep


The hciattach utility tries to send a HCI reset to the device via the HCI UART. Check the dmesg logs to see the status of HCI reset. If a reset timeout is happening, do a manual reset of the device while the reset commands are being send to the device by the host machine.

Once successful, you are ready to send the hci command using the hcitool utility.

The following picture shows dmesg logs for hciattach. Here, timeout is happening when host tries to send a HCI reset. This can be resolved by manually resetting the device.


Use the following command to check the hci devices


>>>hcitool dev 


          hci0      5C:AC:4C:F8:1F:80

          hci1      20:70:6A:20:f4:9B

The following diagram shows the commands to send to determine whether the device has been attached to the hci interface generated in the host.

It also gives further details like the BD address and the traffic the is going in the BT device.


For scanning LE devices:

>>> hcitool -i hci1 lescan


LE SCAN initiated in the interface hci1 created for the new device.



HCI command Injection


For sending specific HCI commands, use the following format:

>>>hcitool cmd <ogf> <ocf> [parameters]


eg: Write Local Name Command (ocf :HCI_Write_Local_Name -- 0x0013  & ogf: 0x03 )

For HCI Control and Baseband commands <ogf> is 0x03

(ABCD -- 0x41 0x42 0x43 0x44 )

The following picture show the usage of the hcitool cmd