ptamike
Posts: 16
Joined: Fri Nov 29, 2013 10:29 am

Pi-4 Activating additional UART ports

Sat Jul 06, 2019 4:18 am

The new Pi-4 features additional hardware UART ports but I've been unable to find any documentation explaining how to access them.

Can anyone help?

User avatar
rpdom
Posts: 14473
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 6:54 am

An updated ARM Peripherals document is going to be released soon that will cover the additional UARTs and I2C buses on the Pi 4B.

I think it has been mentioned somewhere about the GPIOs that they are available on and which ALT modes need to be selected.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2226
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 7:09 am

Code: Select all

$ dtoverlay -a | grep uart
This will show that there are four new overlays - uart2 to uart5.

Code: Select all

$ dtoverlay -h uart2
The help info shows the GPIOs used by each new UART - 0-3 for UART 2, 4-7 for 3, 8-11 for 4 and 12-15 for 5. This does mean that UART 5 overlaps with the standard UARTs on 14 & 15, but UART 5 has its flow control signals there - TXD5 and RXD5 appear on 12 & 13.

Code: Select all

$ raspi-gpio funcs
Run on a Pi 4, this will show all of the alternate functions available on the 4.

ptamike
Posts: 16
Joined: Fri Nov 29, 2013 10:29 am

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 7:36 am

Thanks for the answers. I'll look forward to seeing the new documentation.

In the meantime, can anyone suggest what I would need to add to /boot/config.txt to activate one of the new ports?

Thanks,

Mike

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2226
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 7:42 am

Code: Select all

dtoverlay=uart3        # without flow control pins
dtoverlay=uart3,ctsrts # with flow control pins
etc.

Notupus
Posts: 30
Joined: Tue Jun 19, 2018 9:57 am

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 6:32 pm

And how do we enable a serial terminal on each uart?

klricks
Posts: 6442
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 7:02 pm

Can more than 1 UART be used at the same time?
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2226
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 7:53 pm

To create a console on a UART, add "console=ttyAMAn,115200" to /boot/cmdline.txt, where n is a small integer - look in /dev to get the right number.

All 4 extra UARTs can be used at the same time provided their pins don't clash with something else you need.

Notupus
Posts: 30
Joined: Tue Jun 19, 2018 9:57 am

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 8:25 pm

PhilE wrote:
Sat Jul 06, 2019 7:09 am

Code: Select all

$ raspi-gpio funcs
Run on a Pi 4, this will show all of the alternate functions available on the 4.
raspi-gpio does not exist on existing raspian lite images, how do I install that?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2226
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 8:42 pm

sudo apt-get install raspi-gpio

Notupus
Posts: 30
Joined: Tue Jun 19, 2018 9:57 am

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 8:47 pm

Also shouldn't the serial setting also set uart 0 to terminal mode, I know mine doesn't.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2226
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Pi-4 Activating additional UART ports

Sat Jul 06, 2019 9:51 pm

The default kernel command line includes console=serial0, which the firmware translates to ttyAMA0 or ttyS0 as necessary. I don't think it would be appropriate to automatically create consoles on all enabled UARTs - many people would want to use them for something else.

Notupus
Posts: 30
Joined: Tue Jun 19, 2018 9:57 am

Re: Pi-4 Activating additional UART ports

Sun Jul 07, 2019 7:14 am

Yea, but maybe add a way to do it from raspi-config?

stefanvlad
Posts: 3
Joined: Thu Mar 29, 2018 12:14 pm

Re: Pi-4 Activating additional UART ports

Tue Jul 09, 2019 9:48 am

I'm also interested in enabling a second UART

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2226
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Pi-4 Activating additional UART ports

Tue Jul 09, 2019 9:57 am

Do you feel there is some information missing from the posts above?

stefanvlad
Posts: 3
Joined: Thu Mar 29, 2018 12:14 pm

Re: Pi-4 Activating additional UART ports

Tue Jul 09, 2019 11:35 am

Sorry... I ran under the impression that some documentation is still pending. But you did say

Code: Select all

dtoverlay=uart3        # without flow control pins
dtoverlay=uart3,ctsrts # with flow control pins
How do I enable all of them. For instance

Code: Select all

dtoverlay=uart2,uart3,uart4,uart5
uart1 being enabled by default, pi 4 having 4 extra uarts. Correct me if I'm wrong.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2226
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Pi-4 Activating additional UART ports

Tue Jul 09, 2019 11:45 am

You need one dtoverlay= for each overlay. Anything else on the line is treated as a parameter. If you don't want to use the flow control signals then a fully loaded system would be:

Code: Select all

dtoverlay=uart2
dtoverlay=uart3
dtoverlay=uart4
dtoverlay=uart5
I'm sure you can guess how to enable flow control for any/all of them.

Note that the kernel will reject attempts to enable UARTs where the pins are in use by something else (e.g. UART0, UART1 or one of the I2C ports), or it might even disable the other thing, so make sure what you are trying to do is possible.

Return to “Device Tree”