Day29 - UART and TTY Subsystem¶
🎯 Objective¶
- Understand how UART is exposed as TTY in Linux
- Learn how to configure serial port using termios / stty
- Create a clean UART device (
ttyAMA2) - Perform loopback test
- Understand TTY behavior differences
🧠 Key Concepts¶
UART vs TTY¶
- UART = hardware interface (TX/RX)
- TTY = Linux abstraction layer
🧪 Lab 1 - Enable Additional UART¶
Edit config:
Add:
Reboot:
Verify:
Expected:
/dev/ttyAMA10→ console/dev/ttyAMA2→ new UART
🧪 Lab 2 - Verify Pinmux¶
Expected:
- GPIO4 = TXD2
- GPIO5 = RXD2
🧪 Lab 3 - Loopback Wiring¶
Connect:
- Pin 7 (GPIO4 / TXD2)
- Pin 29 (GPIO5 / RXD2)
🧪 Lab 4 - Configure TTY¶
🧪 Lab 5 - Shell Loopback Test¶
Terminal A:
Terminal B:
🧪 Lab 6 - Python Loopback Test¶
Expected:
⚠️ Observations¶
catis not reliable for UART debuggingprintf + catmay fail due to timing issues- program-based testing is more stable
🧠 Conclusion¶
- UART is accessed via
/dev/ttyXXX - termios controls TTY behavior
- clean UART must not be used by console
- loopback verifies full system path