Raspberry Pi: attach a serial console
For a Raspberry Pi with GPIO pins (B, B+, 2, 3):
- Connect as follows:
- Append this line at the end of /boot/config.txt:
enable_uart=1
- Access the console from your workstation like this:
sudo screen /dev/ttyUSB0 115200
Sources:
- https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable
- https://elinux.org/RPi_Serial_Connection
For Raspberry Pi without pins (Pi Zero, Pi Zero W):
- Add the following line at the end of /boot/config.txt:
dtoverlay=dwc2
- Insert the following between 'rootwait' and 'quiet' in /boot/cmdline.txt:
modules-load=dwc2,g_serial
- Mount the linux part of the Pi SD card and add the following lines at the end of /etc/rc.local, before 'exit 0':
usbconsole="getty@ttyGS0.service" if [ ! $(systemctl is-enabled "${usbconsole}") ] then echo "Enabling and starting ttyGS0 console..." systemctl enable "${usbconsole}" systemctl start "${usbconsole}" fi
- Connect a micro usb cable into the socket market 'USB' on the Pi,
not the one marked 'PWR'. - On your workstation, console can be accessed as: sudo screen /dev/ttyACM0 115200