Jump to content

Recommended Posts

Posted

If someone is interested I found the way to have BT working on orange pi Prime.

 

Unfortunately default kernel config is missing the following options and need to be manually recompiled:

 

CONFIG_SERIAL_DEV_BUS=m
CONFIG_BT_HCIUART_SERDEV=y
CONFIG_BT_HCIUART_3WIRE=y

 

With these changes and adding "uart1" to the overlays in armbianEnv.txt  it's possible to use the driver in:

 

https://github.com/lwfinger/rtl8723bs_bt.git

 

and start manually with:

 

./rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5

 

to have bluetooth working.

 

Alternatively it's possible to use a modified driver and some startup scripts originally developed by NextThings C.H.I.P.  that i have modified to run on Orange pi Prime board.

 

https://www.dropbox.com/s/swv2ylw6lnhljxk/rtl8723bs_bt.tar.gz?dl=0

 

 What about to add these kernel options to default next sunxi64  kernel config ?

 

Posted

If you look at the configuration of the Tinker board it should be possible implement exactly the same thing using the correct pinout

Posted
1 hour ago, Raffa said:

What about to add these kernel options to default next sunxi64  kernel config ?

Those 3 configs will be added to sunxi64-dev in few minutes ...

Posted

I does not seem to work.

 

I'll try again with HCIUART_SERDEV=y and HCIUART_3WIRE=y instead of modules and see how it goes.

 

Or my ttyS1 is not the good one.

Posted

Probably you are missing the first one:

 

CONFIG_SERIAL_DEV_BUS=m

 

without this option the other two are ignored.

Posted
2 hours ago, vlad59 said:

with HCIUART_SERDEV=y and HCIUART_3WIRE=y instead of modules

Yes ! you're right, my yesterday's commit was with '=m', and I didn't tested it ... I've fixed it by now ...

Posted

Rebuild this morning and it now works !

 

Thanks a lot to you two for that. I'll give a look to what's done for Tinkerboard to see if we can have a proper service doing that.

Posted

@Raffa

As I said your method works fine on my Pine64 but only after the first poweron -> if I reboot (typing reboot on the console) then rtk_hciattach fail after 99 tries.

 

Do you have the same problem with your Orange Pi Prime ?

Posted
2 hours ago, vlad59 said:

then rtk_hciattach fail after 99 tries.

 

For the Tinker Board myself, @Myy, and someone else on GitHub (bad memory) worked out a user-space solution to toggle the reset line on the module.  This is the issue you are experiencing, if I had to guess, that the Bluetooth is not reset on boot.  

Posted
15 hours ago, TonyMac32 said:

PineA64 has those GPIO's here:

The script doesn't match the schematic : script is using gpio149 while PL4 should be gpio356

Posted
The script doesn't match the schematic : script is using gpio149 while PL4 should be gpio356
The script is for the tinker board, I referenced it as an example, the gpio's have to be adjusted for the Pine. (I don't have one or I'd just do it)

Sent from my Pixel using Tapatalk

Posted
On 12/14/2018 at 1:54 PM, vlad59 said:

@Raffa

As I said your method works fine on my Pine64 but only after the first poweron -> if I reboot (typing reboot on the console) then rtk_hciattach fail after 99 tries.

 

Do you have the same problem with your Orange Pi Prime ?

 

Yes as I said on the first post I use the scripts originally developed for C.H.I.P. board with the reset pin changed:

 

Quote

 

#!/bin/sh

BT_RST_N=80

 

failed () {

        status=$2

 

        echo ${1}

        echo ${BT_RST_N} > /sys/class/gpio/unexport

        exit ${status}

}

 

# Make sure this is a Crumb

[ "$(cat /proc/device-tree/model)" = "Xunlong Orange Pi Prime" -o \

  "$(cat /proc/device-tree/model)" = "Xunlong Orange Pi Prime" ] || \

        failed "This is not a Crumb ... exiting" $?

 

# Make the BT_RST_N GPIO available to userspace

if [ ! -e /sys/class/gpio/gpio${BT_RST_N} ]; then

        echo ${BT_RST_N} > /sys/class/gpio/export || \

                failed "Failed to export BT_RST_N" $?

fi

 

# Set BT_RST_N to be an output

echo out > /sys/class/gpio/gpio${BT_RST_N}/direction || \

        failed "Failed to set BT_RST_N direction = out" $?

 

# Toggle BT_RST_N to reset Bluetooth

{

        echo 1 > /sys/class/gpio/gpio${BT_RST_N}/value;

        sleep 0.1;

        echo 0 > /sys/class/gpio/gpio${BT_RST_N}/value;

        sleep 0.1;

        echo 1 > /sys/class/gpio/gpio${BT_RST_N}/value;

} || failed "Failed to toggle Bluetooth reset" $?

 

# Cleanup BT_RST_N direction and unexport it

echo in > /sys/class/gpio/gpio${BT_RST_N}/direction || \

        failed "Failed to set BT_RST_N direction = in" $?

 

echo ${BT_RST_N} > /sys/class/gpio/unexport || \

        failed "Failed to unexport BT_RST_N" $?

 

echo "Bluetooth reset successfully!"

 

 

 

 

The script use GPIO to generate a reset pulse on the line and it is necessary if you try to reconfigure the bluetooth module after each initial configuration.

 

Posted
6 hours ago, martinayotte said:

The script doesn't match the schematic : script is using gpio149 while PL4 should be gpio356

 

Thanks all, indeed I was not clear at all.

 

I'll update the script to use gpio356 and try to provide a patch soon

Posted

I can confirm that running theses lines make bluetooth work even after a reboot :

 

root@pine64:~# echo 356 > /sys/class/gpio/export
root@pine64:~# echo high > /sys/class/gpio/gpio356/direction
root@pine64:~# echo 0 > /sys/class/gpio/gpio356/value && sleep 1
root@pine64:~# echo 1 > /sys/class/gpio/gpio356/value

I'll clean that up and do a PR

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines