NERDBUDE

[ code. keyboards. terminals. cyber. ]

[HOWTO] [WHOAMI] [PODCAST] [GERMAN]

Talk to serials (usb -- ttl)

There are several reasons why you might want to talk to serial ports.

A serial console allows for example to configure the RaspberryPi without having to connect it to a display or network or you have old hardware like routers and the like lying around at home and want to know what's going on inside. With a little bit of luck there is a hidden serial port which is not really meant to be used as a "normal user".

One thing first, opening and modifying devices will almost certainly void your warranty if there is still one on the device. The other makes that only with devices that belong to you. Who unscrews things that do not belong to him and is asked to pay should not claim I said nothing.

So what do we need to get started?

First of all a USB <-> TTL adapter



The adapter (see picture) is available from 3,00€ - 30,00€ in the net. It has in this case a USB 2.0 type A connector that goes into the computer and 6 pins that are wired to our serial port. For wiring we recommend to use jumper cables, which can easily be plugged to the pins of the adapter and to possible existing pins on the interface. If there are no pins on the interface but only solder pads you can simply shorten the jumper cables and solder them on. Jumper cables are available in different colors and you should also use them to not lose the overview.

jumper_cable

What it still needs is of course a device with a serial port. Most routers have one, but so do other devices running some OS (mostly Linux). How to recognize the interface? Suspicious are for example solder points which are not used. In some cases the interfaces have pins like our adapter. This makes it much easier because you only have to plug in the jumper cables instead of soldering them.

serielle

Since I don't have a device here that I want to disassemble or a device with an interface, we can try it out on a Raspberry Pi. Most people should have one lying around at home to experiment with. We use the standard OS Raspian. However, this should also work with any other supported OS. We write the OS as usual on the Raspberry Pi to the SD card and insert it.

raspberry_pi

Now we have to connect the pins of our adapter with the GPIO pins of the Raspberry. For this we need the following 3 pins on the adapter and on the Pi:



The GPIO pinout of the Raspberry Pi can be found on the net. Pay attention to the model, because the pinout differs for different models.

pi_ttl

Now the adapter only has to be connected to the computer. In principle, it does not matter which computer this is. Every OS can basically talk to the Raspberry Pi via the serial interface. With Windows it needs the tool PuTTy and with Linux and macOS we take the terminal tool "screen" (is preinstalled with Linux and macOS).

Used it as follows:

Linux / macOS

shell
screen -h


But before you can work with "screen", we need the hardware address of the adapter.

macOS / Linux:

shell
ls -l /dev/tty.*


shell
crw-rw-rw- 1 root wheel 33, 2 3 Feb 06:59 /dev/tty.Bluetooth-Modem
crw-rw-rw- 1 root wheel 33, 0 3 Feb 06:59 /dev/tty.Bluetooth-PDA-Sync
crw-rw-rw- 1 root wheel 33, 8 3 Feb 11:28 /dev/tty.PL2303-00001004


Let's assume that a PL2303 chipset from Prolific is installed, so the latter is the address we are looking for. Now we can address the serial interface via the adapter with the following command:

shell
screen /dev/tty.PL2303-00001004 115200


115200 defines the baud rate here - that is, the transmission speed.

Now connect power to the Raspberry Pi and you should be able to see the boot sequence of the Raspberry Pi in the terminal or log in to it.

This is of course only the basis for many gimmicks that are possible with the serial interface. The limit is only the imagination and the presence of the interface.

Have fun trying it out.





//EOF