1 1
Larry Bank

OPZ+2 H5 onboard bluetooth support?

Recommended Posts

Hello everyone,

 

I managed to have armbian running on my H5, nearly everything is fine so far, boots from NAND, have NodeJs perfectly running, but i do need to have Bluetooth support, basically that was a reason why i got the board. Anyone can tell me how to enable BT support from command line please?

 

Regards,

Evi

Share this post


Link to post
Share on other sites
3 hours ago, Evi said:

Anyone can tell me how to enable BT support from command line please?


It is not implemented yet. You can use some USB based until then - it should work out of the box. You only need to enable Bluetooth support within armbian-config or install appropriate userspace packages manually.

Share this post


Link to post
Share on other sites

Is there an issue for this or some other way I can track it's status?

 

I'd really like to help and get this working, but I am having trouble getting started.  I have setup the build environment and have created images for the OPiZero2+H5 but have no idea what to try to get BT up and running.  There are scattered hints here in the forums, but most are over my head.

 

Is there a resource that would guide me in the right direction?

 

Thanks.

 

 

Share this post


Link to post
Share on other sites
On 2/18/2018 at 9:48 AM, happyzax said:

Is there an issue for this or some other way I can track it's status?

 

I'd really like to help and get this working, but I am having trouble getting started.  I have setup the build environment and have created images for the OPiZero2+H5 but have no idea what to try to get BT up and running.  There are scattered hints here in the forums, but most are over my head.

 

Is there a resource that would guide me in the right direction?

 

Thanks.

 

 

Happysax I am trying to contribute also and I just came across in the armbian doc with this: 

 

https://docs.armbian.com/Process_Contribute/

 

I’m still learning, yet see if that would help

Share this post


Link to post
Share on other sites

enable overlay uart 1

and add

param_uart1_rtscts=1

 

to armbianenv.txt

 

and adjust /etc/init.d/ap6212-bluetooth so it looks like this

 

  # Start patching
        rfkill unblock all
        echo "0" > /sys/class/rfkill/rfkill0/state
        echo "1" > /sys/class/rfkill/rfkill0/state
        echo " " > /dev/$PORT
        devmem2 0x1f00060 b 1
        echo 10 > /sys/class/gpio/export
        echo out > /sys/class/gpio/gpio10/direction
        echo 0 > /sys/class/gpio/gpio10/value
        echo 1 > /sys/class/gpio/gpio10/value
        sleep 0.1
        hciattach /dev/$PORT bcm43xx 115200 flow bdaddr $MAC_OPTIONS
        hciconfig hci0 up

 

 and reboot

 

oh you might need to install devmem2

 

Share this post


Link to post
Share on other sites

Thanks for this precious information!

 

I've had this bleeding Orange Pi Zero 2+ H5 for like a year now, and finally someone has figured out the BT.  Excellent work!

Share this post


Link to post
Share on other sites
On 5/7/2018 at 3:02 AM, TonyMac32 said:

@Myy I wonder if this might be able to be adapted for Tinker mainline bluetooth?

 

So much time so little to do!...  Strike that, reverse it.

 

220px-Gene_Wilder_as_Willy_Wonka.jpeg

 

Aha ! I'll try this tonight ! Though I forgot the chip they used in the Tinky. It's a broadcom too ? I'll take a look.

Share this post


Link to post
Share on other sites

It's a Realtek 8723BS, but operates the same way. (any guess what BS stands for? ;-) ). I actually think we should wipe out the DTS entry that's there for it and start over, since that one appears to be tied somehow to the Rockchip special rfkill system.  I was able to get it to start the handshake by toggling the gpio pins associated, so this might be a template for getting to to work properly.  Ok, enough off-topic.  :-D

Share this post


Link to post
Share on other sites
On 5/6/2018 at 5:23 PM, thc013 said:

enable overlay uart 1

and add

param_uart1_rtscts=1

 

to armbianenv.txt

 

and adjust /etc/init.d/ap6212-bluetooth so it looks like this

 

  # Start patching
        rfkill unblock all
        echo "0" > /sys/class/rfkill/rfkill0/state
        echo "1" > /sys/class/rfkill/rfkill0/state
        echo " " > /dev/$PORT
        devmem2 0x1f00060 b 1
        echo 10 > /sys/class/gpio/export
        echo out > /sys/class/gpio/gpio10/direction
        echo 0 > /sys/class/gpio/gpio10/value
        echo 1 > /sys/class/gpio/gpio10/value
        sleep 0.1
        hciattach /dev/$PORT bcm43xx 115200 flow bdaddr $MAC_OPTIONS
        hciconfig hci0 up

 

 and reboot

 

oh you might need to install devmem2

 

I use this solution what you had wrote,but the effect is not significant.   my img is Armbian_5.42_Orangepizeroplus2-h5_Debian_stretch_dev_4.16.img .   

It's my armbianEnv.txt:

verbosity=1
console=both
overlay_prefix=sun50i-h5
overlays=analog-codec i2c0 i2c1 i2c2 spdif-out spi-add-cs1 spi-jedec-nor spi-spi
dev uart1 uart2 uart3 usbhost2 usbhost3
rootdev=UUID=7c11e787-9feb-44a1-9942-c646b86c1d10
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
param_uart1_rtscts=1

It's my /etc/init.d/ap6212-bluetoot

# Start patching
        rfkill unblock all
        echo "0" > /sys/class/rfkill/rfkill0/state
        echo "1" > /sys/class/rfkill/rfkill0/state
        echo " " > /dev/$PORT
        devmem2 0x1f00060 b 1
        echo 10 > /sys/class/gpio/export
        echo out > /sys/class/gpio/gpio10/direction
        echo 0 > /sys/class/gpio/gpio10/value
        echo 1 > /sys/class/gpio/gpio10/value
        sleep 0.1
        #on orangepi win following command never ends on first try... force to r
un with a timeout...
        #timeout 5s echo " " > /dev/$PORT
        #if [ $? != 0 ]; then
                #timed out... retry
        #        echo " " > /dev/$PORT
        #fi
        hciattach /dev/$PORT bcm43xx 115200 flow bdaddr $MAC_OPTIONS
        hciconfig hci0 up

but when i reboot or use  this

                           /etc/init.d/ap6212-bluetooth start

return 

                         [....] Starting ap6212-bluetooth (via systemctl): ap6212-bluetooth.serviceWarning: ap6212-bluetooth.service changed on disk. Run 'systemctl daemon-reload' to reload units.
                         Job for ap6212-bluetooth.service failed because the control process exited with error code.
                         See "systemctl status ap6212-bluetooth.service" and "journalctl -xe" for details.
                         failed!

the log:

   root@H5:~# systemctl status ap6212-bluetooth.service
    ● ap6212-bluetooth.service - LSB: Patch firmware for ap6212 adapter
    Loaded: loaded (/etc/init.d/ap6212-bluetooth; generated; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sun 2018-05-27 06:20:39 UTC; 2min 16s ago
        Docs: man:systemd-sysv-generator(8)
    Process: 2164 ExecStart=/etc/init.d/ap6212-bluetooth start (code=exited, status=1/FAILURE)

    May 27 06:20:29 H5 ap6212-bluetooth[2164]: Value at address 0x1F00060 (0xffff97239060): 0x1
    May 27 06:20:29 H5 ap6212-bluetooth[2164]: Written 0x1; readback 0x1
    May 27 06:20:29 H5 ap6212-bluetooth[2164]: sh: echo: I/O error
    May 27 06:20:39 H5 ap6212-bluetooth[2164]: Initialization timed out.
    May 27 06:20:39 H5 ap6212-bluetooth[2164]: bcm43xx_init
    May 27 06:20:39 H5 ap6212-bluetooth[2164]: Can't get device info: No such device
    May 27 06:20:39 H5 systemd[1]: ap6212-bluetooth.service: Control process exited, code=exited status=1
    May 27 06:20:39 H5 systemd[1]: Failed to start LSB: Patch firmware for ap6212 adapter.
    May 27 06:20:39 H5 systemd[1]: ap6212-bluetooth.service: Unit entered failed state.
    May 27 06:20:39 H5 systemd[1]: ap6212-bluetooth.service: Failed with result 'exit-code'.
    Warning: ap6212-bluetooth.service changed on disk. Run 'systemctl daemon-reload' to reload units.

Is it wrong to use it? or How can i fix it?

 

 

Share this post


Link to post
Share on other sites
16 minutes ago, rusatch said:

You have to install devmem2 

 

Thank you for your reply! 

but I'am already install devmem2,I think my mistake is somewhere else.

i use this script to test:

#!/bin/bash
PORT="ttyS1"
MAC_OPTIONS="43:29:B1:55:01:01"
rfkill unblock all
echo "0" > /sys/class/rfkill/rfkill0/state
echo "1" > /sys/class/rfkill/rfkill0/state
echo " " > /dev/$PORT
devmem2 0x1f00060 b 1
echo 10 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio10/direction
echo 0 > /sys/class/gpio/gpio10/value
echo 1 > /sys/class/gpio/gpio10/value
sleep 0.1
hciattach /dev/$PORT bcm43xx 115200 flow bdaddr $MAC_OPTIONS
hciconfig hci0 up

result:

root@H5:~# ./blue.sh
/dev/mem opened.
Memory mapped at address 0xffff9eab1000.
Value at address 0x1F00060 (0xffff9eab1060): 0x1
Written 0x1; readback 0x1
bcm43xx_init
Initialization timed out.
Can't get device info: No such device

devmem2 seems are correct... I don't know what to do now

Share this post


Link to post
Share on other sites
2 hours ago, zhen8838 said:

my img is Armbian_5.42_Orangepizeroplus2-h5_Debian_stretch_dev_4.16.img

 

30 minutes ago, zhen8838 said:

I don't know what to do now

Don't use "dev" branch images because they have broken overlays. Only "next" branch images with kernel 4.14 may work.

Share this post


Link to post
Share on other sites
44 minutes ago, zador.blood.stained said:

 

Don't use "dev" branch images because they have broken overlays. Only "next" branch images with kernel 4.14 may work.

Thank you !     

I'm so sad , Because when i use Armbian_5.38_Orangepizeroplus2-h5_Ubuntu_xenial_next_4.14.14.img,  This problem has arisen "Starting kernel" reboots.

Now i try  to use the nanopi-neo-plus2 image . If I successfully solve, I will feedback in time

 

Share this post


Link to post
Share on other sites

thnx zhen8883

 

i didm't notice that bluetooth was again not working . last weeks i fighting with spi and a nrf20l01 i can't get it working with mysensors and the rf24 lib works a bit

 

but i tried al armbians from 5.38 till 5.46 and kernels from 4.14.14 till 4.14.48  and suddenly it is not working anymore . and i saw your blogs and tried a orangepi distro and works right away when activate it .

 

only thing that was mentioned in the mailine bluetooth thread was that the rts and cts are not bind to uart1 in the dts file  so i include them and  and put them both in the main dts but no effect

 

i got the info from other threads but hte problems are similar  i guess it is the binding of uart1 or the wake up routine is not going well

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1