User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Setup and PL2303 Serial Console on your Raspberry PI 3B

Sun May 15, 2016 1:13 am

The purpose of this project post is to document what it took to get a serial
console running on the Raspberry PI 3B with Jessie. I am using a usb to ttl
serial {debug / console} cable for the Raspberry PI similar to this cable from AdaFruit.

Not all PL2303 usb to ttl serial cables are the same, and it is very important
to make certain that the voltages are correct before connecting
it to your Raspberry PI. The PL2303 will work at both 5v and 3v3. The one I'm
using was correctly set to 3v3 on the Txd line; however, the red power line
was soldered incorrectly as 5v-- I needed to modify that! In the pic below
if you right click and select 'open in a new tab' you'll get a much larger view...
pl2303.jpg
PL2303 usb to TTL serial adapter jpg
pl2303.jpg (28.85 KiB) Viewed 5836 times
In the pic above :roll: you can see that I have moved the red line from the
5v pwr output to the 3v3 pwr output. Notice also on pin four (4) [ count four
down from the dimple in the upper left of the chip pin(1) ] the lan pattern
is running down to the 3v3 pwr output. Pin four is a voltage referenc; if
connected to 3v3 the Txd pin will work at 3v3 --- otherwise if the reference
is connected to 5v then the Txd line will work at 5v!-- and destroy your PI
when you plug it in to GPIO15! Always make sure (by looking) that the pin
four(4) of the PL2303 is connected to 3v3, and also measure pin 4 carefully
with a meter. Most of these units will open up (as in my pic) if you're very
careful. Also, if you happen to get a PL2303 that has pin 4 tied to 5v, not
to worry... just lift the pin four with a scaple and soldering iron and tie
the open pin to the 3v3 pwr reference.

While the PL2303 is open, also check to make sure the black wire is soldered
to ground, the white wire is soldered to Rxd, and the green wire is soldered
to Txd. (sometimes the white and green wires get reversed; that's ok, as long
as you are consistent). Just know which wire is Txd.

In order to get a true serial console running on the PI 3B several config
changes must be made. A true serial console will 'see' bootup messages on
powerup (normally going to tty1) and will also see powerdown messages
on shutdown. As well, console messages will be displayed to the serial console
if it has been configured to be the console.

Code: Select all

sudo apt-get update
sudo apt-get upgrade
First, in raspi-config, enable serial in the advanced options, and reboot.

Second, add these two lines to /boot/config.txt (with nano, or vi, ):

Code: Select all

core_freq=250
enable_uart=1
Third, change /boot/cmdline.txt and change console=tty1 to console=serial0

Code: Select all

console=serial0,115200 console=serial0
Shutdown the system with sudo poweroff

With the power off, plug your PL2303 usb to ttl serial cable into the Raspberry PI
GPIO pins paying attention to the color scheme; black (ground) goes to board
number #6 ground, white goes to board #8 GPIO14, and green goes to board #10
GPIO15. To be clear, the green wire should be the PL2303 Tx line! (make sure)
The RPi GPIO15 is the recieve pin; so, the Tx pin of the PL2303 plugs into
GPIO15... also, GPIO14 is the transmit pin of the RPi; so, the Rcv pin of the
PL2303 plugs in there. Tx-->Rcv & Rcv-->Tx (if you get them reversed it won't
work)

Plug the PL2303 usb connector into your PC. I am using an HP notebook running
gnu+linux (Mint, another debian derivative). It will be important to know the
device name of the usb to ttl converter... mine showed up as /dev/ttyUSB0.
You can use the command:

Code: Select all

dmesg |grep -i tty
... look for the PL2303 converter as device... probably ttyUSB0.

You can use minicom, or screen, to 'talk' to the /dev/ttyUSB0 serial
device. As an example:

Code: Select all

sudo apt-get install screen

Code: Select all

sudo screen /dev/ttyUSB0 115200
Enter your password, and then press the enter key... a blank screen is normal.

Now, poweron your Raspberry PI... if everything is working you wil soon be
seeing the console bootup messages fly by, ending up with a Raspberry PI
console login.

Logon as pi like normal you do...

(please see the man pages or on-line documentation for correct config and
usage of screen and minicom).

(if you find something out of place, or wrong, send me a private message
and I'll fix it. Tnx)

marcus
marcus
:ugeek:

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

Re: Setup and PL2303 Serial Console on your Raspberry PI 3B

Sun May 15, 2016 7:12 am

Good project, nice and clear instructions.
Looks like this would be exactly the same instructions for any model of RPi?
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Setup and PL2303 Serial Console on your Raspberry PI 3B

Sun May 15, 2016 5:50 pm

Cancelor wrote: Looks like this would be exactly the same instructions for any model of RPi?
As far as the PL2303 is concerned, yes; otherwise no--- because, the model 3B (aside from moving to systemd with Jessie) added blue tooth to the mix... which had a considerable impact on the serial port, even the naming conventions of the serial ports. Also, the model 3B (due to above) has broken baud rate on the uart (in fact the uart changed). That is the reason for the core_freq=250 and the enable_uart=1. Supposedy, the enable_uart=1 is going to do the core_freq=250 for you... but I have not seen it yet; may not be a part of apt-get update yet!

The instructions for serial console on AdaFruit for the PL2303 (they carry the device and sponsor it for the Raspberry PI) are good for all models except the 3B.

It looks to me like most people need the serial port (right now) more than they need the bluetooth connectivity (that is true of me, anyways). If you need everything its not going to happen right away. Having serial under programmed control, and a serial console, and bluetooth with wifi running has some overlay conflicts. So, they'll get it figured out before its over... and they're trying with great success modernizing the RPi (I'm pleased). Figuring out serial for me was like the old adage, "once I learned all the answers, they changed all the questions!" It did take me a bit to get it figured out... and as always, all the chatter on line (and on this site) confused more than helped. Its really pretty simple once you get the details sorted out.

Thanks.
marcus
:ugeek:

pibudsman
Posts: 1
Joined: Wed Jan 04, 2017 1:50 am

Re: Setup and PL2303 Serial Console on your Raspberry PI 3B

Wed Jan 04, 2017 2:33 am

[quote="MarkHaysHarris777"]
Not all PL2303 usb to ttl serial cables are the same, and it is very important
to make certain that the voltages are correct [b][i]before[/i][/b] connecting
it to your Raspberry PI. The PL2303 will work at both 5v and 3v3. The one I'm
using was correctly set to 3v3 on the Txd line; however, the red power line
was soldered incorrectly as 5v-- I needed to modify that! Pin four is a voltage reference;
if connected to 3v3 the Txd pin will work at 3v3 --- otherwise if the reference
is connected to 5v then the Txd line will work at 5v!-- and destroy your PI
when you plug it in to GPIO15! Always make sure (by looking) that the pin
four(4) of the PL2303 is connected to 3v3, and also measure pin 4 carefully
with a meter. Most of these units will open up (as in my pic) if you're very
careful. Also, if you happen to get a PL2303 that has pin 4 tied to 5v, not
to worry... just lift the pin four with a scaple and soldering iron and tie
the open pin to the 3v3 pwr reference.
[/quote]

Probably I amreplying for a very older post. Sorry about that. I have recently started working on RPI3 board and had hard time configuring serial console. I referred to this post and even looked into my pl2303 usb to ttl converter. I believe the Power pin of PL2303 is an output pin and is used for powering the board when there is no other power source and not used as reference voltage for TXD and RXD. The TXD and RXD pins of PL2303 are always on 3.3V levels irrespective of power pin voltage. The power pin on my PL2303 is connected to 5V but TXD and RXD measure 3.3V! Please correct me if I am wrong.

Thanks.

gkoper
Posts: 13
Joined: Sun Mar 10, 2013 2:53 pm

Re: Setup and PL2303 Serial Console on your Raspberry PI 3B

Sat Apr 01, 2017 11:27 am

I fully agree pibudsman! It suffices to connect the black, white and green wires to the RPi's GPIO pins 6, 8 and 10 and the PL2303 will work as should.

User avatar
jefferson_palheta
Posts: 10
Joined: Thu Apr 27, 2017 8:22 pm
Contact: Twitter

Re: Setup and PL2303 Serial Console on your Raspberry PI 3B

Thu Apr 27, 2017 8:25 pm

is it possible to connect on the serial console using a common usb cable?

Return to “Other projects”