-
Notifications
You must be signed in to change notification settings - Fork 11
SW_DevCH340TTY
System | Comments |
---|---|
RPi | OK |
PC Linux | OK |
PC Windows | OK |
Mac | OK |
Python Module |
Install | Anaconda |
---|---|---|
pyserial | pip install pyserial | conda install pyserial |
USB-Serial-Adapter (CH340-chip) with base teletype (without dialing device):
-Y TTY
--tty TTY
USB-Serial-Adapter (CH340-chip) with TW39 teletype (pulse dial):
--ttyTW39 TTY
USB-Serial-Adapter (CH340-chip) with TWM teletype (keypad dial):
-M TTY
--ttyTWM TTY
USB-Serial-Adapter (CH340-chip) with V.10 teletype (FS200, FS220):
-V TTY
--ttyV10 TTY
telex.py -W COM3
telex.py -W /dev/ttyUSB0
Param | Default | type/range | Description |
---|---|---|---|
mode | "TW39" | "TW39", "TWM", "V10", "EDS" | "TW39": current loop / Number Switch Dial "TWM" : keypad Dial, "V10" : FS200/FS220 mode "EDS" : |
portname | "/dev/ttyUSB0" | string | serial port used (COMx: in Windows) |
baudrate | 50 | 50, 75, 100 | Baud rate |
bytesize | 5 | 5 … 8 | # of Databits |
stopbits | 1.5 | 1, 1.5, 2 | # of stopbits |
coding | 0 | 0,1,2,3 | 0:ITA2=CCITT2, 1:US, 2:MKT2, 3:ZUSE (see txCode.md) |
loopback | true | false / true | if true, sent characters are removed from receive buffer |
loc_echo | false | false / true | if true, echo back all characters received from teleprinter |
inverse_dtr | false | false / true | If true, use inverted signal |
inverse_rts | false | false / true | If true, use inverted signal |
Using an adapter board (or adapter cable - for V.10) based on the chip CH340 the device is detected as normal (virtual) serial interface. In Windows the device is shown as 'COMx:'. In Linux it is shown as '/dev/ttyUSBx'.
With the Python library "PySerial" all necessary settings can be done to handle 50 baud, 5 data-bits and 1.5 stop-bits. Also, the handshake pins RTS and DTR can be set by this library.
# Module type "CH340TTY"
# requirements: pyserial (Linux: sudo apt install python3-serial)
# TW39 or V10 teletype over USB-serial-adapter with CH340 chip or UART which supports 50 Baud
"CH340TTY": {
"type": "CH340TTY",
"enable": false,
"portname": "COM5", # Windows:"COMx" Linux:"/dev/ttyUSBx"
"baudrate": 50, # 50, 75, 100, 110, 200
"mode": "EDS", # modes: "TW39", "TWM", "V10", "EDS"
"coding": 0, # 0=ITA2
"loopback": false
},
# TeKaDe FS200 or FS220 over V.10 interface (new pinout) with UART for Banana Pi, Orange Pi, ... (Allwinner H2, H3, H5, not H53x)
# Pins on 40p/26p connector for onboard UART 2: RXT:11, TXD:13, CTS:15, RTS:22
"CH340TTY": {
"type": "CH340TTY",
"enable": false,
"portname": "/dev/ttyS2", # onboard UART 2
"baudrate": 200, # 50, 75, 100, 200
"mode": "V10",
"coding": 0, # 0=ITA2
"loopback": false
},
To decode the TW39 protocol correctly, it is necessary to detect a permanent low and high level on the RXD pin. Neither the CH340 chip nor the drivers drivers can handle that. The hack is to use a separate input pin (CTS) to detect the state of the line.
Therefore the pin RXD has to be connected to pin CTS of the CH340 chip.
Most PCBs with the CH340 chip do not route the CTS pin to a connector. Use a thin wire to connect the pins 3 and 9 directly on the chip.
Note: There are several USB/Serial adapters that use different chips. Be aware that ONLY adapters with CH340 chip are compatible with this project. Only the CH340 chip supports a baud rate of 50 Bd!
Consider using release packages for software installation: https://github.com/fablab-wue/piTelex/releases
-
Local use
-
i-Telex
-
Advanced Topics
-
Tools & Gadgets
-
TW39 (current loop)
-
ED1000 (FSK modulation)
-
V.10 (TeKaDe FS200, FS220)
-
SEU-M-board based
- with Austrian AGT (Ö-AGT, current loop)
- as replacement for SEU-B card inside LO2000, LO2001, LO3000