SOLVED AP6212 Bluetooth on BPI-M3

Hello all, Just completed a down and dirty hack to get the ap6212 Bluetooth functional in a novice user gui interface. Should work for others your success is your own. To get it working I did the following, why so if you have a better way to fix the issue do so please and reply here I will update my hack.

A. Hciattach and Hciconfig refuse to be run as root or privileged user from a start up service or init script. So

chmod u+s /usr/bin/hciattach

chmod u+s /bin/hciconfig

B. All other references I found online concerning the /etc/firmware directory mislead me to believe that the correct firmware name was only the numbers. I got the source code of the latest Bluez package and the correct firmware locations and names are;

rev b with Power jack







Rev A with microusb







C. Bluez and Bluetooth conflict somehow. (i do not care how) We need hciattach and hciconfig so remove bluetooth. apt remove bluetooth

D. We need to also change the permissions on rfkill or it can not write to the state files.

chmod u+s /usr/sbin/rfkill

E. The bluetooth kernel initialization does not pull in the firmware. SO we need a script that runs at boot. You can not run the script successfully from a privilege user account therefore it can not be made to function as a service or init. My thought is something in bluez denies “privilege escalation” the incorrect way.

the script


while [ ! -f /sys/class/rfkill/rfkill0/state ]


  `  /bin/sleep 1`


/usr/sbin/rfkill unblock all

/usr/bin/hciattach /dev/ttyS1 bcm43xx 1500000

/usr/bin/hciattach /dev/ttyS1 bcm43xx 1500000

/bin/hciconfig hci0 up

We have to send the attach command twice Not exactly sure why but I suspect that the first time initializes the variables in python for bluez and the second time python can read the variables find the port and the firmware.

Anyway save the script chmod +x and chmod u+s. Add the script path to a user startup autostart.

This will start and configure the bluetooth module on the M3 and provide a HCI0 interface to use. bluman may or may bot autolaunch but is in the applications menu.

Open bluesman connect your stuff and have at it.

1 Like

Not work for me. Only this work:

/usr/bin/hciattach /dev/ttyS1 any

and whith: /lib/firmware/ap6212/bcm43430a0.hcd but I use rev b with Power jack

(disclaimer: the following is based solely on passively reading linux-sunxi IRC and Armbian forums)

bcm43430a0 is needed when the chip on your board reads AP6212 while you need bcm43430a1 with AP6212A (note the trailing A). This is not related to power jack or stuff like that but to revision of the Ampak chip. In Armbian forum several people reported the chip has been exchanged on BPi M2+ months ago so this might apply to M3 too (no idea, I don’t use my BPi M3 any more since NanoPi M3 is a lot better for those tasks that require a lot of CPU horsepower)

1 Like

Un install the bluetooth package Need only the bluez package The usb rev of the board uses







if use any works then use any

for me it dont work if i apt remove bluetooth. ubuntu says “no adapter found”

if i let bluetooth installed, it works. but the baud-rate must be 115200 (hciattatch), but bluetooth is broken after 12-20 hours and i must restart the system.

but i have changed the files in the lib directory by newer one, i think i have it found somewhere in the internet. it must be from another board with the same ap6212 chipset.


Yes there are three I know of online that are for the UART connected chipset. The manufacturers build sheet shows the revision change in the build orders.

The one ending it 38A0 and the one ending 30A0 work on rev one the second one 30A1 works on rev2 of the BPI-M3

You can even order these boards with GPRS and GSM or GSM and GPS the visual of the board is wether to has the rev1 usb or the rev2 barrel power.

The only way I found to resolve the blue crash was to remove and purge bluetoothd and use only the HCIconfig and HCI attach from Bluez package. The bluetoothd service was blocking the server connect when ever you tried to pair or browse.

I know I have an image on the site here that is working for both boards.

yep apt remove --purge bluetooth && apt install --reinstall bluez

When you first boot you will not see the sunxi-bt in hciconfig -a Don’t worry it is still there just run the instructions from my original post.

What os image did you start with?

I started with the Debian Mate 1080 image.

However I stripped the image removing everything down to the Linux Standard base and rebuilt a few images I posted on the forums here.

These are the images I have BT working with

pi bananapi

One of them you have to reset the root password I do not know which one.