g8bpq
Posts: 4
Joined: Sat Aug 04, 2012 8:03 am

PI4 Serial Ports

Wed Jul 03, 2019 12:21 pm

I've read a couple of posts that suggest the Pi4 has 4 serial ports, and this seems to be confirmed by there being device tree files for uarts 2 -5. I've tried loading these and there aren't any errors but no new ports appear. Do I need to do anything else, or is this not yet supported?

Thanks,
John

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

Re: PI4 Serial Ports

Sat Jul 06, 2019 10:49 am

Hi John,

I asked a similar question on the Device Tree section of the forum and received a reply, so I thought I'd share the answer here.

There are four new overlays for hardware serial ports - uart2 to uart5. After loading they will be available as /dev/ttyAMA1-4. To activate one of the additional hardware serial ports, add the following to /boot/config.txt:

dtoverlay=uart2

To create a serial port with flow control, use:

dtoverlay=uart2,ctsrts

The port will then be available via /dev/ttyAMA1

To see the GPIO pin allocation for a uart via the command-line use: dtoverlay -h uart2

To see a listing of all the available gpio pin functions via the command-line use:

raspi-gpio funcs

Hope that helps clarify the position.

Mike - G4WNC

g8bpq
Posts: 4
Joined: Sat Aug 04, 2012 8:03 am

Re: PI4 Serial Ports

Sat Jul 06, 2019 12:59 pm

Thanks for your help Mike.

I should have thought of posting to the Device Tree forum

They seem to work, but so far only tested with looping to a terminal program.

BTW connecting to ID_SC and ID_SD (GPIO0 and 1) messes up boot, but they seem to work if connected later.

73,
John G8BPQ

thammu
Posts: 7
Joined: Tue Dec 24, 2019 4:06 pm

Re: PI4 Serial Ports

Tue Dec 24, 2019 4:16 pm

Hi Mike,

I followed your instructions. I get the following output after enabling uart2.

Code: Select all

pi@raspberrypi:~ $ dtoverlay -h uart2

Name:   uart2

Info:   Enable uart 2 on GPIOs 0-3

Usage:  dtoverlay=uart2,<param>

Params: ctsrts                  Enable CTS/RTS on GPIOs 2-3 (default off)
Please help me decipher it. Is the uart2 available on GPIOs 0 & 1 (Pin 27, 28) or on GPIOs 2 & 3 (Pin 3,5)?
And does CTS/RTS mean TXD/RXD?

Please help.

thammu
Posts: 7
Joined: Tue Dec 24, 2019 4:06 pm

Re: PI4 Serial Ports

Wed Dec 25, 2019 4:48 am

This command cleared my doubts:

Code: Select all

$ raspi-gpio get 0-1
GPIO 0: level=1 fsel=3 alt=4 func=TXD2 pull=NONE
GPIO 1: level=1 fsel=3 alt=4 func=RXD2 pull=UP
The corresponding pins are found by command:

Code: Select all

$ pinout

3V3  (1) (2)  5V    
 GPIO2  (3) (4)  5V    
 GPIO3  (5) (6)  GND   
 GPIO4  (7) (8)  GPIO14
   GND  (9) (10) GPIO15
GPIO17 (11) (12) GPIO18
GPIO27 (13) (14) GND   
GPIO22 (15) (16) GPIO23
   3V3 (17) (18) GPIO24
GPIO10 (19) (20) GND   
 GPIO9 (21) (22) GPIO25
GPIO11 (23) (24) GPIO8 
   GND (25) (26) GPIO7 
 GPIO0 (27) (28) GPIO1 
 GPIO5 (29) (30) GND   
 GPIO6 (31) (32) GPIO12
GPIO13 (33) (34) GND   
GPIO19 (35) (36) GPIO16
GPIO26 (37) (38) GPIO20
   GND (39) (40) GPIO21

i.e Pins 27,28

GPIO 2-3 are the control pins, enabled by config line:

Code: Select all

dtoverlay=uart1,ctsrts

linhz0hz
Posts: 3
Joined: Sat Jul 04, 2020 3:41 pm

Re: PI4 Serial Ports

Sat Jul 04, 2020 3:44 pm

I have a follow up question:
If I really need to use all the serial port in a pi 4 and do not want the ID_SC and ID_SD to do anything during the boot up, is there a way to disable those two buses? (I am not using any HAT so I don't really need the auto ID EEPROM lookup)

cleverca22
Posts: 1412
Joined: Sat Aug 18, 2012 2:33 pm

Re: PI4 Serial Ports

Sun Jul 05, 2020 6:51 am

linhz0hz wrote:
Sat Jul 04, 2020 3:44 pm
I have a follow up question:
If I really need to use all the serial port in a pi 4 and do not want the ID_SC and ID_SD to do anything during the boot up, is there a way to disable those two buses? (I am not using any HAT so I don't really need the auto ID EEPROM lookup)
i think you want `force_eeprom_read=0` to disable that

User avatar
dickon
Posts: 1726
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: PI4 Serial Ports

Sun Jul 05, 2020 9:56 am

That, and disable_poe_fan=1 as the firmware will also probe for a POE HAT fan controller, even with force_eeprom_read=0 (because apparently the POE HAT's fan controller isn't an ID EEPROM, which makes sense but is slightly irksome if you assumed fer=0 to disable the thing entirely, as I did).

Return to “Advanced users”