Skip to content

SW_DevRPiTTY

Rolf Obrecht edited this page Aug 10, 2024 · 29 revisions

Device Module "RPiTTY"

Description

This module is used to control TW39/V10 machines connected via the corresponding TW39 or V.10 hardware to the GPIO-interface of a Raspberry Pi running Raspberry Pi OS. It is not suitable for standard computers running Windows, MAC OS or Linux.

The RPi's built in UART cannot cope with 50 baud transmission speed. But, the correct timing can be formed jitter-free with the library “PiGPIO”. Receiving can be handled by asynchronous callbacks implemented in this library. This enables a Linux based computer like the RPi to handle precise and reliable timings.

In TW39 mode, the module can operate together with a CCU (Fernschaltgerät, FSG); in this case, pin_relay drives a relay which alters polarity depending on the connection state (see HW_ILoop).

The module can also be used to connect a teletype with 40mA current loop directly (CAUTION: DO NOT APPLY FULL LINE VOLTAGE TO THE TELETYPE! 24 Volts will be sufficient to feed the coil via regulated current loop, see HW_ILoop. A polarity relay is not applicable in this case; but when operating the machine e.g. as i-Telex-client, pin_relay may be used to drive a relay to switch on mains supply for the teletype on incoming connections and outgoing connections dialled via number switch. This operation mode requires some additional features from RPiCtrl-module, especially pin_number_switch, pin_button_at, pin_button_st and pin_button_lt (see there).

Last but not least, in V.10 mode the module is able to control a directly connected teletype with V.10 interface (mostly TeKaDe FS200/FS220), no FAG200 is needed. For the corresponding interface hardware see HW_V10.

System

System Comments
RPi All boards with RaspBerry Pi OS
PC Linux n/a
PC Windows n/a
Mac n/a

Dependencies

Python
Module
Install Anaconda
pigpio pip install pigpio conda install pigpio

Command Line Arguments

-G
--RPiTTY

Config File Parameter

Parameter Default Type/Range Description
mode "TW39" string "TW39" for TTY‘s with current loop and number switch,
"TW39H" if using H-bridge hardware,
"TWM" for keyboard dialling,
"V10" for machines with V.10 interface (mainly TeKaDe FS200 / FS220),
"AGT" , "AGT-TWM", "AGT-TW39" for use with austrian AGT and SEU-M
baudrate 50 38 ... 50 … 200 Baud rate
bytesize 5 5 … 8 # of databits
stopbits 1.5 1 / 1.5 / 2 # of stopbits
pin_txd 17 number GPIO# of TX-Data pin
inv_txd false false / true If true, use inverted signal on TX-Data pin, not possible with PIGPIO
pin_dir 0 number GPIO# of DIR pin. This pin is set to 1 on transmitting each byte for hardware loopback supression
pin_rxd 27 number GPIO# of RX-Data pin
inv_rxd false false / true If true, use inverted signal on RX-Data pin
pin_relay 22 number GPIO# of relay coil pin; in non-FSG mode used to switch the line power of the teletype; in FSG mode, relay is used to alter the polarity of the current loop when a connection is established; see corresponding hardware description
inv_relay false false / true If true, use inverted signal on pin
pin_power 0 number GPIO# of pin used to switch power relay / SSR
inv_power false false / true If true, use inverted signal on pin
pin_number_switch 6 number GPIO# of pin connected to the number switch;
often wired to pin_rxd.
Set to -1 to enable pin_number_switch in module RPiCtrl
Set to 0 to select keyboard dialling
inv_number_switch false false / true If true, use inverted signal on pin
use_observe_line true false / true If true, monitor pin_observe_line for state changes of >0,5s
pin_observe_line [pin_rxd] number GPIO# of pin to observe
inv_observe_line [inv_rxd] false / true If true, use inverted signal on pin
nZZ_observe_line false false / true (For TeKaDE FS2X0): Observe LIN button in deep sleep mode, should be true if power relay is used`
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
timing_rxd false false / true ?
WB_pulse_length 40 number set length of WB pulse in milliseconds
double_WR false false / true if true, add an extra <CR> to give the old machines more time to move to the start of the line
txd_powersave false false/true If true, switch off the loop current in "ZZ" status. Should be used together with pin_power option of device RPiCtrl (Rel. 2024-08 ongoing)

Config file examples

       # standard, minimal example for a teletype with FSG
        "RPiTTY_typical": {
          "type": "RPiTTY",
          "enable": false,
          "mode": "TW39",
          "pin_txd": 17,
          "pin_rxd": 27,
          "pin_relay": 22,
          "pin_number_switch": 6,      # classic layput: 6   new layout: 10
          "baudrate": 50,
          "loopback": true
        },
    
        # standard example for a teletype without FSG. Dialing by keyboard
        # Note: Use user buttons in module 'RPiCtrl' for AT-button and ST-button
 (or 1T-button)
        "RPiTTY_noFSG": {
          "type": "RPiTTY",
          "enable": false,
          "mode": "TWM",
          "pin_txd": 17,
          "pin_rxd": 27,
          "pin_relay": 22,
          "inv_relay": false,
          "pin_online": 0,
          "pin_dir": 0,
          "pin_number_switch": 0,
          "baudrate": 50,
          "coding": 0,                 # 0=ITA2
          "use_observe_line": false,
          "loopback": true
        },
    
       # TeKaDe FS200 or FS220 over V.10 interface (new pinout)
        "RPiTTY_FS200_V10_new": {
          "type": "RPiTTY",
          "enable": true,
          "mode": "V10",
          "pin_txd": 27,               # Pin13
          "pin_rxd": 17,               # Pin11
          "pin_relay": 0,
          "inv_relay": true,
          "pin_power": 9,              # Pin21
          "inv_power": false,
          "use_observe_line": true,
          "pin_observe_line": 22,      # Pin15
          "inv_observe_line": true,
          "nZZ_observe_line": false,   # observe LIN-button in deep sleep mode. Should be 'true' if SSR is used
          "baudrate": 200,             # 50, 75, 100, 200
          "coding": 0,                 # 0=ITA2
          "loopback": false
        },

More configuration examples are provided in the telex.json example files (look in your piTelex installation directory).

Clone this wiki locally