Hi everyone, I’m working on a MIDI Thru project using an Orange Pi Zero 2W (Allwinner H618) running kernel 6.15.4-edge-sunxi64. My goal is to use the OTG port as a USB MIDI Gadget to forward data from a physical MIDI IN (via UART5/PH3).
Current Setup:
DTB: Modified dr_mode = "peripheral" for usb@5100000 PHY: Set phy0_type = <0x01> in phy@5100400
UART: Disabled pwm1@0300a000 to free up PH3 for serial@5001400
Despite setting dr_mode = "peripheral", I cannot manually trigger the role switch. Running echo peripheral > /sys/class/usb_role/usb0-role-switch/role returns Permission denied, even as root.
Writing to extcon state via /sys/devices/platform/soc/5100400.phy/extcon/extcon0/cable.0/state also returns Permission denied.
After setting up ConfigFS (libcomposite) and binding to musb-hdrc.4.auto, the /sys/class/udc/musb-hdrc.4.auto/current_speed remains UNKNOWN.
This is controlled by the kernel, you need to set this in the dtb, not manually.
Same for the extcon problem, you can not set it manually, it’s read only.
Probably you have a problem with the dtb, or with your cable. If it’s detect an USB device it will switch the roles on it’s own.
How do you connect it to the PC? (Sometimes USB-C to USB-C does not work for device mode).
Do you use the correct port (USB0) on the Zero 2w?
Is the configFS mounted correctly? Maybe you can share what you did.
I also decompiled the dtb, you said you modified dr_mode but in Totof’s overlay it’s already set to “peripheral”.
I also asked AI a bit about the dtb settings, you probably do not need phy0_type, it’s already set in 5100000:
phys = <0x2e 0x00>;
Dunno if it can make problems when you set it.
When you connect it to the PC, do you see something in dmesg?
You can check it by using dmesg --follow and then connect the device to the PC.
I use every day for listenning music on my first audio system a minidsp connected via USB on the expension board, so it’s the normal usb connector not the C type on the main board, in the datasheet we found this
After some research about OTG on orangepi zero 2w
in your dtb file for the usb@5100000 you would have change 'dr_mode = "peripheral"' to 'dr_mode = "otg"'