RPi 4 as USB-C Gadget in AArch64

This is for ARMv8 based devices

RPi 4 as USB-C Gadget in AArch64

Postby greginohio » Wed Oct 28, 2020 6:11 am

I have been trying to follow the instructions at https://www.hardill.me.uk/wordpress/201 ... -c-gadget/ to set up my raspberry pi 4 as a usb-c gadget. These instructions are for a raspberry pi running Raspbian and I have set mine up with Arch Linux 64 (just installed this week with the latest version). I thought once I was able to load the kernel modules libcomposite and dwc2, that I would be able to see usb0 when I ran ip addr. When I run lsmod, I can see that libcomposite has loaded, and my understanding is that dwc2 is included in the kernel. But, I still don't see usb0 when I run ip addr, and am not able to set up anything further until usb0 is recognized as an interface.

I'm pretty new at this, so maybe I'm completely misunderstanding how this should work. Any advice you can provide would be greatly appreciated, even if it is just giving me some advice on what I need to go and learn more about.
greginohio
 
Posts: 1
Joined: Wed Oct 28, 2020 5:44 am

Re: RPi 4 as USB-C Gadget in AArch64

Postby bh1rio » Fri Dec 11, 2020 2:31 am

bh1rio
 
Posts: 1
Joined: Fri Dec 11, 2020 2:28 am

Re: RPi 4 as USB-C Gadget in AArch64

Postby summers » Sat Dec 12, 2020 12:53 pm

Occurs to me I should post, as I did this on my pocket beagle, its described here:https://archlinuxarm.org/forum/viewtopic.php?f=48&t=12623&p=57935

Your problem is probably that you haven't populated $this->bbcode_second_pass_code('', '/sys/kernel/config/usb_gadget/') - you need to create a whole file structure there ...

Oh yes, one thing to add, that isn't covered in either my thread, or the link you gave, is that the dhcp server can be made far simpler in systemd-networkd, as that contains its own dhcp server, and its integrated into the network set up (so doesn't have race problems, with every other method I tried did). Anyway for the network file for systemd "/etc/systemd/network/usb0.network" you can just use:

$this->bbcode_second_pass_code('', '[Match]
Name=usb0

[Network]
DNS=192.168.2.1
DHCPServer=true

[Address]
Address=192.168.7.18/30

[Route]
Gateway=192.168.7.17

[DHCPServer]
EmitDNS=false
EmitNTP=false
EmitSIP=false
EmitRouter=false')

Changing the address and netmask for what you need. Also you'll need to set the DNS server to a valid value - as your gadget device won't have a proper DNS server configured ...
summers
 
Posts: 995
Joined: Sat Sep 06, 2014 12:56 pm


Return to ARMv8 Devices

Who is online

Users browsing this forum: No registered users and 2 guests