data Posted October 5, 2018 Posted October 5, 2018 Is there any other firmware for the AP6255 available, besides the one made available for Khadas VIM athttps://github.com/khadas/android_hardware_amlogic_wifi/tree/Vim/bcm_ampak/config/6255/BT or the one for the Raspberry Pi 3+ available e.g. at https://github.com/OpenELEC/misc-firmware/blob/master/firmware/brcm/BCM43430A1.hcd which uses also the same chipset? I am trying to make Bluetooth working on an Orange Pi Lite2. So far I had no success loading the firmware by issuing root@orangepilite2:~# brcm_patchram_plus --patchram /lib/firmware/brcm/BCM43430A1.hcd --enable_hci --bd_addr 11:22:33:44:55:66 --no2bytes --tosleep 1000 /dev/ttyS1 root@orangepilite2:~# brcm_patchram_plus --patchram /lib/firmware/brcm/BCM4345C0.hcd --enable_hci --bd_addr 11:22:33:44:55:66 --no2bytes --tosleep 1000 /dev/ttyS1 Any suggestions?
martinayotte Posted October 5, 2018 Posted October 5, 2018 2 hours ago, data said: Is there any other firmware for the AP6255 available, While doing patches to get WiFi working on OPiLite2 a month ago, I've commited the right firmware (nothing releated to brcm43430 ...) : https://github.com/armbian/firmware/commit/f8fae57a89edae0692eb90f1d94c23a0d05c4402 So, nightly builds should already have WiFi working out-of-the-box ... (But, for Bluetooth, noone worked on making DT for it ...)
data Posted October 5, 2018 Author Posted October 5, 2018 Thank you for your reply. Your firmware is included and it gets loaded at boot, bringing WiFi to life. So I don't need any additional firmware for bluetooth? How do I proceed then? Use hciattach to the UART, to make the device visible?
martinayotte Posted October 5, 2018 Posted October 5, 2018 2 hours ago, data said: How do I proceed then? Use hciattach to the UART, to make the device visible? I have no idea ... Maybe, yes, simply to activate UART, but maybe more in DT ...
data Posted October 8, 2018 Author Posted October 8, 2018 There's no matching UART. Is Bluetooth working in the old/original sunxi image?
Benno Eigenmann Posted October 31, 2018 Posted October 31, 2018 @data Did you check the dts? There must be some binding structure to serial attached Broadcom devices uart1.
data Posted November 3, 2018 Author Posted November 3, 2018 Unfortunatelly, there is no matching dts for the h6 nor sun50i-h6-uart1.dtbo
Benno Eigenmann Posted November 4, 2018 Posted November 4, 2018 @data You can decompile the dtb from a working bluetooth ap6255 or Broadcom BCM43455 with dtc -I dtb -O dts <file> dtc -I dtb -O dts ./cache/sources/u-boot/h6-hdmi-rebased-1/arch/arm/dts/sun50i-h6-orangepi-lite2.dtb has only the debug port uart0-ph { pins = "PH0", "PH1"; function = "uart0"; phandle = <0x9>; }; Im missing the pindef uart1 and pcm for the drive uart1_pins: uart1-pins { pins = "PG6", "PG7"; function = "uart1"; }; uart1_rts_cts_pins: uart1-rts-cts-pins { pins = "PG8", "PG9"; function = "uart1"; }; and uart1 &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; status = "okay"; };
data Posted November 4, 2018 Author Posted November 4, 2018 So what is the proper way to do it? - decompile the sun50i-h6-orangepi-lite2.dtb, modify the dts and create a new dtb via armbian-add-overlay <overlay_file.dts> or - create an overlay with just the uart1 relevant details?
Benno Eigenmann Posted November 4, 2018 Posted November 4, 2018 -First find a image with working bluetooth. -decompile the dtb -modify the dtb on your orangepilite2 in root@orangepilite2:/boot/dtb/allwinner# -if it is is working write a patch in patch/kernel/sunxi-dev-h6
data Posted November 4, 2018 Author Posted November 4, 2018 Ok, here's something: I mounted the boot partition from the BETA Ubuntu Image ( OrangePi_Lite2_Ubuntu16.04_Server_BETA ) from http://orangepi.org/ $ fdisk -l OrangePi_Lite2_Ubuntu16.04_Server_BETA.img Medium OrangePi_Lite2_Ubuntu16.04_Server_BETA.img: 1,4 GiB, 1468006400 Bytes, 2867200 Sektoren Einheiten: sectors von 1 * 512 = 512 Bytes Sektorengröße (logisch/physisch): 512 Bytes / 512 Bytes I/O Größe (minimal/optimal): 512 Bytes / 512 Bytes Typ der Medienbezeichnung: dos Medienkennung: 0xdecd62b7 Gerät Boot Start Ende Sektoren Größe Id Typ OrangePi_Lite2_Ubuntu16.04_Server_BETA.img1 40960 143359 102400 50M c W95 FAT32 (LBA) OrangePi_Lite2_Ubuntu16.04_Server_BETA.img2 143360 2457599 2314240 1,1G 83 Linux $ mount -o loop,offset=20971520 OrangePi_Lite2_Ubuntu16.04_Server_BETA.img /mnt/tmp found a .dtb in the orangepi folder called OrangePiH6.dtb and decompiled it with: dtc -I dtb -O dts OrangePiH6.dtb I have attached the .dtb as well as the .dts Here are the relevant entries for uart1: uart1@0 { linux,phandle = <0xe8>; phandle = <0xe8>; allwinner,pins = "PG6", "PG7", "PG8", "PG9"; allwinner,function = "uart1"; allwinner,pname = "uart1_tx", "uart1_rx", "uart1_rts", "uart1_cts"; allwinner,muxsel = <0x2>; allwinner,pull = <0x1>; allwinner,drive = <0xffffffff>; allwinner,data = <0xffffffff>; }; uart1@1 { linux,phandle = <0xe9>; phandle = <0xe9>; allwinner,pins = "PG6", "PG7", "PG8", "PG9"; allwinner,function = "uart1"; allwinner,pname = "uart1_tx", "uart1_rx", "uart1_rts", "uart1_cts"; allwinner,muxsel = <0x7>; allwinner,pull = <0x1>; allwinner,drive = <0xffffffff>; allwinner,data = <0xffffffff>; }; Then, there is another uart specified, which is probably related to bluetooth: uart@05000400 { compatible = "allwinner,sun50i-uart"; device_type = "uart1"; reg = <0x0 0x5000400 0x0 0x400>; interrupts = <0x0 0x1 0x4>; clocks = <0x1f>; pinctrl-names = "default", "sleep"; uart1_port = <0x1>; uart1_type = <0x4>; status = "okay"; pinctrl-0 = <0xe8>; uart1_bt = <0x1>; pinctrl-1 = <0xe9>; }; Finally, there are two entries at the bottom of the dts which look like they are relevant for bluetooth: bt { compatible = "allwinner,sunxi-bt"; clocks = <0xd7>; bt_power = "vcc-wifi"; bt_io_regulator = "vcc-wifi-io"; status = "okay"; device_type = "bt"; bt_rst_n = <0xd8 0xc 0x4 0x1 0xffffffff 0xffffffff 0x0>; }; btlpm { compatible = "allwinner,sunxi-btlpm"; uart_index = <0x1>; status = "okay"; device_type = "btlpm"; bt_hostwake_enable = <0x1>; bt_wake = <0xd8 0xc 0x2 0x1 0xffffffff 0xffffffff 0x1>; bt_hostwake = <0xd8 0xc 0x1 0x0 0xffffffff 0xffffffff 0x0>; }; Is this sufficient to create an updated sun50i-h6-orangepi-lite2.dts? OrangePiH6.dtb OrangePiH6.dts
Ma Tianfu Posted November 11, 2018 Posted November 11, 2018 On Orange Pi Lite 2, using bionic nightly with 4.18.17-sunxi64 kernel. dmessage shows everthing ok for AP6255 ``` [ 15.705964] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 15.711588] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 15.908540] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6 [ 16.139476] Bluetooth: Core ver 2.22 [ 16.139548] NET: Registered protocol family 31 [ 16.139551] Bluetooth: HCI device and connection manager initialized [ 16.139570] Bluetooth: HCI socket layer initialized [ 16.139576] Bluetooth: L2CAP socket layer initialized [ 16.139617] Bluetooth: SCO socket layer initialized [ 16.327571] Bluetooth: Generic Bluetooth SDIO driver ver 0.1 [ 16.486332] EXT4-fs (zram0): mounted filesystem without journal. Opts: discard [ 18.496780] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6 [ 18.633959] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04 [ 27.682340] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [ 27.707595] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [ 28.374744] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [ 548.562865] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready [ 1188.296553] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 1188.296559] Bluetooth: BNEP filters: protocol multicast [ 1188.296571] Bluetooth: BNEP socket layer initialized ``` After installing bluez, hci0 shows up. ``` ma@orangepilite2:~$ hciconfig 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 ``` However it cannot be brought up. ``` ma@orangepilite2:~$ sudo hciconfig hci0 up Can't init device hci0: Input/output error (5) ``` can anybody shed some light? Is it a problem of bsp or I missed something important.
data Posted November 11, 2018 Author Posted November 11, 2018 From what I understand is, that you have to attach the hciadapter to the uart, e.g. $ hciattach /dev/ttyXXX any But since the corresponding UART is not yet defined in the .dts (see above) it is not recognized by the kernel. So first you have to add the uart settings to the .dts
Ma Tianfu Posted November 11, 2018 Posted November 11, 2018 3 minutes ago, data said: From what I understand is, that you have to attach the hciadapter to the uart, e.g. $ hciattach /dev/ttyXXX any But since the corresponding UART is not yet defined in the .dts (see above) it is not recognized by the kernel. So first you have to add the uart settings to the .dts Thank you very much. I will try to rebuild the kernel tomorrow. One more question. I am not familiar with wifi/bt combo device. In schematic, there are usually some gpios used to as WIFI_REG_ON, BT_REG_ON (Or BT_RESET), HOST_WAKE_BT, BT_WAKE_HOST, etc. Are those gpios controlled by wifi or bluetooth driver? or they are controlled by userspace program via linux GPIO?
data Posted November 11, 2018 Author Posted November 11, 2018 Sorry, but that is beyond my knowledge. Igor or Martin probably know the answer!
data Posted November 11, 2018 Author Posted November 11, 2018 But once you have a working dts with the new uart, please let me know!
martinayotte Posted November 11, 2018 Posted November 11, 2018 43 minutes ago, Ma Tianfu said: Are those gpios controlled by wifi or bluetooth driver? Yes, the driver is responsible to control those...
data Posted April 27, 2019 Author Posted April 27, 2019 I tried a new approach on bringing bluetooth to life... With the current nightly, I noticed some complaints about a missing firmware: [ 11.484843] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.xunlong,orangepi-lite2.txt failed with error -2 Which was easily fixed by root@orangepilite2:~# cp /lib/firmware/rkwifi/nvram_ap6255.txt /lib/firmware/brcm/brcmfmac43455-sdio.xunlong,orangepi-lite2.txt But UART1, connected to the ap6255 according to the official schematics is not defined in the dtb I found at /boot/dtb-5.0.9-sunxi64/allwinner/sun50i-h6-orangepi-lite2.dtb Now I am stuck with bringing UART1 aka /dev/ttyS1 to life. So far, I tried adding an overlay to /boot/armbianEnv.txt: There is one which looks promising at /boot/dtb/allwinner/overlay/sun50i-h6-uart1.dtbo So adding 'overlays=uart1' was the next step but I still don't get ttyS1 to work. Comparing the other dtbos, I noticed that some contain definitions for the RTS/CTS pins dtc -I dtb -O dts /boot/dtb/allwinner/overlay/sun50i-h6-uart2.dtbo What am I missing? [By the way, I also tried adding uart1 to the dtb, without success...] Schematics are at http://linux-sunxi.org/images/4/4c/OrangePi_Lite2_Schematics_v2.0.pdf
Recommended Posts