SchmuseTigger Posted May 25, 2019 Posted May 25, 2019 Me neither. As I said I used the description from above. Are you sure that ttyS1 is the correct port to use? Is that the same as UART1? 0 Quote
SchmuseTigger Posted May 27, 2019 Posted May 27, 2019 Feels like I'm so close, just missing one command 0 Quote
megi Posted May 27, 2019 Posted May 27, 2019 hciattach is not necessary, the kernel does that automatically if configured like this: https://megous.com/git/linux/commit/?h=opi3-5.2&id=0c27ac4b4586bc2c0dded85b5bf82f78531d01c3 Sorry, I don't have guide to make BT work, because there's shouldn't be much to configure. All you need is a kernel with the support and then you just need to configure BT address (btmgmt public-addr) for your device. Kernel part is something armbian should figure out. 0 Quote
megi Posted May 27, 2019 Posted May 27, 2019 Also without kernel's H6 RTC patches, you'll not make this work, because BT will not have clock enabled. 0 Quote
data Posted May 27, 2019 Author Posted May 27, 2019 Do you know if these patches are included in the current lite2 built? 0 Quote
SchmuseTigger Posted May 28, 2019 Posted May 28, 2019 15 hours ago, megi said: hciattach is not necessary, the kernel does that automatically if configured like this: Allright, so I just wait for 5.2 Kernel and hope for the best. Thanks for your answer though! And even if it did not work, it was kinda fun to try to figure out how that works. Even though everything with drivers (firmware) is still insane complicated on Linux 1 Quote
megi Posted May 30, 2019 Posted May 30, 2019 On 5/27/2019 at 8:37 PM, data said: Do you know if these patches are included in the current lite2 built? I don't see them in armbian. Anyway, I only have Opi 3 working, and lite2 may have a different bluetooth chip. 0 Quote
renedis Posted June 25, 2019 Posted June 25, 2019 On 5/30/2019 at 3:50 AM, megi said: I don't see them in armbian. Anyway, I only have Opi 3 working, and lite2 may have a different bluetooth chip. If I convert DTB to DTS (and back) and add this: /* There's the BT part of the AP6256 connected to that UART */ &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; uart-has-rtscts; status = "okay"; bluetooth { compatible = "brcm,bcm4345c5"; clocks = <&rtc 1>; clock-names = "lpo"; device-wakeup-gpios = <&r_pio 1 2 GPIO_ACTIVE_HIGH>; /* PM2 */ host-wakeup-gpios = <&r_pio 1 1 GPIO_ACTIVE_HIGH>; /* PM1 */ shutdown-gpios = <&r_pio 1 4 GPIO_ACTIVE_HIGH>; /* PM4 */ max-speed = <1500000>; }; }; And copy https://github.com/orangepi-xunlong/OrangePiH6_external/tree/master/ap6256 to: /lib/firmware/brcm/(BCM4345C5.hcd) Am I correct that it will it work then? (I'm using a OPi3) 0 Quote
rawaaw Posted August 28, 2019 Posted August 28, 2019 Seems i found some workaround for OPi Lite2 board under latest armbian image for OPi lite2 (Linux orangepilite2 5.2.5-sunxi64 #5.92). uart1 is configured properly by board DTB (no loaded uart1 overlay!) but bt chip on ttyS1 not answered. Board schematics (OrangePi_Lite2_Schematics_v2.0.pdf) is strange: BT-RST-N pulled up to vcc (R139 on schematics) and pulled down to GND (R147). After boot pin PM4 (BT-REG-ON -> BT-RST-N) is unclaimed and seems BT-RST-N actually has low level. cat /sys/kernel/debug/pinctrl/*/pinmux-pins pin 388 (PM4): UNCLAIMED 1. Try pull up this pin: echo 388 > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio388/direction echo 1 >/sys/class/gpio/gpio388/value 2. load hci_uart module and do attach to uart1: modprobe hci_uart hciattach /dev/ttyS1 any 3. now i see two hci devices: root@orangepilite2:~# hciconfig hci1: Type: Primary Bus: UART BD Address: AA:AA:AA:AA:AA:AA ACL MTU: 1021:8 SCO MTU: 64:1 DOWN RX bytes:712 acl:0 sco:0 events:38 errors:0 TX bytes:464 acl:0 sco:0 commands:44 errors:0 hci0: Type: Primary Bus: SDIO BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0 DOWN RX bytes:0 acl:0 sco:0 events:0 errors:0 TX bytes:0 acl:0 sco:0 commands:0 errors:0 4. try to up hci1: hciconfig hci1 up 5. hci1 up and running now. root@orangepilite2:~# hciconfig hci1 hci1: Type: Primary Bus: UART BD Address: AA:AA:AA:AA:AA:AA ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING RX bytes:1410 acl:0 sco:0 events:74 errors:0 TX bytes:895 acl:0 sco:0 commands:80 errors:0 root@orangepilite2:~# hciconfig hci1 version hci1: Type: Primary Bus: UART BD Address: AA:AA:AA:AA:AA:AA ACL MTU: 1021:8 SCO MTU: 64:1 HCI Version: 4.1 (0x7) Revision: 0x0 LMP Version: 4.1 (0x7) Subversion: 0x6119 Manufacturer: Broadcom Corporation (15) 0 Quote
SchmuseTigger Posted September 2, 2019 Posted September 2, 2019 Seems to not work on OP3. Hope eventually it will work 0 Quote
Werner Posted September 3, 2019 Posted September 3, 2019 You can always give 5.3-rcX kernel a shot if you haven't already. You can find some prebuild debs and images following the link below. 0 Quote
SchmuseTigger Posted September 5, 2019 Posted September 5, 2019 yes, that is the one I'm running and no it does not have working BT 0 Quote
SchmuseTigger Posted September 10, 2019 Posted September 10, 2019 Still the BT shows: hci1: Type: Primary Bus: SDIO BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0 DOWN RX bytes:0 acl:0 sco:0 events:0 errors:0 TX bytes:0 acl:0 sco:0 commands:0 errors:0 Running 5.3.0 RC8 0 Quote
Werner Posted September 11, 2019 Posted September 11, 2019 I found some information about bluetooth here regarding firmware for a certain chip. https://linux-sunxi.org/Xunlong_Orange_Pi_3 0 Quote
SchmuseTigger Posted September 12, 2019 Posted September 12, 2019 Do you need only the first file or all the others too? BCM4345C5.hcd add ap6256 firmware8 months ago config.txt add ap6256 firmware8 months ago fw_bcm43456c5_ag.bin add ap6256 firmware8 months ago fw_bcm43456c5_ag_apsta.bin add ap6256 firmware8 months ago nvram.txt well, I got them to the directory, but they show up in green, does that mean anything. If it look at it with lsattr it looks the same: --------------e---- ./BCM4345C5.hcd and with hciconfig it still show the BT device as 0000000 and not working 0 Quote
Werner Posted September 13, 2019 Posted September 13, 2019 19 hours ago, SchmuseTigger said: Do you need only the first file or all the others too? I do not own this board so no idea. 0 Quote
SchmuseTigger Posted September 14, 2019 Posted September 14, 2019 On 9/13/2019 at 3:50 PM, Werner said: I do not own this board so no idea. thanks anyhow. I feel I'm so close with the description stating that the file need to be there and that is it. And I have the file there and it is not working but showing up in a different color. 0 Quote
data Posted September 19, 2019 Author Posted September 19, 2019 @rawaaw Good job. Have you tried if it is actually working? I don't get any results from hcitool scan And there is an error in dmesg when the device is initialized as described by you above: [ 3068.025249] Bluetooth: hci1: command 0x1003 tx timeout But I have the feeling we are almost there, at least for the OPi Lite2 When I try specific parameters for hciattach, I get the following: root@orangepilite2:~# hciattach /dev/ttyS1 bcm43xx 921600 noflow - bcm43xx_init Patch not found, continue anyway Set Controller UART speed to 921600 bit/s Device setup complete root@orangepilite2:~# hciconfig hci1 up Can't init device hci1: Connection timed out (110) 0 Quote
rawaaw Posted September 20, 2019 Posted September 20, 2019 >>Have you tried if it is actually working? actually I use this board for working with BLE devices. i use armbian: Linux orangepilite2 5.2.5-sunxi64 #5.92 SMP Fri Aug 2 07:51:38 CEST 2019 aarch64 aarch64 aarch64 GNU/Linux Ubuntu 18.04.3 LTS \n \l also check user 'data' post at april 27 cd /lib/firmware/brcm cp brcmfmac43455-sdio.txt brcmfmac43455-sdio.xunlong,orangepi-lite2.txt also i compilted brcm_patchram_plus for change mac address. https://github.com/phelum/CT_Bluetooth/blob/master/brcm_patchram_plus.c gcc -o brcm_patchram_plus brcm_patchram_plus.c #/bin/sh echo 388 > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio388/direction echo 1 >/sys/class/gpio/gpio388/value sleep 1 /root/brcm_patchram_plus --bd_addr 11:22:33:44:55:66 /dev/ttyS1 sleep 1 hciattach /dev/ttyS1 any hciconfig hci1 up hciconfig hci1 exit 0 root@orangepilite2:~# ./hci.sh Device setup complete hci1: Type: Primary Bus: UART BD Address: 11:22:33:44:55:66 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING RX bytes:668 acl:0 sco:0 events:34 errors:0 TX bytes:423 acl:0 sco:0 commands:34 errors:0 BLE actually working: root@orangepilite2:~# hcitool -i hci1 lescan LE Scan ... EB:98:F8:C0:XX:XX (unknown) EB:98:F8:C0:XX:XX Mi Band 3 EE:1A:6E:72:YY:YY (unknown) EE:1A:6E:72:YY:YY Mi Smart Band 4 root@orangepilite2:~# gatttool -t random -i hci1 -b EB:98:F8:C0:XX:XX -I [EB:98:F8:C0:XX:XX][LE]> connect Attempting to connect to EB:98:F8:C0:XX:XX Connection successful [EB:98:F8:C0:XX:XX][LE]> char-desc handle: 0x0001, uuid: 00002800-0000-1000-8000-00805f9b34fb handle: 0x0002, uuid: 00002803-0000-1000-8000-00805f9b34fb handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb handle: 0x0004, uuid: 00002803-0000-1000-8000-00805f9b34fb handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb ..... 0 Quote
rawaaw Posted September 20, 2019 Posted September 20, 2019 >>root@orangepilite2:~# hciattach /dev/ttyS1 bcm43xx 921600 noflow - When i tried attach 6255 by this way BT adapter hangs up. So i set mac address with brcm_patchram_plus and do attach adapter as generic hci device with hciattach /dev/ttyS1 any see my previous post for detailes 0 Quote
data Posted September 23, 2019 Author Posted September 23, 2019 @rawaaw Great, works on nightly Linux orangepilite2 5.3.0-sunxi64 #5.97.190919 SMP Thu Sep 19 02:51:56 CEST 2019 aarch64 GNU/Linux from 4 days ago as well. I just missed the patchram command last time I tried. By the way, I am user data who wrote the post on April 27th And I am happy to see that my initial efforts finally led to success! So ladies and gentlemen, attached you'll find an archive with a working init-script for the ap6255 bluetooth chip. Move the included files to the according directories and modify the MAC-Address in /etc/default/ap6255 to your needs activate bluetooth with # service ap6255-bluetooth start check status: # service ap6255-bluetooth status enable on boot: # systemctl enable ap6255-bluetooth @Igor Include this in the upcoming snapshots please! And thanks to everybody who made this possible! ap6255_bluetooth.zip 0 Quote
Igor Posted September 24, 2019 Posted September 24, 2019 7 hours ago, data said: Include this in the upcoming snapshots please! You can do it as well Unpack ZIP here:https://github.com/armbian/build/tree/master/packages/bsp Copy files to rootfs here:https://github.com/armbian/build/blob/master/config/sources/sun50iw6.conf#L48-L58 Another example (almost identical): https://github.com/armbian/build/blob/master/config/sources/cubox.conf#L78-L81 Then create a pull request. 0 Quote
rawaaw Posted September 24, 2019 Posted September 24, 2019 On 9/10/2019 at 6:26 PM, SchmuseTigger said: >>hci1: Type: Primary Bus: SDIO Why SDIO ? Must be UART. 0 Quote
SchmuseTigger Posted September 24, 2019 Posted September 24, 2019 6 hours ago, rawaaw said: how or where would I be able to change that? I activated UART in the armbian-config but have honestly no clue or what to google to find that out 0 Quote
rawaaw Posted September 24, 2019 Posted September 24, 2019 3 hours ago, SchmuseTigger said: >>I activated UART in the armbian-config As i understood you have opi 3 board. Wifi/BT is AP6255 and pins for connecting BT part to CPU the same as on opi lite2. http://www.orangepi.org/downloadresources/OrangePi3/2019-01-23/orangepi3_b1a3a5d8f07c69d0da699e77d6.html Did you enabled uart1 with overlay ? Default .dtb for opi lite2 (i don't know what about opi3 board) already has uart1. You should not activate uart1 overlay in this case. You may check this for your board with dtc -I dtb -O dts /boot/dtb-xxx-sunxi64/allwinner/sun50i-h6-xxx.dtb Check lines in the output like this: .... uart1-pins { pins = "PG6", "PG7"; function = "uart1"; phandle = <0x1d>; }; uart1-rts-cts-pins { pins = "PG8", "PG9"; function = "uart1"; phandle = <0x1e>; }; ... Also you may check pin assignment with cat /sys/kernel/debug/pinctrl/*/pinmux-pins If uart1 initialized you can see lines: ... pin 198 (PG6): 5000400.serial (GPIO UNCLAIMED) function uart1 group PG6 pin 199 (PG7): 5000400.serial (GPIO UNCLAIMED) function uart1 group PG7 pin 200 (PG8): 5000400.serial (GPIO UNCLAIMED) function uart1 group PG8 pin 201 (PG9): 5000400.serial (GPIO UNCLAIMED) function uart1 group PG9 ... Did you load hci_uart module with modprobe before enable BT chip and hciattach ? PS: What result of 'hciconfig hci0' command ? 0 Quote
SchmuseTigger Posted September 26, 2019 Posted September 26, 2019 Well, I try to do all those things. But most of it looks kinda alien to me. From the bottom up, no I did nothing with a modprobe. The pins say: pin 198 (PG6): 5000400.serial (GPIO UNCLAIMED) function uart1 group PG6 pin 199 (PG7): 5000400.serial (GPIO UNCLAIMED) function uart1 group PG7 pin 200 (PG8): (MUX UNCLAIMED) (GPIO UNCLAIMED) pin 201 (PG9): (MUX UNCLAIMED) (GPIO UNCLAIMED) So seems they are not connected now the other thing above with the dtb file: I found the first one: uart1-pins { pins = "PG6\0PG7"; function = "uart1"; phandle = < 0x1e >; }; and the second: uart1-rts-cts-pins { pins = "PG8\0PG9"; function = "uart1"; phandle = < 0x1f >; }; And to the HCI config: hci0: Type: Primary Bus: USB BD Address: 00:15:83:0C:BF:EB ACL MTU: 339:8 SCO MTU: 128:2 UP RUNNING RX bytes:966 acl:0 sco:0 events:41 errors:0 TX bytes:901 acl:0 sco:0 commands:41 errors:0 And the other one (the first one is a usb one that unfortunatly is not a LE so it does not work with what I want to do with it) And second one is still: hci1: Type: Primary Bus: SDIO BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0 DOWN RX bytes:0 acl:0 sco:0 events:0 errors:0 TX bytes:0 acl:0 sco:0 commands:0 errors:0 So, it seems I have to connect the device with modprobe to actually use those uart/gpio pins somehow? 0 Quote
SchmuseTigger Posted October 1, 2019 Posted October 1, 2019 Question: does anybody have any ideas how to connect the uart bus so the onboard bt adapter uses it? Or any link or keywords for google? Thanks 0 Quote
Raffa Posted October 2, 2019 Posted October 2, 2019 For everyone that need a working Bluetooth on OPi3 i've found a fast solution: I'm using this version of Armbian: Linux orangepi3 5.3.1-sunxi64 #5.98.190930 SMP Mon Sep 30 02:43:17 CEST 2019 aarch64 GNU/Linux There is no need to use extra overlay or enable uart1, all the configurations are just present on sun50i-h6-orangepi-3.dtb. You can use the procedure indicated on previous post: and change the patching line to: /usr/bin/timeout 20s /usr/bin/brcm_patchram_plus --patchram /lib/firmware/brcm/BCM4345C5.hcd --no2bytes --bd_addr $MAC_OPTIONS /dev/$PORT 2>&1 Bluetooth must start without problem .... I've seen that a patch for bluetooth on OPi3 is just developed : https://lkml.org/lkml/2019/8/23/320 but i don't known if and when it will be included into mainline distribution. 0 Quote
megi Posted October 3, 2019 Posted October 3, 2019 Linux 5.4 contains the code changes, dts changes will be included in 5.5. 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.