Raffa Posted December 11, 2018 Share Posted December 11, 2018 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 ? Link to comment Share on other sites More sharing options...
TonyMac32 Posted December 11, 2018 Share Posted December 11, 2018 If you look at the configuration of the Tinker board it should be possible implement exactly the same thing using the correct pinout Link to comment Share on other sites More sharing options...
martinayotte Posted December 11, 2018 Share Posted December 11, 2018 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 ... Link to comment Share on other sites More sharing options...
vlad59 Posted December 12, 2018 Share Posted December 12, 2018 I'm building an image now will test after lunch Link to comment Share on other sites More sharing options...
vlad59 Posted December 12, 2018 Share Posted December 12, 2018 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. Link to comment Share on other sites More sharing options...
Raffa Posted December 12, 2018 Author Share Posted December 12, 2018 Probably you are missing the first one: CONFIG_SERIAL_DEV_BUS=m without this option the other two are ignored. Link to comment Share on other sites More sharing options...
martinayotte Posted December 12, 2018 Share Posted December 12, 2018 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 ... Link to comment Share on other sites More sharing options...
vlad59 Posted December 13, 2018 Share Posted December 13, 2018 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. Link to comment Share on other sites More sharing options...
vlad59 Posted December 14, 2018 Share Posted December 14, 2018 @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 ? Link to comment Share on other sites More sharing options...
TonyMac32 Posted December 14, 2018 Share Posted December 14, 2018 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. Link to comment Share on other sites More sharing options...
vlad59 Posted December 14, 2018 Share Posted December 14, 2018 @TonyMac32 Thanks will look for that then, thanks a lot Link to comment Share on other sites More sharing options...
vlad59 Posted December 14, 2018 Share Posted December 14, 2018 Think I found it : https://github.com/Miouyouyou/MyyQi/issues/7#issuecomment-388589883 The script is there : https://github.com/Miouyouyou/tinkerboard_rtl8723bs/blob/master/reset_bt_through_gpio.sh I'll try that monday after lunch, I forgot my Pine64 at work Link to comment Share on other sites More sharing options...
TonyMac32 Posted December 14, 2018 Share Posted December 14, 2018 It's in our build system, I'll post links after bit, I simplified somewhat. You'll need to find your gpio's that correspond to the ones used on tinker https://github.com/armbian/build/blob/master/packages/bsp/rockchip/start_bt.sh https://github.com/armbian/build/blob/master/packages/bsp/rockchip/tinker-bluetooth.service PineA64 has those GPIO's here: Link to comment Share on other sites More sharing options...
martinayotte Posted December 15, 2018 Share Posted December 15, 2018 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 Link to comment Share on other sites More sharing options...
TonyMac32 Posted December 15, 2018 Share Posted December 15, 2018 The script doesn't match the schematic : script is using gpio149 while PL4 should be gpio356The 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 Link to comment Share on other sites More sharing options...
Raffa Posted December 15, 2018 Author Share Posted December 15, 2018 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. Link to comment Share on other sites More sharing options...
vlad59 Posted December 15, 2018 Share Posted December 15, 2018 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 Link to comment Share on other sites More sharing options...
vlad59 Posted December 17, 2018 Share Posted December 17, 2018 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 Link to comment Share on other sites More sharing options...
Recommended Posts