Raspberry Pi Compute Module as a USB Gadget
In standalone mode, the SD-Dev plus a Raspberry Pi compute module forms a compact single-board computer hosting your compute modules. These two recipes turn the Raspberry Pi into a USB gadget, so a single USB-C cable to your workstation gives you a serial console or an SSH connection. Both recipes target Raspberry Pi OS Bookworm or later, and every configuration step in them runs on the Raspberry Pi itself, not on your workstation.
USB serial gadget
- Edit
/boot/firmware/config.txt: comment outotg_mode=1and adddtoverlay=dwc2,dr_mode=peripheralat the end. - Create
/etc/modules-load.d/otg.confcontaining:dwc2g_serial - Reboot.
- Connect the SD-Dev to your host with the
PWR+DUSB-C port. - Access the serial port from your host (for example
screenon Linux/macOS, PuTTY on Windows).
The Raspberry Pi creates a /dev/ttyGS0 serial port readable and writable from both sides.
To attach a full console:
- Symlink the
gettyservice:sudo ln -s /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttyGS0.service - Enable and start it:
sudo systemctl enable --now getty@ttyGS0.service
USB ethernet gadget
Alternatively, configure the Raspberry Pi as a USB Ethernet gadget for SSH over USB-C:
- Edit
/boot/firmware/config.txtas above (commentotg_mode=1; adddtoverlay=dwc2,dr_mode=peripheral). - Create
/etc/modules-load.d/otg.confcontaining:dwc2g_ether - Reboot, then connect via the
PWR+DUSB-C port. - Add and activate the connection:
sudo nmcli con add type ethernet con-name usb-otg ifname usb0sudo nmcli con up usb-otg
- Find the Raspberry Pi's address and SSH to it:
From your workstation, connect to that address:ip addr show dev usb0ssh pi@<address>
To make it persistent, create a systemd service that runs nmcli con up usb-otg at boot.
Next steps
- SD-Dev Carrier Board, the operating modes, ports, and power options of the board itself.
- Identify your module, finding the device path of a module from the compute module you just reached.
- Getting Started, running a first UxHw application from that host.