Let’s assume you somehow came into possession of a Raspberry Pi (rpi) 4 and want to configure it for something useful.
After writing the raspbian image you discover though that you have no suitable cables nor converters for the micro HDMI port.
If you do have a USB to serial TTL converter though, you can just configure rpi over the serial port.
In order to do that we first have to enable the first serial port on the rpi. To do that you have to mount the micro SD card with the raspbian image on your computer and add these lines to enable the serial console to config.txt:
sudo mkdir /mnt/tmp sudo mount /dev/sdz1 /mnt/tmp sudo echo "enable_uart=1" >> /mnt/tmp/config.txt sudo umount /mnt/tmp
… where you have to replace sdz with actual device name of your SD card (you can find it from the output of dmesg for example).
Now connect the USB to serial cable like this:
- ground -> pin 6 (GND)
- rx -> pin 8 (TXD1)
- tx -> pin 10 (RXD1)
- +5V will remain unconnected
You should be able to access the terminal using something like this:
picocom -b 115200 /dev/ttyUSB5
Where you have to replace ttyUSB5 with whatever device for the USB to serial converter on your system (which you can again find out from the output of dmesg).