zhak
Posts: 9
Joined: Wed Jul 03, 2019 5:18 pm

GPIO UART voltages

Sun Aug 25, 2019 11:48 am

Hi guys, I'm not quite familiar with electronics, so I'd be happy if you could explain me something.

Documentation says:
The SoCs used on the Raspberry Pis have two built-in UARTs, a PL011 and a mini UART. They are implemented using different hardware blocks, so they have slightly different characteristics. However, both are 3.3V devices, which means extra care must be taken when connecting up to an RS232 or other system that utilises different voltage levels. An adapter must be used to convert the voltage levels between the two protocols. Alternatively, 3.3V USB UART adapters can be purchased for very low prices.
Some tutorial about using UART as a serial console suggested connecting USB-UART adapter power line to GPIO Pin 4 (+5V), and I did so, and it seems OK. But maybe I'm doing it wrong and should connect to Pin 1 (+3.3V)?

Another question is https://pinout.xyz/pinout/pin1_3v3_power says:
All Raspberry Pi since the Model B+ can provide ... up to 500mA to remain on the safe side. ...Still, you should generally use the 5v supply, coupled with a 3v3 regulator for 3.3v projects.
. So, if I understand it correctly, the board gives power to connected peripherals. But if I connect USB-UART adapter to PC without powering on the board, it still powers on and tries to boot (although fails with low-power-supply error message). Thus it appears not to give power, but to receive it from the connected device. Does it work in both directions?

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

Re: GPIO UART voltages

Sun Aug 25, 2019 12:05 pm

All the Pi's GPIO (which includes the UART) are 3V3.

Could you explain exactly what you are plugging in and where. I.e. you mention a USB UART but you don't say which end is plugged in where.

zhak
Posts: 9
Joined: Wed Jul 03, 2019 5:18 pm

Re: GPIO UART voltages

Sun Aug 25, 2019 12:37 pm

I bought this kind of adapter

Image

It includes PL-2303HX USB-to-Serial bridge controller. I connect it to GPIO Pins as follows:

Code: Select all

Board               Cable

Pin 4  (+5V)  <--- +5V (red)
Pin 6  (GND)  <--- GND (black)
Pin 8  (TXD0) <--- Rx  (white)
Pin 10 (RXD0) <--- Tx  (green)
the USB-end goes to USB port in my PC

User avatar
DougieLawson
Posts: 35814
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: GPIO UART voltages

Sun Aug 25, 2019 12:49 pm

Don't use 5V you may fry your RPi that way.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

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

Re: GPIO UART voltages

Sun Aug 25, 2019 1:18 pm

Just connect the ground, TX, and RX wires.

Don't connect the 5V from the adapter to the Pi. You will be able to power a low power device like an Arduino via a USB socket. The Pi needs more power than can reliably provided. Power the Pi separately.

hippy
Posts: 5794
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: GPIO UART voltages

Sun Aug 25, 2019 1:45 pm

zhak wrote:
Sun Aug 25, 2019 12:37 pm
I bought this kind of adapter
Check what its TX voltage is. If it is 5V - as I suspect it will be - then connecting TX directly to the Pi's RXD0 pin may damage the RXD0 pin or the entire Pi.

It is best to choose a USB-to-UART cable or module which use 3V3 signalling rather than than 5V.

If you only have a USB-to-UART cable or midule which uses 5V signalling you will need to put the 5V TX signal through a voltage divider to ensure the Pi's RXD0 pin only sees 3v3 Maximum.

Note that the common trick of using just an inline current limiting resistor to link a 5V output to a 3V3 input - which works for most microcontrollers - will not work with a Pi, risks damaging it similarly to a direct connection.

A 1K inline resistor would however be recommended in case the Pi's RXD0 input is ever accidentally made an output.

gkaiseril
Posts: 637
Joined: Mon Aug 08, 2016 9:27 pm
Location: Chicago, IL

Re: GPIO UART voltages

Sun Aug 25, 2019 2:28 pm

From ADA Fruit the 5 vdc power connection is optional. It is important that only one side of the serial connection power the serial connection. Since you cannot control the power to the USB plug, assume it is providing the power and do not connect the 5 vdc connection. Only if the connection does not work, then measure the 5 vdc connection and see if there is any voltage present. If there is any voltage do not connect.
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.

drgeoff
Posts: 9759
Joined: Wed Jan 25, 2012 6:39 pm

Re: GPIO UART voltages

Sun Aug 25, 2019 2:55 pm

gkaiseril wrote:
Sun Aug 25, 2019 2:28 pm
From ADA Fruit the 5 vdc power connection is optional. It is important that only one side of the serial connection power the serial connection. Since you cannot control the power to the USB plug, assume it is providing the power and do not connect the 5 vdc connection. Only if the connection does not work, then measure the 5 vdc connection and see if there is any voltage present. If there is any voltage do not connect.
Just in case it needs to be explicitly stated. Even if not using 5 volts from the RPi and the USB device is getting power from whatever USB host it is plugged in to, everything above about the voltage level applied to the RPI's Rx pin still applies.

zhak
Posts: 9
Joined: Wed Jul 03, 2019 5:18 pm

Re: GPIO UART voltages

Sun Aug 25, 2019 5:22 pm

Thanks for your replies. I checked documentation for my adapter -- it uses 3.3V signal level. I also disconnected +5V red wire (hopefully, looks like nothing bad has happened while it was running on both power sources - from the red wire and standard USB power adapter)

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5052
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: GPIO UART voltages

Sun Aug 25, 2019 8:32 pm

joan wrote:
Sun Aug 25, 2019 1:18 pm
...
Don't connect the 5V from the adapter to the Pi. You will be able to power a low power device like an Arduino via a USB socket. The Pi needs more power than can reliably provided. Power the Pi separately.
Whilst the above is generally true for most Pi's there are exceptions:
http://www.cpmspectrepi.uk/raspberry_pi ... Powered.22
Trev. ;)
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my 2xP3A+, P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

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