Jump to content

Orange Pi Zero Plus 2 H5 OTG, Bluetooth and CSI


Simon

Recommended Posts

After trying the ESP32, CHIP and CHIP PRO, I now have the OPI Zero+2 H5 and after much research (the Armbian forums) and testing, was unable to get USB OTG and Bluetooth working. I'm particularly interested in Bluetooth Low Energy and WIFI. WIFI worked great, simply using nmtui, worked first time. Thanks for solving the AP6212A WIFI firmware issues. However, do I understand correctly the USB OTG (I want to connect the OPI Z+2H5 micro USB to a USB hub to connect a mouse and keyboard) is not working yet? Similarly, is the AP6212A bluetooth driver/firmware being worked on at the moment? In addition, I'm waiting for some cameras to be delivered, my next project being the CSI (24pin 0.5mm pitch) interface, but I guess that's a different topic!! Thanks...

Link to comment
Share on other sites

H5 for multimedia project will be challenging at this moment. I am not sure how far is CSI, while the rest are minor problems.

 

Exact status of USB OTG on H5 chip is unknown to me. Host mode (which is what you need) might be already working with proper settings ... Bluetooth should be possible to bring up, but AFAIK nobody done it yet to the user on/off level yet. The whole image / kernel is WIP in more areas. The only alternative is Allwinner H5 kernel with many other problems and we don't support it for many reasons.

Link to comment
Share on other sites

Thanks for your replies. A litte more progress by installing the debian OS from orangepi.org  (debian_jessie_zeroplus2_H5_V0_2.rar). This version enables the micro USB OTG (host mode) for use with USB hub, mouse and keyboard, WIFI worked immediately from the desktop setup. Unfortunately, bluetooth seems non-existent on this version. Having read the Armbian details on the AP6212A WIFI and bluetooth combo chip, I'm assuming the AP6212A firmware files are pretty much standard regardless of which OS is running? I don't see the firmware files even exist in the /lib/firmware/ folder for the above OS. To get bluetooth and bluetooth Low Energy working, is it a matter of configuration settings to enable the AP6212A's bluetooth function? I realize of course, the above OS is not Armbian, thought it may help with the micro USB OTG (host) setup in the Armbian OS. Any ideas on how bluetooth can be enabled, followed by bluetooth Low Energy function/setup? Thanks again....

Link to comment
Share on other sites

The problem with OS from OrangePi is that it's v0.2 and its smelly and buggy 3.10.x kernel will stay there forever.

There is one crazy issue with AP6212A and AP6212. They both seek for the firmware in the same place while they need a different one. Type AP6212A in a search to get insights.

 

6 hours ago, Simon said:

To get bluetooth and bluetooth Low Energy working, is it a matter of configuration settings to enable the AP6212A's bluetooth function?

 

I have no idea if low energy Bluetooth functions are working - we usually end our testings when some HID device is able to connect. In any case you have way more chances of success with modern kernel 4.12.x, which is at least supported and is getting fixes on daily base.

 

6 hours ago, Simon said:

I realize of course, the above OS is not Armbian, thought it may help with the micro USB OTG (host) setup in the Armbian OS.

 

Not much is usable from that kernel since its too big difference. Most of core functions were written from scratch - you can monitor progress here.

Link to comment
Share on other sites

Wow!! Thanks yet again re: Smelly and buggy 3.10.x Kernel.

I'll re-install the Armbian OS and attempt some debugging re: AP6212A firmware. Do you recommend the latest nightly version and to keep an eye on the progress for relevant fixes (USB OTG (host), Bluetooth LE and CSI) followed by a re-install each time? You mentioned in another post that the "Failure" to load the AP6212 files related only to bluetooth which makes sense as WIFI is working fine. 

Link to comment
Share on other sites

Apologies, I meant to ask which OS you recommend I install or will they all be pretty much the same in terms of updates and fixes? 

  1. Ubuntu server - mainline kernel
  2. Ubuntu_xenial_dev
  3. Ubuntu_xenial_dev_desktop
  4. Ubuntu_xenial_dev_nightly

Thanks again....

Link to comment
Share on other sites

Wireless chip on this board is decent (one of the best what's on those little boards), it works (with appropriate firmware), but don't expect router class functionality.

 

There is nothing much to recommend at this point - there is only the one and only kernel and images might come in different versions: with or without a desktop, Ubuntu or Debian based. They all share same essential problems.

Since those are still development builds I can't assure you that updating (it goes standard Debian way: apt-get update + apt-get upgrade) will work or that it won't break your system. Usually it works, just beware that quality control / testing on those builds is much lower, while on nightly builds come even without testing. Those builds are made to test and sometimes kernel does not boot ... that is main diff between "nightly" and DEV, NEXT, DEFAULT. Those are different kernel branches - here we only have DEV, on some other boards we have all three.

 

I would recommend you to get latest Nightly build and froze kernel upgrades from armbian-config. This will prevent kernel upgrades while other packages will upgrade normally and you decide to upgrade kernel when you see valid information that it's time to safe upgrade (unfreeze in armbian-config and conduct standard upgrade apt-get update + apt-get upgrade and freeze back).

Link to comment
Share on other sites

Thanks Igor. Pointing me to search for AP6212 led to other posts and post topics and I ended up at this post:

https://forum.armbian.com/index.php?/topic/4578-example-support-proposal-for-rock64/&

Although this is kind of off topic, I started this post explaining having tried the ESP32, CHIP, CHIP PRO and now the Orange Pi Zero+2 H5.  I now have 5 x ESP32, 3 x CHIP, 7 x CHIP PRO (+ development kit) and 3 x OPI Z+2 H5. I found @TKaiser Board Support Proposal particularly interesting. Obviously I'm a newbie here and knew nothing about Armbian until purchasing the OPI boards just a few days ago, I wish I had known about Armbian sooner then perhaps I would not have such a large graveyard of latest tech SBC's. To the point of @TKaiser's post, as a "user" and "newbie" the information Armbian can provide PRIOR to a user purchasing a new, latest and greatest board based on Google searches and technical specs, is invaluable IMO. On each of the above boards I hit a brick wall and cannot continue development due to support issues. I read that it would have been a smarter choice to purchase the OPI Z+2 H3 version rather than the H5 version. My project specifically requires Linux OS, WIFI, BLE, GPIO and Camera. It also needs to be very inexpensive. You guys are so knowledgeable about the intricacies of each board you support (whether good or bad) that as a user I could make a far more informed decision based on your board recommendations which in turn are based on my board functionality requirements.

At this point, referring to the specific board requirements above, should I add the OPI Z+2 H5 to the graveyard and go for the OPI Z+2 H3 board? If so, do you know if the H3 board definitely supports Bluetooth Low Energy? I presume the H3 board uses the older and inferior performing AP6212 chip rather than the AP6212A chip?

FYI: The CHIP was the only board that provided all required functions albeit camera operation via USB which is just too slow FPS. Later to find out the CHIP uses low quality components, is not recommended for commercial use and is not warranted (after all, it's only $9)!! They recommended the CHIP PRO. Unfortunately, on the CHIP PRO the CSI camera interface seems completely unsupported and the CSI hardware connection looks a little weird when compared to other CSI boards and cameras. 

Thanks yet again for all your help.

 

Link to comment
Share on other sites

Hi Igor, I've been trying to get BT running on the OPI Z+2 H5. Think I'm rather confused. I'm trying to connect the AP6212A BT to uart3 (ttyS3) with no luck. The new firmware seems to be correctly located in /lib/firmware/ap6212 and /etc/firmware/ap6212 and /lib/firmware/brcm. I tried using overlay to enable uart3, see below:

/boot/armbianEnv.txt

verbosity=1
console=both
overlay_prefix=sun50i-h5
rootdev=UUID=578b81e7-8242-47b1-ade8-b92dd7aa9e94
rootfstype=ext4
overlays=uart3
param_uart3_rtscts=1

 

However, I'm not sure how to enable uart3?

I also noticed the "default ttyS1 port"  in /etc/init.d/ap6212-bluetooth:

# Select tty port
    if [ -z "$PORT" ]; then
       log_warning_msg "No PORT set in /etc/default/ap6212, will use ttyS1"
       PORT="ttyS1"

 

Also, in /etc/default/ap6212:

#
# Default it is called to be uncertain wich MAC address the chipset has.
# Therefore it is recommendable to set the MAC address manually.
# This can be done by setting the variable MAC_ADDR with a chosen value.
# If this variable is empty or not set the default 11:22:33:44:55:66 will be chosen.

MAC_ADDR=43:29:B1:55:01:01

#

PORT=ttyS1

 

I read the following (I don't know if this is the same for the H5 version):

Overlay pinmux conflicts

Some controllers may share the SoC pins in some configurations. For example on Allwinner H3 UART 3 and SPI 1 use the same pins - PA13, PA14, PA15, PA16.

 

The result from :

root@orangepizeroplus2:/boot# setserial -g /dev/ttyS*
/dev/ttyS0, UART: undefined, Port: 0x0000, IRQ: 27
/dev/ttyS1, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS2, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS3, UART: unknown, Port: 0x0000, IRQ: 0
 

During boot there are two failures:

[  OK  ] Reached target Slices.
         Mounting POSIX Message Queue File System...
         Starting Nameserver information manager...
         Mounting Huge Pages File System...
         Starting Restore / save the current clock...
         Starting Load Kernel Modules...
         Starting Create list of required st... nodes for the current kernel...
         Mounting Debug File System...
[  OK  ] Created slice system-serial\x2dgetty.slice.
         Starting Set console keymap...
         Starting Remount Root and Kernel File Systems...
[  OK  ] Mounted Debug File System.
[  OK  ] Mounted Huge Pages File System.
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Started Restore / save the current clock.
[FAILED] Failed to start Load Kernel Modules.
See 'systemctl status systemd-modules-load.service' for details.
[  OK  ] Started Create list of required sta...ce nodes for the current kernel.
[  OK  ] Started Remount Root and Kernel File Systems.
[  OK  ] Started Nameserver information manager.
[  OK  ] Started Set console keymap.

 

and...

 

[  OK  ] Started LSB: Load kernel modules needed to enable cpufreq scaling.
[  OK  ] Started Raise network interfaces.
[FAILED] Failed to start LSB: Patch firmware for ap6212 adapter.
See 'systemctl status ap6212-bluetooth.service' for details.

[  OK  ] Started Login Service.
         Stopping LSB: Starts LIRC daemon....
         Starting LSB: set CPUFreq kernel parameters...

 

However, if I edit /etc/default/ap6212 and change ttyS1 to ttyS3, the boot error ([FAILED] Failed to start LSB: Patch firmware for ap6212 adapter.) disappears :

/etc/default/ap6212:

#
# Default it is called to be uncertain wich MAC address the chipset has.
# Therefore it is recommendable to set the MAC address manually.
# This can be done by setting the variable MAC_ADDR with a chosen value.
# If this variable is empty or not set the default 11:22:33:44:55:66 will be ch$

MAC_ADDR=43:29:B1:55:01:01

#

#PORT=ttyS1
PORT=ttyS3

 

Boot:

[  OK  ] Started LSB: Load kernel modules needed to enable cpufreq scaling.
[  OK  ] Started Raise network interfaces.
[  OK  ] Started LSB: Starts LIRC daemon..
[  OK  ] Started Login Service.
         Stopping LSB: Starts LIRC daemon....
         Starting LSB: set CPUFreq kernel parameters...
         Starting Set console scheme...
[  OK  ] Started Set console scheme.
[  OK  ] Started LSB: set CPUFreq kernel parameters.

 

And now ttyS3 at least has an IRQ assigned:

root@orangepizeroplus2:~# setserial -g /dev/ttyS*
/dev/ttyS0, UART: undefined, Port: 0x0000, IRQ: 27
/dev/ttyS1, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS2, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS3, UART: undefined, Port: 0x0000, IRQ: 28
 

But if I run:

root@orangepizeroplus2:/etc/init.d# ./ap6212-bluetooth start
[....] Starting ap6212-bluetooth (via systemctl): ap6212-bluetooth.service[  902.857904] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code (0x30 0x30)

Job for ap6212-bluetooth.service failed because the control process exited with error code. See "systemctl status ap6212-bluetooth.service" and "journalctl -xe" for details.
 failed!
 

and:

 

root@orangepizeroplus2:/etc/init.d# systemctl status ap6212-bluetooth.service
● ap6212-bluetooth.service - LSB: Patch firmware for ap6212 adapter
   Loaded: loaded (/etc/init.d/ap6212-bluetooth; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2017-07-30 17:40:38 UTC; 1min 28s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1467 ExecStart=/etc/init.d/ap6212-bluetooth start (code=exited, status=1/FAILURE)

Jul 30 17:40:17 orangepizeroplus2 systemd[1]: Starting LSB: Patch firmware for ap6212 adapter...
Jul 30 17:40:28 orangepizeroplus2 ap6212-bluetooth[1467]: Initialization timed out.
Jul 30 17:40:28 orangepizeroplus2 ap6212-bluetooth[1467]: bcm43xx_init
Jul 30 17:40:38 orangepizeroplus2 ap6212-bluetooth[1467]: Initialization timed out.
Jul 30 17:40:38 orangepizeroplus2 ap6212-bluetooth[1467]: bcm43xx_init
Jul 30 17:40:38 orangepizeroplus2 ap6212-bluetooth[1467]: Can't get device info: No such device
Jul 30 17:40:38 orangepizeroplus2 systemd[1]: ap6212-bluetooth.service: Control process exited, code=exited status=1
Jul 30 17:40:38 orangepizeroplus2 systemd[1]: Failed to start LSB: Patch firmware for ap6212 adapter.
Jul 30 17:40:38 orangepizeroplus2 systemd[1]: ap6212-bluetooth.service: Unit entered failed state.
Jul 30 17:40:38 orangepizeroplus2 systemd[1]: ap6212-bluetooth.service: Failed with result 'exit-code'.

 

and:

 

root@orangepizeroplus2:/etc/init.d# journalctl -xe
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-rfkill.service has finished starting up.
-- 
-- The start-up result is done.
Jul 30 17:40:18 orangepizeroplus2 wpa_supplicant[730]: p2p-dev-wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Jul 30 17:40:18 orangepizeroplus2 kernel: brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code (0x30 0x30)
Jul 30 17:40:18 orangepizeroplus2 NetworkManager[591]: <info>  [1501436418.4796] device (wlan0): supplicant interface state: disabled -> scannin
Jul 30 17:40:18 orangepizeroplus2 wpa_supplicant[730]: wlan0: Trying to associate with SSID 'mondevices'
Jul 30 17:40:19 orangepizeroplus2 NetworkManager[591]: <info>  [1501436419.0117] device (wlan0): supplicant interface state: scanning -> associa
Jul 30 17:40:19 orangepizeroplus2 wpa_supplicant[730]: wlan0: Associated with 14:cc:20:93:36:c8
Jul 30 17:40:19 orangepizeroplus2 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Jul 30 17:40:19 orangepizeroplus2 NetworkManager[591]: <info>  [1501436419.5373] device (wlan0): supplicant interface state: associating -> 4-wa
Jul 30 17:40:19 orangepizeroplus2 wpa_supplicant[730]: wlan0: WPA: Key negotiation completed with 14:cc:20:93:36:c8 [PTK=CCMP GTK=CCMP]
Jul 30 17:40:19 orangepizeroplus2 wpa_supplicant[730]: wlan0: CTRL-EVENT-CONNECTED - Connection to 14:cc:20:93:36:c8 completed [id=0 id_str=]
Jul 30 17:40:19 orangepizeroplus2 NetworkManager[591]: <info>  [1501436419.5467] device (wlan0): supplicant interface state: 4-way handshake -> 
Jul 30 17:40:21 orangepizeroplus2 ntpd[762]: Deleting interface #5 wlan0, fe80::8623:d245:4363:1493%2#123, interface stats: received=0, sent=0, 
Jul 30 17:40:28 orangepizeroplus2 ap6212-bluetooth[1467]: Initialization timed out.
Jul 30 17:40:28 orangepizeroplus2 ap6212-bluetooth[1467]: bcm43xx_init
Jul 30 17:40:38 orangepizeroplus2 ap6212-bluetooth[1467]: Initialization timed out.
Jul 30 17:40:38 orangepizeroplus2 ap6212-bluetooth[1467]: bcm43xx_init
Jul 30 17:40:38 orangepizeroplus2 ap6212-bluetooth[1467]: Can't get device info: No such device
Jul 30 17:40:38 orangepizeroplus2 systemd[1]: ap6212-bluetooth.service: Control process exited, code=exited status=1
Jul 30 17:40:38 orangepizeroplus2 systemd[1]: Failed to start LSB: Patch firmware for ap6212 adapter.
-- Subject: Unit ap6212-bluetooth.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit ap6212-bluetooth.service has failed.
-- 
-- The result is failed.
Jul 30 17:40:38 orangepizeroplus2 systemd[1]: ap6212-bluetooth.service: Unit entered failed state.
Jul 30 17:40:38 orangepizeroplus2 systemd[1]: ap6212-bluetooth.service: Failed with result 'exit-code'.
Jul 30 17:42:43 orangepizeroplus2 ntpd[762]: xxx.xx.xx.x local addr 192.168.0.105 -> <null>
Jul 30 17:42:43 orangepizeroplus2 ntpd[762]: xxx.xx.xx.x  local addr 192.168.0.105 -> <null>
Jul 30 17:42:43 orangepizeroplus2 ntpd[762]: xxx.xx.xx.x  local addr 192.168.0.105 -> <null>
Jul 30 17:42:43 orangepizeroplus2 ntpd[762]: xxx.xx.xx.x  local addr 192.168.0.105 -> <null>

 

So it looks like this is failing due to the ttyS3 issue. If I run:

root@orangepizeroplus2:/etc/init.d# hciattach /dev/ttyS3 bcm43xx 115200 flow bdaddr 11:22:33:44:55:66 
bcm43xx_init
Initialization timed out.

 

Lastly I tried changing ttyS1 to ttyS3 in /etc/init.d/ap6212-bluetooth:

    # Select tty port
    if [ -z "$PORT" ]; then
       #log_warning_msg "No PORT set in /etc/default/ap6212, will use ttyS1"
       #PORT="ttyS1"
       log_warning_msg "No PORT set in /etc/default/ap6212, will use ttyS3"
       PORT="ttyS3"

 

I looked at the /boot/dtb-4.11.10-sun50iw2/allwinner/overlay/sun50i-h5-fixup.scr file.

Where do the phandle HEX numbers come from?

 

I see that in /boot/dtb/allwinner/sun50i-h5-orangepi-zeroplus.dtb uart1 rts and cts are specified:

 

uart1_rts_cts {
                pins = "PG8", "PG9";
                function = "uart1";
                linux,phandle = <0x33>;
                phandle = <0x33>;

 

So, are these phandle assignments overridden by /boot/dtb-4.11.10-sun50iw2/allwinner/overlay/sun50i-h5-fixup.scr overlay file?

 

if test "${param_uart1_rtscts}" = "1"; then
    fdt get value tmp_phandle1 /soc/pinctrl@01c20800/uart1 phandle
    fdt get value tmp_phandle2 /soc/pinctrl@01c20800/uart1_rts_cts phandle
    fdt set /soc/serial@01c28400 pinctrl-names "default" "default"
    fdt set /soc/serial@01c28400 pinctrl-0 "<${tmp_phandle1}>"
    fdt set /soc/serial@01c28400 pinctrl-1 "<${tmp_phandle2}>"
    env delete tmp_phandle1 tmp_phandle2

 

Thanks for any advice you can supply to get the BT running..... 

Link to comment
Share on other sites

Oh and just for completeness, the first failure on boot is as follows:

 

root@orangepizeroplus2:/boot/dtb/allwinner# systemctl status systemd-modules-load.service
Warning: systemd-modules-load.service changed on disk. Run 'systemctl daemon-reload' to reload units.
● systemd-modules-load.service - Load Kernel Modules
   Loaded: loaded (/lib/systemd/system/systemd-modules-load.service; static; vendor preset: enabled)
  Drop-In: /etc/systemd/system/systemd-modules-load.service.d
           └─10-timeout.conf
   Active: failed (Result: exit-code) since Sun 2017-07-30 18:07:45 UTC; 34min ago
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 302 ExecStart=/lib/systemd/systemd-modules-load (code=exited, status=1/FAILURE)
 Main PID: 302 (code=exited, status=1/FAILURE)

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

Link to comment
Share on other sites

5 minutes ago, Simon said:

Where do the phandle HEX numbers come from?

The device tree compiler

 

5 minutes ago, Simon said:

So, are these phandle assignments overridden by /boot/dtb-4.11.10-sun50iw2/allwinner/overlay/sun50i-h5-fixup.scr overlay file?

No, it reads phandle values for pin group and sets pinctrl-0 and pinctrl-1 properties for the UART section.

Link to comment
Share on other sites

This BT chip needs handling of the reset pin, and ideally it also needs the slow clock output to be turned on. Since this type of BT device is not supported by the kernel, on some platforms it was solved (partially) with ugly userspace hacks, and AFAIK it is currently not implemented for ap6212.

Link to comment
Share on other sites

Thanks Zaror. The obvious question: Do you know of any plans to implement BT on the AP6212A in the near future? I'll carry on trying to work it out. It seems that some have BT running on the Nano Pi with AP6212/A chip?

Link to comment
Share on other sites

 Hi Simon,

 

I have some similar needs as yours (Ethernet + BT + Wifi + RTC). I've a product working nice with OPi Zero (H3) + CSR4 USB Bluetooth dongle + I2C RTC clock.

So maybe the temporary solution for your product would be to use some USB dongle or Serial dongle plugged to the uart pins (I'm currently doing some tests with a CC2541 bluetooth module - 1.75€ only).

 

I'd like to use OPi Zero Plus (H5) for my next batch (50 boards), but from the tests I'm doing since several days, I feel that the H5 boards are not ready for production yet: They are very promising with fast wifi & ethernet, but kernels are not ready : the OrangePi kernel is working, but is not efficient (1.0 load average with board idle, due to many crappy processes), and armbian still on testing (was unable to get wifi working for now).

 

Sand

Link to comment
Share on other sites

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

Important Information

Terms of Use - Privacy Policy - Guidelines