AP6212a - Bluetooth Audio Streaming Timeouts in audio bus



Recommended Posts

Good evening,


I'm using a NanoPi Neo Air for streaming audio via bluetooth to a I2S sink.

It's working in general but the audio data breaks away every second. It's always a on/off. I'm pretty sure it's connected to the speed between H3 - AP6212a but I'm not able to get it to work propably. 


I set the UART ttyS3 speed to 1500000 bit/s:


My Fexedit looks like that:


       │ │bt_used = 1                                             
       │ │bt_uart_id = 3                                           
       │ │bt_uart_baud = 1500000                                  
       │ │bt_rst_n = port:PG13<1><default><default><0>            
       │ │bt_wake = port:PA08<1><default><default><0>              
       │ │bt_host_wake = port:PA07<0><default><default><0>          
       │ │bt_host_wake_invert = 0   

and I changed the AP6212a speed like this:


systemctl stop bluetooth.service
cp /lib/firmware/ap6212/bcm43438a1.hcd /etc/firmware/ap6212/4343A0.hcd
echo "0" > /sys/class/rfkill/rfkill0/state
echo "1" > /sys/class/rfkill/rfkill0/state
echo " " > /dev/ttyS3
hciattach /dev/ttyS3 bcm43xx 1500000

Set Controller UART speed to 1500000 bit/s
Flash firmware /etc/firmware/ap6212/4343A0.hcd
Set Controller UART speed to 1500000 bit/s
Device setup complete

I already tried to go up 3000000 bit/s but the firmware flashing process stucks when I try it.


Any idea why my I2S audio bus can't deliver the whole data?




EDIT: output of hciconfig -a:


root@nanopiair:~# hciconfig -a
hci0:   Type: BR/EDR  Bus: UART
        BD Address: 43:29:B1:55:01:01  ACL MTU: 1021:8  SCO MTU: 64:1
        RX bytes:520 acl:0 sco:0 events:23 errors:0
        TX bytes:1090 acl:0 sco:0 commands:23 errors:0
        Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH SNIFF
        Link mode: SLAVE ACCEPT
        Name: 'nanopiair'
        Class: 0x00041c
        Service Classes: Unspecified
        Device Class: Audio/Video, Portable Audio
        HCI Version: 4.1 (0x7)  Revision: 0xf2
        LMP Version: 4.1 (0x7)  Subversion: 0x2122
        Manufacturer: Broadcom Corporation (15)




Link to post
Share on other sites

Donate and support the project!

I would try with modern kernel first, but you might need to enable Bluetooth port manually since I am not sure we already did that on this board. IRC I had some troubles with Bluetooth on this/those chip(s) in this old kernel, while they have vanished when using modern one. Not necessarily that this will help in this particular case, but worth trying.

Link to post
Share on other sites

I have exactly the same problem on Orange Pi Zero Plus 2 H3 (the same Broadcom AP6212a)
phone is connected via bluetooth, in pulse I can see it as A2DP source but the audio is cut off each and every second

in my case I'm not using I2S - so it is not related with I2S but with bluetooth or pulse


Any idea how to fix this is appreciated.

Link to post
Share on other sites

Thank you for your fast reply.


I kinda got it working. I thought it's enough to set the uart speed once but you need to make it on every boot. So I wrote  startscript what sets the uart speed to 1500000 bit/s and it's working without timeouts. 

It's not my goal yet because the AP6212a datasheet says that it's possible to work with 3000000 bit/s. Unfortunately I'm not able to set this speed.


 Furthermore Bluteooth audio streaming is not running very stable. I know it from Raspberry Pi with 4.x kernel and it was really easy and smooth. It seems that it's a problem connected to 3.4 kernel.


Can you give me any info about how to activate blutooth on 4.x kernel? I already tried to make it work but with 4.x mainline release you don't have this fex file to activate the hardware modules. I got stucked with building a new device tree.  Maybe you can give me some more info about it?


Do you know when a 4.x kernel will be officially available for Nano Pi Neo Air?


Thanks a lot


Link to post
Share on other sites

thank you @mantabernd for this hint with 1500000 bit/s 

I added  this to ap6212-bluetooth and it works :) I'm able to stream audio to OPI Zero Plus 2 H3 via Bluetooth


# Start patching
        rfkill unblock all
        echo "0" > /sys/class/rfkill/rfkill0/state
        echo "1" > /sys/class/rfkill/rfkill0/state
        echo " " > /dev/$PORT
        hciattach /dev/$PORT bcm43xx 1500000 flow bdaddr $MAC_OPTIONS
        hciconfig hci0 up


Link to post
Share on other sites

I'm glad it's working now for you. 

I'm still not happy with the bluetooth performance. Poor connection quality and sound streaming does not work really smooth.


I'm now trying to get it done with 4.11 kernel, unfortunately the bluetoothchip is not working at all with this kernel.... :(

Link to post
Share on other sites

This topic is now closed to further replies.