44

I want to know the difference between ttyS0, ttyUSB0 and ttyAMA0 on Linux.

2

2 Answers 2

43

ttyS0

What you get on the host when you connect to target with this:

enter image description here

Source

This port is not present on most laptops or small devboards, but is still present on many desktops, and is very convenient for OS developers as mentioned at: https://askubuntu.com/questions/104771/where-are-kernel-panic-logs/932380#932380

You also get it with qemu -device isa-serial.

For example could hook up two desktops with one of those cables, and communicate directly between them to get a shell on the remote desktop from your own. From Linux computer 1 you would run:

screen /dev/ttyS0 115200

and then computer 2 would reply with the login prompt, and then you can log in from computer 1 into computer 2.

So this is a bit like SSH and can be seen as an early form of networking. I think those cables cannot be too long or else the signal is lost though, and you can't do as much without the TCP/IP addressing/packet mechanisms.

ttyUSB0

What you get on host when using something like:

I also get it when I connect the GPIOs of my Raspberry Pi to my laptop to get a shell on a Raspberry Pi without a screen!

enter image description here

And another more integrated RPI connector version of the above:

Source

A concrete RPI example at: https://stackoverflow.com/questions/22054578/how-to-run-a-program-without-an-operating-system/32483545#32483545

ttyACM0

This is the TTY interface that what you get when you connect your computer to either of:

via an USB cable. They've just implemented a TTY directly on the same USB that can power on and program the device, it is very convenient!

enter image description here

ttyAMA0

Haven't used this one on a real board yet.

It seems that I would be able to connect my desktop with a serial port to my RPI with that interface: https://raspberrypi.stackexchange.com/questions/69697/what-is-dev-ttyama0

I've used it with QEMU: https://github.com/buildroot/buildroot/tree/27d7ef126bc7f4eb1a757128466befa11245bbfd/board/qemu/arm-versatile

It seem that AMA is a shortened form of AMBA? https://www.raspberrypi.org/forums/viewtopic.php?t=8075 But why would they shorten a 4 character acronym?!

The only interesting Linux kernel hits are under: https://github.com/torvalds/linux/blob/v4.16/drivers/tty/serial/amba-pl011.c#L2488 so it seems to be strictly linked to the PL011: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0183g/index.html which is a UART controller licensed by ARM, which I think is the dominating implementation.

ttySAC0

Kamil reported that his Samsung Artik 710, so another one for the collection.

4
  • What about ttySAC0? I have this on ARM64 architecture Samsung Artik 710 device.
    – Kamil
    Commented Nov 6, 2018 at 0:36
  • @Kamil OK, a new one for me then :-) How do you connect to it from host to see ttySAC0? Which cable? Send a photo if you can. Commented Nov 6, 2018 at 8:36
  • I get a ttyACM0 when I plug in an Arduino into Linux.
    – Mike
    Commented May 19, 2020 at 21:19
  • 4
    Technically, ttyS0's original meaning seems to be "the first serial port implemented using a UART compatible with the original IBM PC UART, the 8250 chip. The ttyAMA0 on ARM and e.g. ttySAC0 would then mean "the first serial port implemented using another specific hardware implementation". ttyUSB0 refers to the first USB-to-serial converter. ttyACM0 refers to an emulated serial connection using USB's CDC ACM (Communication Device Class, Abstract Control Model), which indicates that no actual RS-232-style serial line may be present and HW parameters like baud rate may be ignored.
    – telcoM
    Commented Oct 20, 2020 at 7:42
20
  • ttyS0 is the device for the first UART serial port on x86 and x86_64 architectures. If you have a PC motherboard with serial ports you'd be using a ttySn to attach a modem or a serial console.
  • ttyUSB0 is the device for the first USB serial convertor. If you have an USB serial cable you'd be using a ttyUSBn to connect to the serial port of a router.
  • ttyAMA0 is the device for the first serial port on ARM architecture. If you have an ARM-based TV box with a serial console and running Android or OpenELEC, you'd be using a ttyAMAn to attach a console to it.
2
  • 3
    There's more at unix.stackexchange.com/a/127260/5132 .
    – JdeBP
    Commented Sep 2, 2016 at 17:37
  • are these 3 distinct serial port you can read from each one separately at the same time? and attach 3 different device 1 to each of these?
    – Lightsout
    Commented Apr 19, 2019 at 3:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .