Enabling Serial Gadget Mode on a Raspberry PI

  • Write a fresh Raspberry PI OS Lite to your micro-sd.
  • Boot the Pi with the fresh card to allow the OS to resize the partitions.
  • Remove the card from the Pi and mount the boot and root partions.
  • Add dtoverlay=dwc2 to the end of BOOT/config.txt
  • Add modules-load=dwc2,g_serial after _rootwait in BOOT/cmdline.txt
  • In a terminal, cd to ROOT/lib/systemd/system/getty.target.wants
  • Run sudo ln -s ../getty@.service ./getty@ttyGS0.service
  • umonunt the partiions and boot from the card.
  • In a terminal, run picocom /dev/ttyACM0

References

  • https://www.tal.org/tutorials/setup-raspberry-pi-headless-use-usb-serial-console
Written on May 18, 2023