Add Bluetooth Support for Ubuntu


It’s been awhile since the last Ubuntu release, we feel sorry for this!

And our team are working for a new Ubuntu release, and new ROM will be released after all below are solved:

  • More HDMI output resolutions (Still stuck on)
  • GPIO Lib
  • 32bit OSD display(Better display, current release is 24bit)

Before new ROM coming in the next few days, we want to publish a step by step instruction to add bluetooth support on Khadas VIM, and the steps below will walk you through for it.

1) Firstly, you should install the latest Ubuntu ROM on your VIM device.

2) Install the bluetooth packages:

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install bluetooth blueman bluez bluez-tools rfkill libbluetooth-dev

3) Make sure load ‘hci_uart’ module at boot time:

$ sudo vim /etc/modules

After editing, it should be:

khadas@Khadas:~$ cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.


4) Reboot and ensure the module ‘hci_uart’ has been loaded:

$ sudo reboot
$ lsmod | grep hci_uart

5) Download broadcom bluetooth tool brcm_patchram_plus:

$ sudo mv ~/Downloads/brcm_patchram_plus /usr/local/bin/brcm_patchram_plus

Add execute permission:

$ sudo chmod +x /usr/local/bin/brcm_patchram_plus

6) Download broadcom bluetooth firmware:

After download complete, move these firmware to:

$ sudo mv ~/Downloads/bcm43438a*.hcd ~/Downloads/BCM4345C0.hcd /lib/firmware/brcm/

7) Load the bluetooth firmware:

.1) VIM Pro(AP6255):

$ sudo brcm_patchram_plus --patchram /lib/firmware/brcm/BCM4345C0.hcd --enable_hci --bd_addr 11:22:33:44:55:66 --no2bytes --tosleep 1000 /dev/ttyS1

.2) VIM Basic(AP6212):

$ sudo brcm_patchram_plus --patchram /lib/firmware/brcm/bcm43438a1.hcd --enable_hci --bd_addr 11:22:33:44:55:66 --no2bytes --tosleep 1000 /dev/ttyS1

8) Attach HCI adapter:

$ sudo hciattach /dev/ttyS1 any

9) Test:

Have fun!

Further reading

3rd-Party Ubuntu ROM for Khadas VIM
VIM2 WiFi driver
Ubuntu Mate V170220 ROM Released [EMMC INSTALLATION]

If the new Ubuntu image is available, can you enable the ttyS4 interface (UART_RX_AO_B / UART_TX_AO_B) too? It is rather troublesome to enable the UART by re-compiling the kernel. Thanks.


hi, David:
OKay, we will do that, and thanks for the feedback.



We’ve got following two solved!

  • GPIO Lib
  • OSD 32bit display


Now that i have my usb hub surprisingly working on Vim without power supply, i can’t wait for the update.

If everything from the Ubuntu to do list photo is working, then i am gonna use this as my main pc.


So with gpio libraries, we can control the gpio pins?

Does that mean that we will be able to control the fan, turn it on or off, or maybe to regulate the spinning of the fan?

I am not quite familiar with gpio, does that mean that we now have much more possibilities to make use of them?

There was a word about setting up 2 more usb ports over gpio, i didn’t quite understand how can i achieve this, what exactly do i need to buy, and i didn’t want to experiment until i wasn’t 100% sure that it is safe, i don’t want to destroy this board.

I know a little about it, but it’s all theory, i would like an explanation from someone who has used this in practice.


Yes, you can check this topic for more information.

It’s different between GPIO and USB-Bus, if you want to expand a new USB port via the 40-pin USB-Bus IO, you can refer the VIM schematic for details:

  • Current USB ports on over HUB_DM/P 3 & 4
  • We reserve the HUB_DM/P 1 & 2 to 40-pin IO, so you can simply expand the HUB_DM/P 1 & 2 with some circuit listed as below:
    • F1
    • C147
    • L7 or (R75 + R77)
    • D18 & D19
    • J5


I believe i won’t need any more usb ports, but i don’t need schematics, i need examples of what cables do i need to buy and what to do with them, i do not have any experience with this, tutorials of how to set them up and running would be a great thing.

There should be a tutorials topic, where you would have all helpful tutorials in one place, with step by step instructions, that would make using Vim easier for many of us.

For example controlling the Vim fan, as one of the tutorials, there are many things missing from the topic you were referring to, i need much more info that this topic has.


I need litle bit of your help
I cant figure it out how to autostart bluetooth adapter after reboot w/o to attach it manualy every time.


Line added to rc.local and everything is work now :slight_smile: