User avatar
joan
Posts: 12815
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Connect Model A to Model B via serial lines

Tue Sep 01, 2015 8:18 am

I tried your instructions last night and they seemed to work.

I used sudo apt-get install ppp (rather than ippp) and dnsutils (rather than dns-utils). Apart from those changes everything seemed to work as advertised.

I only tested as far as pinging between the machines over the serial link.

mshannon
Posts: 8
Joined: Thu Oct 17, 2013 4:14 pm

Re: Connect Model A to Model B via serial lines

Sat Sep 05, 2015 11:50 am

Thanks Joan, that worked.

User avatar
RaTTuS
Posts: 9585
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Connect Model A to Model B via serial lines

Mon Sep 07, 2015 7:35 am

joan wrote:I tried your instructions last night and they seemed to work.

I used sudo apt-get install ppp (rather than ippp) and dnsutils (rather than dns-utils). Apart from those changes everything seemed to work as advertised.

I only tested as far as pinging between the machines over the serial link.
Excellent Joan
I'll update a new post with fresh instructions soon ...[RSN]
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
RaTTuS
Posts: 9585
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Connect Model A or PiZero to Model B Via serial Lines [JESSI

Mon Oct 12, 2015 2:13 pm

Following on from viewtopic.php?f=44&t=51633
and with a bit of help and prodding from Davespice memberlist.php?mode=viewprofile&u=2631
I present to you the way to get raspbian out of the box to work with serial communications
what we assume that you have a local network that the RPi model B [B+ or B2] will be connected to and the Model A will connect via the serial GPIO
and that we are using IPV4 for networking if your using IPV6 then the same applies except you will have to alter the IPV4 addresses and forward options to IPV6
I'm also doing this from the default account so I sudo everything I need rather than running a sudo shell

see :- http://elinux.org/images/2/2a/GPIOs.png for GPIO
connect pin 6 to both machines [Ground]
connect GPIO 14 [TXD] pin 8 on one machine to GPIO 15 [RXD] pin 10 on the other
and visa vesa

first off download raspbain Jessie and write it to the Micro SDcard
plug the Model B into the network | screen and keyboard add the SDcard and apply power
if it does not boot then see
viewtopic.php?f=28&t=58151

log in and open a terminal

Code: Select all

cd /boot
sudo cp cmdline.txt cmdline.old
sudo cp config.txt config.old
sudo nano cmdline.txt
we going to remove the console=ttyAMA),115200
so that the stuff we do later will have full use of the serial lines
so

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA),115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
becomes

Code: Select all

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
and save it
if your other options are different then leave them as they are we're only interested in remove the console logging.

next we need to fix up the uart clock speed in config.txt so
sudo nano config.txt
ad add

Code: Select all

init_uart_clock=16000000
to the bottom - that is 16 million

next we need to make sure we have the latest and greatest and install ppp

Code: Select all

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install ppp
next we need to make sure that packets can be moved round the system
sudo nano /etc/sysctl.conf
and uncomment the
net.ipv4.ip_forward=1
i.e. remove the # from the front of it then

Code: Select all

sudo sysctl -p
sudo systemctl disable serial-getty@ttyAMA0.service
then we need to setup some serial options
sudo nano /etc/ppp/options.ttyAMA0
and add

Code: Select all


noauth
nocrtscts
xonxoff
passive
local
maxfail 0
defaultroute
persist
nodetach
noipdefault
usepeerdns
next we need a systemD startup thingy
sudo nano /etc/systemd/system/ppp.service
create it as

Code: Select all

[Unit]
Description=PRi UART PPP Link
After=syslog.target

[Service]
Type=simple
ExecStart=/usr/sbin/pppd /dev/ttyAMA0 1000000
Restart=always

[Install]
WantedBy=multi-user.target
Alias=ppp.service
then we need to enable it all

Code: Select all

sudo systemctl daemon-reload
sudo systemctl start ppp.service
sudo systemctl status ppp.service
sudo systemctl enable ppp.service #possibly not needed
we need to fix the dns
sudo nano /etc/resolvconf.conf
and add

Code: Select all

name_servers=192.168.11.100  #or whatever is relevant for your network
or [thanks tot danjperron]
name_servers_append=8.8.8.8 8.8.4.4
then
sudo raspi-config
expand filesystem
then shutdown
sudo shutdown -h now

take that SDcard and put it into the Model A

take a new sdcard and burn raspbian on it and make the same changes as above except
don't add anything in /etc/ppp/resolvconf.conf
and make the
/etc/ppp/options.ttyAMA0 look like

Code: Select all

noauth
nocrtscts
xonxoff
passive
local
maxfail 0
nodetach
192.168.11.1:192.168.11.254
persist
proxyarp
holdoff 30
idle 600
usepeerdns
the IP addresses should be both available and valid on your network and in the form of
local:remote
the local being the model B and the remote being the Model A
so if your local network is
192.168.1.x and your raspberry has an address of
192.168.1.32
you need an IP for the ppp link and the far side.
192.168.1.33 192.1:192.168.1.34
now some words on the other options
proxyarp means that the RPi will broadcast the IP of the model a on the network so when conenct you would be able to ssh into the model a from a windows machine via the model b
holdoff 30 - means wait 30secs on a disconnect before re-attempting a re-connect - you can fiddle with that to give you a better response for when things go away
Idle 600 - means if no packets are sent within 10 mins then disconnect [it will attempt a reconnect after 30secs see above

I'm about 90% sure that this is all the steps but posting it hear so I can re-do it to my satisfaction and when I get some time
Last edited by RaTTuS on Mon Jan 04, 2016 3:35 pm, edited 4 times in total.
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
Cancelor
Posts: 743
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: Connect Model A to Model B via serial lines

Mon Oct 12, 2015 6:37 pm

+1

Brilliant.

I find this bit confusing :-
you need an IP for the ppp link and the far sidei.e.
192.168.1.33 192.1:192.168.1.34
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

danjperron
Posts: 2678
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Connect Model A to Model B via serial lines

Tue Oct 13, 2015 1:53 am

I just did that on this post!
/sbin/iptables -t nat -A POSTROUTING -o wlan0

I didn't think about creating a service . Great Job on that one.

I do have some question!

I realize that resolvconf.conf only support one dns server with the command "name_servers"
If you want to add other server you need to add it with the command "name_servers_append"

So I don't understand why you didn't have an error with "name_server=8.8.8.8 8.8.4.4". On my Pi it does!

I did have to create a NAT route table to be able to connect on the internet with the ppp client.
So Are you able to ping "google.com" without the iptables NAT routing. On my system I had to
create this iptables routing on the Raspberry Pi server.

Code: Select all

iptables -t nat -A POSTROUTING -o wlan0  -j MASQUERADE
Also The client configuration IP could be "0.0.0.0:0.0.0.0" . On connection the IP will be set by the server.

User avatar
RaTTuS
Posts: 9585
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Connect Model A to Model B via serial lines

Tue Oct 13, 2015 8:33 am

Cancelor wrote:+1

Brilliant.

I find this bit confusing :-
you need an IP for the ppp link and the far sidei.e.
192.168.1.33 192.1:192.168.1.34
reedited it [got a typo in there]
that is the 2 addresses [local:remote]
both need to be available on your network and not used by anything
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
RaTTuS
Posts: 9585
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Connect Model A to Model B via serial lines

Tue Oct 13, 2015 8:36 am

danjperron wrote:...
I realize that resolvconf.conf only support one dns server with the command "name_servers"
If you want to add other server you need to add it with the command "name_servers_append"
...
yes you may be right
I have it setup with a company dns so it has to be different so got a typo in there - back to one on the main post but with a extra line ;)
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

foster82
Posts: 41
Joined: Tue Jan 15, 2013 10:58 am

Re: Connect Model A to Model B via serial lines

Fri Nov 10, 2017 3:27 am

Hi all,

would this work with stretch and rpi2 and model B or would further steps be needed,


cheers

User avatar
RaTTuS
Posts: 9585
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Connect Model A to Model B via serial lines

Fri Nov 10, 2017 3:35 pm

yes it should see the viewtopic.php?f=44&t=51633&start=25#p828064 jessie bit -= I think it is close enough
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

foster82
Posts: 41
Joined: Tue Jan 15, 2013 10:58 am

Re: Connect Model A to Model B via serial lines

Wed Dec 06, 2017 3:08 am

ok so i have given this a try and have followed it word for word, everything seems to be running. However i can not see the IP address on my network that i set and if i try to SSH to it it fails.

Not sure how best to troubleshoot this , any ideas.

Just for info i have a raspberry pi b as the host to connect to the console on a raspberry pi 3.

cheers

Jonathan.

User avatar
RaTTuS
Posts: 9585
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Connect Model A to Model B via serial lines

Wed Dec 06, 2017 8:11 am

I dont have this setup anymore , however
on both pi's do
ifconfig ; route
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

foster82
Posts: 41
Joined: Tue Jan 15, 2013 10:58 am

Re: Connect Model A to Model B via serial lines

Thu Dec 07, 2017 12:18 am

OK just want to clarify a few points , make sure i haven't gone wrong some where.

i want to be able to get on to the serial console of my raspberry pi 3 from my raspberry pi model B.

So the first part i of the instructions is for the raspberry pi 3 and the second part is for the model B or is that the wrong way round.

User avatar
RaTTuS
Posts: 9585
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Connect Model A to Model B via serial lines

Fri Dec 08, 2017 12:04 pm

this will not give you access to the serial console , what it does it use the serial lines to provide a networked solution so that both raspberrys appear on the network and each can acecss the other, and the larger internet as well ...

I may have some time next week, so will do it again via latest Stretch , just so I can see if i can follow my own instruction and alter then if needed
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

danjperron
Posts: 2678
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Connect Model A to Model B via serial lines

Fri Dec 08, 2017 12:22 pm

i want to be able to get on to the serial console of my raspberry pi 3 from my raspberry pi model B.
Then just enable the serial console on the Raspberry Pi 3 and disable the console on the model B but let the serial enable.

The only thing left will be to download screen or minicom and use the application to communicate with PI 3.

ex:
On the model B

sudo apt-get install minicom
minicom -D /dev/serial0 -b 115200 et voila you have access to Pi 3 via Pi B

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: dvdinh and 15 guests