[SOLVED] OTG usb not working as host and/or UART_AO_B not working on armbian

Oke Here’s my pickle

i want to use a radxa zero 1.51 with a flightcontroller which is connected with an uart and got this to work with a connection from pin 27 and 28 (UART_AO_B_RX, UART_AO_B_TX),
running with radxa-zero-ubuntu-focal-server-arm64-20220801-0346-mbr.img.xz (any image after that doesnt want to boot, i think i pretty much tried them all, that came after 0801)
and adding overlays=meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3 to the uEnv.txt
i power the zero with gpio pins 2 and 6 (5v,gnd) so i have a free OTG usb port

for my drone project, i have very limited space and want to limit weight as much as possible
i need 2 devices connected with usb (4g dongle and usb cam). Both work fine with a usb hub connected to the Host usb port.
i want to remove the usb hub ( due limited space and weight), and use the usb otg port

but it doesnt work with radxa-zero-ubuntu-focal-server-arm64-20220801-0346-mbr.img.xz image
i also tried Armbian_22.11.1_Radxa-zero_jammy_edge_6.0.10.img.xz, on which the usb otg port WORKS FINE as a host usb
but the problem with Armbian is the lacking uart support, i cant get the uart connection to work with armbian

to fix the usb problem i already tried to install the latest kernel by using https://wiki.radxa.com/Zero/dev/kernel instructions, but without success

  1. how can i get the otg usb port to work as a host usb on a radxa-zero-ubuntu (or debian) build?
  2. or how do i get &uart_AO_B to work with an armbian build?
  3. can we plz have some working latest radxa zero images

i did some comparing of kernel board specific source code

for the usb problem i compared meson-g12a-radxa-zero.dts
both are the same at the lines:
&usb {
status = “okay”;
};

for the uart problem:
could i just create a new overlay to add on armbian with the source code from meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3.dts ?

i also read there is 5.19 kernel from radxa, but i cant find it on github, can anyone point me where it is?

you can build newer kernel (currently v6.1.1) with bsp.

hi,
thank you very much for your reply
with bsp i ran into A problem running $ ./bsp linux latest radxa-zero :

make: Entering directory ‘/home/flip/bsp/.src/linux’
HOSTCC scripts/basic/fixdep
/bin/sh: 1: scripts/basic/fixdep: Exec format error

But i also found rbuild
with this i could build a new debian image
and it booted :smiley:
and the otg port on my zero works as a host :smiley::smiley:

but the way overlays work seams to be different.
i found my needed overlay in /boot/dtbo/meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3.dtbo.disabled
but how do i enable it? is there any documentation on this? i already tried removing .disabled to enable it, but is doesnt seam to work that simple. could use another push in the right direction

please install qemu-user-static and binfmt-support packages, then, please try again.

rbuild is new, still in development tool. there are some issues.

on rbuild image, dtbo should be managed by rsetup command (Overlays -> Manage overlays) but currently it’s not working on zero. you can do same thing by u-boot-update command after .disabled part is removed from dtbo file. then, you should be able to see fdtoverlays line in /boot/extlinux/extlinux.conf. u-boot will load dtbo file(s) in fdtoverlays line.

but sorry, currently something is not working correctly. I tried it myself, then I got following error in u-boot:

Retrieving file: /boot/dtbo/meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3.dtbo
failed on fdt_overlay_apply(): FDT_ERR_NOTFOUND

I’m investigating this issue.

overlay on stable (5.10) kernel is not working yet… then, I checked latest (6.1) kernel, overlay is working on it. could you try to build latest kernel with bsp?

if you want rbuild image with latest kernel, you can build it as follows.

  1. update bsp/rbuild source
  2. build linux latest kernel
./bsp linux latest
  1. build rbuild image with latest kernel
./rbuild -k path/to/bsp/linux-image-foo-bar_arm64.deb radxa-zero
  1. install & boot rbuild image
  2. enable overlay
sudo mv /boot/dtbo/meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3.dtbo.disabled /boot/dtbo/meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3.dtbo
sudo u-boot-update
  1. reboot

then you should be able to see ttyAML1(UART_AO_B)

sudo dmesg | grep ttyAML
  :
[    0.216874] ff804000.serial: ttyAML1 at MMIO 0xff804000 (irq = 15, base_baud = 1500000) is a meson_uart
  :

thank you very much again for your reply<3

i need more time to investigate
i tryed with a backed up kernel, and it kinda worked with the uart…some static, hard to explain yet
i like to see the bug fixed with bsp

flip@debian-amd64:~/bsp$ ./bsp -C linux latest radxa-zero

~~

Applied patch drivers/gpu/drm/panel/panel-simple-dsi.c cleanly.
Applying: Bluetooth: Add new quirk for broken local ext features max_page
Checking patch include/net/bluetooth/hci.h…
error: while searching for:
* during the hdev->setup vendor callback.
*/
HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN,
};

/* HCI device flags */

error: patch failed: include/net/bluetooth/hci.h:274
Checking patch net/bluetooth/hci_event.c…
Hunk #1 succeeded at 881 (offset 44 lines).
Applying patch include/net/bluetooth/hci.h with 1 reject…
Rejected hunk #1.
Applied patch net/bluetooth/hci_event.c cleanly.
Patch failed at 0005 Bluetooth: Add new quirk for broken local ext features max_page
hint: Use ‘git am --show-current-patch=diff’ to see the failed patch
When you have resolved this problem, run “git am --continue”.
If you prefer to skip this patch, run “git am --skip” instead.
To restore the original branch and stop patching, run “git am --abort”.
bsp
flip@debian-amd64:~/bsp$

oh? strange error… can you try again with fresh bsp source?

I tried commit 5569cd5dc0ab0e06a6074d3ecfd544be448ff501

git fetch origin 5569cd5dc0ab0e06a6074d3ecfd544be448ff501
git checkout FETCH_HEAD

./bsp -C linux latest radxa-zero
its compiling now

oke, everything works now

  1. i got a working debian image with latest kernel
  2. otg poort works as host
  3. and i can use the uart properly

first i had some problems with the output of the flightcontroller, but that was due to a buggy firmware i used. with official ardupilot firmware, there was no noise to see.

i thank you very much for the solution