As said, the TTY2PI PCB is not just an 20mA to RS232 converter. We have more signal sources:
- the ASR-33 20mA ("TTY")
- the RS232 DSUB-9 male ("DSUB")
- the RPis internal hardware serial port ("RPi")
- and further more RPi WLAN and USB ports, all capable of routing RS232 traffic outside
RS232 DSUB-9
Not much to say: its a 9-pin male connector, conforming to PC-standard.
Pinout: 2 = RxD, 3 = TxD, 5 = GND.
Additionally, DTR on Pin 4 is wired to the READER ENABLE.
RPi serial hardware "ttyAMA0"
RPis TxD and RxD Pins have 3.3.Volt levels, we use a MAX232 converter chip to interface to +/-9V RS232 voltage levels.
READER ENABLE is driven via RPi GPIO6 (header pin 31).
(click to enlarge)
And there's a challenge with the on-board UART: I had to learn the hard way that RPi Zero under Raspian has in fact *two* serial hardware ports, and different names for these ... here my research results:
/dev/ttyS0
is connected to the RxD and TxD header pins by default. However, its a "limited" hardware UART called "mini UART", not capable of running at 110 Baud, as the ASR-33 needs.- the "good" UART is
/dev/ttyAMA0
. It is 16550 compatible, but connected to the onboard Bluetooth module by default. - the one of these UARTs which is used for serial communication is linked to the fix name
/dev/serial0
To use the good "AMA0" UART on TxD and RxD pins, edit file "/boot/config.txt
" :
$ sudo nano /boot/config.txt[all]
enable_uart=1
# Switch serial ports
dtoverlay=miniuart-bt
core_freq=250
Then do all interfacing to the ASR only via device "/dev/ttyAMA0
".
Three-way hardware signal flow
There are 3 possible serial signal routings, settable by a DIP switch bank.
Manual selection is necessary, because you cannot just wire all RxDs and TxDs together ... short cuts everywhere.
1. ASR --- DSUB
ASR-33 is connected to DSUB-9, tty2pi is a typical 20mA - RS232 converter then.
You can plugin a Nullmodem-cable to the DSUB-9 to any other device.
Cave-at: when using a USB-RS232 adapter, it likely it will not support 110 bauds.
Rumor has: beware of FTDIs, test with Prolific chipsets.
2. ASR --- RPi
ASR is connected to the RPi. You can do any signal processing or forwarding there ... see next page.
3. DSUB --- RPi
ASR-33 is not in use, RPi just gets a full RS232 port. Useful if you want to switch your "TTY" setup from an 20mA device to a RS232 device, perhaps for replacing the ASR-33 with a DECwriter or VT100.
4. Routing READER ENABLE
No routing needed here. READER ENABLE is just a diode-wired-OR between RPi GPIO 6 and DSUB-9 DTR (pin 4): activate one of both, and READER is running on START.