maracuja Posted October 24, 2018 Posted October 24, 2018 Hello... I've got an Orange Pi Zero Plus 2 H3 with Armbian Stretch. Kernel: 4.14.70-sunxi armbianEnv.txt: Quote verbosity=1 logo=disabled console=serial disp_mode=1920x1080p60 overlay_prefix=sun8i-h3 overlays=uart1 uart2 uart3 usbhost2 usbhost3 ... param_uart1_rtscts=1 param_uart2_rtscts=1 param_uart3_rtscts=1 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u I did: cp -a /lib/firmware/ap6212/fw_bcm43438a1.bin /lib/firmware/brcm/brcmfmac43430-sdio.bin dmesg when searching for "brcm" gives me: [ 8.123186] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001 [ 8.256708] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Oct 8 2016 15:31:47 version 7.46.57.4.ap.r4 (A1 Station/P2P) FWID 01-3621395e es6.c5.n4.a3 In /etc/default/ap6212 I have: PORT=ttyS1 But the script /etc/init.d/ap6212-bluetooth is failing... with the error "Initialization timed out." Is there any "how-to" for the Orange Pi Zero Plus 2 to get Bluetooth working?
martinayotte Posted October 24, 2018 Posted October 24, 2018 29 minutes ago, maracuja said: Is there any "how-to" for the Orange Pi Zero Plus 2 to get Bluetooth working? As far as I remember, no Devs have started any work on Bluetooth yet... Even if firmware is loaded, this is primarily for WiFi.
maracuja Posted October 25, 2018 Author Posted October 25, 2018 Well, it would be a good hint to put a remark in the download section of Armbian - at least for the Orange Pi Zero Plus2. When downloading Armbian it does not say anything about Bluetooth being completely dysfunctional.
Igor Posted October 25, 2018 Posted October 25, 2018 57 minutes ago, maracuja said: it does not say anything about Bluetooth being completely dysfunctional. Developing, testing and writing requires someone's time/effort. The problem is that it works on some boards, while it doesn't on others. This is community project and this way you can change things.
maracuja Posted October 25, 2018 Author Posted October 25, 2018 I can only offer to test setup instructions on the boards I have, if anyone has recommendations. I'd be glad to post the results here. If Bluetooth is working on some boards with the same chip (AP6212A) then it should actually work on the Zero Plus2 H3 too.
Igor Posted October 25, 2018 Posted October 25, 2018 27 minutes ago, maracuja said: I'd be glad to post the results here. That's fine but still someone needs to take care. We need people that will deal with those results before they get lots in a black hole called forum. 27 minutes ago, maracuja said: If Bluetooth is working on some boards with the same chip (AP6212A) then it should actually work on the Zero Plus2 H3 too. Unfortunately we didn't cover that one, but AP6210 and some others ... Beside that, there are two versions of 6212A which needs different firmware. At least for wireless. It's a small mess. IMO, if you want to solve this, you "only" need a right portion of persistence. How-to is most likely present on this forum or can be found on the internet.
maracuja Posted October 25, 2018 Author Posted October 25, 2018 I could make some tiny progress: First I checked the orange pi zero plus 2 schematics to be sure it is using UART1 for Bluetooth. Yes it is. Then I had a look at the current device tree - somebody wrote that there should be 2 addresses in the pinctrl-0 entry. Mine had only 1 address. I decompiled /boot/dtb-4.14.65-sunxi/sun8i-h3-orangepi-zeroplus2.dtb and had a look at the entry serial@01c28400 This is what is loooks like Quote serial@01c28400 { compatible = "snps,dw-apb-uart"; reg = <0x1c28400 0x400>; interrupts = <0x0 0x1 0x4>; reg-shift = <0x2>; reg-io-width = <0x4>; clocks = <0x6 0x3f>; resets = <0x6 0x32>; dmas = <0x1f 0x7 0x1f 0x7>; dma-names = "rx", "tx"; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <0x24 0x25>; linux,phandle = <0x66>; phandle = <0x66>; }; Here you can see pinctrl-0 looks okay. So it must be the overlay that messes this up. I also looked at the uart1 overlay file (decompiled it) but all these things are new to me, so I gave up on it. But something different looked promising: The status field is "okay", so it is enabled, right in the /boot/dtb-4.14.65-sunxi/sun8i-h3-orangepi-zeroplus2.dtb I guess I don't even need an overlay to enable it then? So knowing that the overlay messes the pinctrl-0 entry up, and guessing that I don't even need it, I just removed the uart1 overlay from the /boot/armbianEnv.txt and rebooted. Now the output of my script looks like this: Quote bcm43xx_init Set Controller UART speed to 115200 bit/s Flash firmware /etc/firmware/ap6212/BCM43430A1.hcd Initialization timed out. Before it only said "Initialization timed out" with no UART speed output or Flash firmware output. It's still not working... 1) I copied BCM43430A1.hcd from some site on the internet, having the same MD5 hash as a user that claims it's been working on this orange pi. Maybe I should've used the original one shipped with armbian... (which had a different MD5 hash)... now I've restored the original file (simply by deleting it, the init script copies the original one over) - but same result 2) I've also removed param_uart1_rtscts=1 from armbianEnv.txt - I don't know if this affects anything...
maracuja Posted October 25, 2018 Author Posted October 25, 2018 Just for the sake of completeness: I've changed the init script for AP6212, I've inserted this: Quote /usr/local/bin/dmem2 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
dony71 Posted November 27, 2018 Posted November 27, 2018 On 10/25/2018 at 8:53 AM, maracuja said: Just for the sake of completeness: I've changed the init script for AP6212, I've inserted this: I have BPI-M2+ and I don't have /usr/bin/dmem2 in the system apt install dev2mem Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package dev2mem How do i install dmem2 ?
martinayotte Posted November 27, 2018 Posted November 27, 2018 11 hours ago, dony71 said: How do i install dmem2 ? You have to compile it yourself from sources : https://bootlin.com/pub/mirror/devmem2.c
Henrik Larsson Posted November 27, 2018 Posted November 27, 2018 @dony71 I compiled it for nanopi neo air and put it here: https://github.com/henla464/WiRoc-StartupScripts/blob/master/devmem2 @maracuja You may also want to read this post:
JRD McLAREN Posted May 17, 2019 Posted May 17, 2019 Heloo.. I have some time past days, to try to work Bluetooth AP6212 adapter on my OPIZeroPlus H5 version ... but, no fun. Have ARMBIAN 5.73 stable Ubuntu 18.04.2 LTS 4.19.38-sunxi64 and try Debian version also. Today I try to look on DTB files, some wiring diagrams etc ... read some posts on this forum, and try it step-by-step ... Now I have working BT on this version OPiZero2 H5 .. and make these modification to work it: Edit /etc/init.d/ap6212-bluetooth file: Quote --- CUT -- do_start () { if [ ! -z $(hciconfig | /bin/grep UART | /usr/bin/cut -d: -f1) ] then echo "ap6212 BT device allready initialized" hcitool dev else # Select MAC address if [ -z "$MAC_ADDR" ]; then MAC_OPTIONS="11:22:33:44:55:66" else MAC_OPTIONS="$MAC_ADDR" fi # Select tty port if [ -z "$PORT" ]; then log_warning_msg "No PORT set in /etc/default/ap6212, will use ttyS1" PORT="ttyS1" fi # Start patching rfkill unblock all echo "0" > /sys/class/rfkill/rfkill0/state echo "1" > /sys/class/rfkill/rfkill0/state #on orangepi win following command never ends on first try... force to run with a timeout... timeout 5s echo " " > /dev/$PORT if [ $? != 0 ]; then #timed out... retry echo " " > /dev/$PORT fi # - added /usr/bin/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.2 # /usr/bin/hciattach /dev/$PORT bcm43xx 1500000 flow #bdaddr $MAC_OPTIONS /bin/hciconfig hci0 up --- CUT --- .. No overlay is needed in armbian.txt for uart1 .. ..so I just remove it ..
Recommended Posts