TIP: Click on subject to list as thread! ANSI
echo: cbm
to: Jimmy Mac
from: CBMGuy
date: 2017-03-30 08:33:44
subject: Re: Using tcpser on a Pi for telnet gateway to C64?

On Thursday, March 23, 2017 at 7:00:43 PM UTC-6, Jimmy Mac wrote:
> Hi all, 
> 
> I've struggled to find much in the way of solid documentation on how
to get tcpser to autostart on the Raspberry Pi. Anyone have a quick easy
solution? 


Hey there.  I just did this for an old Atari STe I fixed and wanted to BBS.
 I have an old Raspberry Pi Model B and a MAX232 serial 9pin for the PI
(it's about $1.50 for the MAX232 from ebay--I have a number of these
already which is why I used them for 
the project).  I hooked the Pi up to the Pi's GPIO port.  The only issue
with this setup is that the Pi monitors that port for remote logins and yo
need to disable that function.  You can use raspi-config to change those
settings.  If you are using a USB 
to serial adaptor, you can skip this and hop down to the automated service
in LINUX section below.

To turn the GPIO header for serial: 

Type at the bash: sudo raspi-config

Selected option 5 from the menu, then selected Serial from that menu.
Choose No to the login shell over serial. Then yes to enabling the serial
port hardware.  exit out of the tool and back to the bash.

Physical connections from the Max232 to the PI GPIO: 

MAX232           Pi GPOI
Vcc              3.3V pin 2
GND              GND pin 6
Tx               Rx pin 10
Rx               Tx pin 8

Setting up to automate tcpser on boot:

Create a text file (I just put it in the home directory) and make it
executable. At the bash:

type: cd 
type: vi serialBridge 
type: i
type: #!/bin/sh 
type: tcpser -s 19200 -d /dev/ttyAMA0 &
type :wq 

you're now out of the editor and back at the bash. 

type: chmod +x serialBridge

that will make the file executable (like a batch file in DOS). Change the
19200 baud rate to whatever you need it to be.

You need to create another text file that instructs LINUX a service is
available. To do that, we create another text file in a very specific spot
and then issue some commands to tell LINUX to use it when it's booting. to
do that:

type: vi /lib/systemd/system/serialBridge.service 
type: i

copy and paste everything between the # marks into the editor:

####################
[Unit]
Description=Serial to TCP-IP Bridge
After=Multi-User.target

[Install]
WantedBy=Multi-user.target

[Service]
ExecStart=/home/pi/serialBridge
type=forked
#####################

You're still in the editor:
type: :wq 

You will now be out of the editor and at the bash prompt.

type: sudo systemctl enable serialBridge.service
type: sudo systemctl start serialBridge.service
type: sudo systemctl status serialBridge.service

The first command will instruct LINUX the service should be enabled at boot
(level 3).  The second command will tell LINUX to start the service right
now.  The third command will just display the status of the service we just
started with the previous 
command.

Run a terminal, turn flow control off, set the baud rate proper and
"ATDT dnsName:port" in the term and you're good to go.  Enjoy :)

*If you have any problems, please let me know and I'll be glad to help.  I
have the pictures and such on my facebook page blogging the project I just
did.  

One thing I'd like to note is that I thought tcpser, by default, used
RTS/CTS flow control.  I had to disable the flow control on the Atari
before any data came through...  I'm not sure if this is due to the buggy
serial port or just something I have 
overlooked....  Just a head's up in case you do not see anything going through.

Cheers,
Carl

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
SEEN-BY: 57/0 116/102 130/505 512 153/250 317/2 393/68 633/267 280 640/384
SEEN-BY: 712/620 848 770/0 1 3 100 340 772/0 1 210 500
@PATH: 770/3 1 712/848 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.