Posts: 332
Joined: Mon Jan 01, 2018 2:14 pm

create 2 serial ports?

Wed Jan 01, 2020 1:49 pm

Hello ,
Using PI4 buster
currentlly I'm using pin8 and pin 10 to read data from Arduino (which is Serial0)
I need to read another Arduino , so I need to connect it to another serial port
when I look at the pinout I see I can use pins 27&28 as Tx2\Rx2
do I need to change something in the condig file? boot.txt in order to work with this pins?
or I can just connect and in the code write /dev/Serial2 ?


Posts: 839
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: create 2 serial ports?

Wed Jan 01, 2020 2:22 pm

Based on your headline I came to say that I know you can use pigpio to bitbang with any gpio, but if I have to write as well as receive (at the PI) I usually just use an FTDI because it's a little bit of a dance to create waves. But I see you ask about the PI4 and I forgot it has a "2nd uart" so now I'm commenting largely to follow also because sooner or later I'll take the 4GB model I've had since release week out of the box.
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

Posts: 332
Joined: Mon Jan 01, 2018 2:14 pm

Re: create 2 serial ports?

Thu Jan 02, 2020 8:45 am

Didn't understand what you want to say ,

After seraching online
I saw that I jsut need to add in /boot/config.txt this line:

Code: Select all

then to use this setting in python code

Code: Select all

ser = serial.Serial(
               baudrate = 9600,
tehn I use pin28 (RX) to get the data from my sensor - and it's working!

but when I use the same setting in another PI4 - it doesn't work

I don't get any reading at all - what can it be?
using the same sensor \cables \wiring ....

Thanks ,

Return to “Beginners”