# Activating additional UARTs on Raspberry Pi 4B

**URL:** <https://forum.ubiquityrobotics.com/t/activating-additional-uarts-on-raspberry-pi-4b/807>\
**Category:** Pi Image\
**Created:** [April 21, 2021, 2:25am UTC](https://forum.ubiquityrobotics.com/t/activating-additional-uarts-on-raspberry-pi-4b/807 "2021-04-21T02:25:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![astan](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/a/5daacb/32.png) [@astan](https://forum.ubiquityrobotics.com/u/astan)\
**Post date:** [April 21, 2021, 2:25am UTC](https://forum.ubiquityrobotics.com/t/activating-additional-uarts-on-raspberry-pi-4b/807/1 "2021-04-21T02:25:19Z")

</div>

Device: Raspberry Pi 4B v1.2  
Image: 2020-11-07-ubiquity-xenial-lxde

Hello all, I’m using the Ubiquity image for a project that does not involve the Magni, and I’d like to enable the additional UART ports available on the RPi 4.

I’ve followed the instructions at [https://learn.ubiquityrobotics.com/GPIO\_lines](https://learn.ubiquityrobotics.com/GPIO_lines) to free up the GPIO lines, and I’ve added the following lines to config.txt to enable the four extra uart ports:

```
#Enable the additional uarts for serial communication
enable_uart=1
dtoverlay=miniuart-bt
dtoverlay=uart2
dtoverlay=uart3
dtoverlay=uart4
dtoverlay=uart5

```

However, after a reboot, running the command sudo raspi-gpio get returns the following:

```
BANK0 (GPIO 0 to 27):
  GPIO 00: level=1 fsel=3 alt=4 func=AVEIN_VCLK
  GPIO 01: level=1 fsel=3 alt=4 func=AVEIN_DSYNC
  GPIO 02: level=1 fsel=0 alt= func=INPUT
  GPIO 03: level=1 fsel=0 alt= func=INPUT
  GPIO 04: level=1 fsel=3 alt=4 func=AVEIN_VID0
  GPIO 05: level=1 fsel=3 alt=4 func=AVEIN_VID1
  GPIO 06: level=1 fsel=0 alt= func=INPUT
  GPIO 07: level=1 fsel=0 alt= func=INPUT
  GPIO 08: level=1 fsel=3 alt=4 func=AVEIN_VID4
  GPIO 09: level=1 fsel=3 alt=4 func=AVEIN_VID5
  GPIO 10: level=0 fsel=0 alt= func=INPUT
  GPIO 11: level=0 fsel=0 alt= func=INPUT
  GPIO 12: level=1 fsel=3 alt=4 func=AVEIN_VID8
  GPIO 13: level=1 fsel=3 alt=4 func=AVEIN_VID9
  GPIO 14: level=1 fsel=4 alt=0 func=TXD0
  GPIO 15: level=1 fsel=4 alt=0 func=RXD0
  GPIO 16: level=0 fsel=0 alt= func=INPUT
  GPIO 17: level=0 fsel=0 alt= func=INPUT
  GPIO 18: level=0 fsel=0 alt= func=INPUT
...

```

The four pairs of GPIO lines returning functions beginning with ‘AVEIN\_’ should be returning RX and TX like GPIO 14 and 15.

I used sudo raspi-gpio funcs to inspect the pin layout returned by raspi-gpio, which returns the following:

```
GPIO, DEFAULT PULL, ALT0, ALT1, ALT2, ALT3, ALT4, ALT5
0, UP, SDA0, SA5, PCLK, AVEOUT_VCLK, AVEIN_VCLK, -
1, UP, SCL0, SA4, DE, AVEOUT_DSYNC, AVEIN_DSYNC, -
2, UP, SDA1, SA3, LCD_VSYNC, AVEOUT_VSYNC, AVEIN_VSYNC, -
3, UP, SCL1, SA2, LCD_HSYNC, AVEOUT_HSYNC, AVEIN_HSYNC, -
4, UP, GPCLK0, SA1, DPI_D0, AVEOUT_VID0, AVEIN_VID0, ARM_TDI
5, UP, GPCLK1, SA0, DPI_D1, AVEOUT_VID1, AVEIN_VID1, ARM_TDO
6, UP, GPCLK2, SOE_N_SE, DPI_D2, AVEOUT_VID2, AVEIN_VID2, ARM_RTCK
7, UP, SPI0_CE1_N, SWE_N_SRW_N, DPI_D3, AVEOUT_VID3, AVEIN_VID3, -
8, UP, SPI0_CE0_N, SD0, DPI_D4, AVEOUT_VID4, AVEIN_VID4, -
9, DOWN, SPI0_MISO, SD1, DPI_D5, AVEOUT_VID5, AVEIN_VID5, -
10, DOWN, SPI0_MOSI, SD2, DPI_D6, AVEOUT_VID6, AVEIN_VID6, -
11, DOWN, SPI0_SCLK, SD3, DPI_D7, AVEOUT_VID7, AVEIN_VID7, -
12, DOWN, PWM0, SD4, DPI_D8, AVEOUT_VID8, AVEIN_VID8, ARM_TMS
13, DOWN, PWM1, SD5, DPI_D9, AVEOUT_VID9, AVEIN_VID9, ARM_TCK
14, DOWN, TXD0, SD6, DPI_D10, AVEOUT_VID10, AVEIN_VID10, TXD1
15, DOWN, RXD0, SD7, DPI_D11, AVEOUT_VID11, AVEIN_VID11, RXD1
16, DOWN, FL0, SD8, DPI_D12, CTS0, SPI1_CE2_N, CTS1
17, DOWN, FL1, SD9, DPI_D13, RTS0, SPI1_CE1_N, RTS1
18, DOWN, PCM_CLK, SD10, DPI_D14, I2CSL_SDA_MOSI, SPI1_CE0_N, PWM0
...

```

So it appears that funcs is returning the wrong GPIO pin setup for the Pi 4B. Has anyone successfully gotten uart2-uart5 working on a Ubiquity Pi image? Is there something I can do to force raspi-gpio to recognize that it is a Pi4B with a bcm2711 and use the appropriate pin setup?

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![astan](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/a/5daacb/32.png) [@astan](https://forum.ubiquityrobotics.com/u/astan)\
**Post date:** [April 24, 2021, 4:21am UTC](https://forum.ubiquityrobotics.com/t/activating-additional-uarts-on-raspberry-pi-4b/807/2 "2021-04-24T04:21:53Z")

</div>

In case anyone in the future is wondering, building the newest version of raspi-gpio from source using the instructions on the GitHub page and adding the directory to the start of the PATH fixed the pin mapping. After a reboot, a loopback test confirmed all five serial ports were functioning as expected.

Thanks to the crew at Ubiquity for making this image freely available.

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [April 24, 2021, 6:10am UTC](https://forum.ubiquityrobotics.com/t/activating-additional-uarts-on-raspberry-pi-4b/807/3 "2021-04-24T06:10:09Z")

</div>

This is very helpful @astan thank you for following up and finding a fix.

I had duplicated your earlier problem but had not dug in to look for a solution yet.

Thanks for the followup post as I had known more ports were possible on the Pi4 but had not tried it yet.

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [April 24, 2021, 6:48am UTC](https://forum.ubiquityrobotics.com/t/activating-additional-uarts-on-raspberry-pi-4b/807/4 "2021-04-24T06:48:36Z")

</div>

I hit another thing requiring a small hack. The apt get of automake gave me a rev 1.15 and the aclocal.m4 that is included in the raspi-gpio repository was setup to require automake 1.16.  
So I removed aclocal.m4, edit configure and change rev like this:  
am\_\_api\_version=‘1.15’

I pulled src with: git clone [https://github.com/RPi-Distro/raspi-gpio](https://github.com/RPi-Distro/raspi-gpio)

Then I could do the make as per the github for raspi-gpio and was able to enable a port, in my case uart3.

Thought this mention may help others to fix this make issue. Thanks.

---

<div class="post-metadata">

**Author:** ![astan](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/a/5daacb/32.png) [@astan](https://forum.ubiquityrobotics.com/u/astan)\
**Post date:** [April 24, 2021, 9:33am UTC](https://forum.ubiquityrobotics.com/t/activating-additional-uarts-on-raspberry-pi-4b/807/5 "2021-04-24T09:33:05Z")

</div>

Hi Mark! I owe you and your team 16.04 beers for solving the “Ubuntu 16.04 isn’t compatible with RPi 4B” problem, but your buy us a beer link at [https://www.ubiquityrobotics.com/dl-thank-you/](https://www.ubiquityrobotics.com/dl-thank-you/) appears to be broken. Please advise.

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [April 25, 2021, 9:33am UTC](https://forum.ubiquityrobotics.com/t/activating-additional-uarts-on-raspberry-pi-4b/807/6 "2021-04-25T09:33:37Z")

</div>

Thank you. I have passed this on to our web guy. This is some sort of effect due to some recent web site change. Thanks for pointing this out

---

<div class="post-metadata">

**Author:** ![rohbotics](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/rohbotics/32/222_2.png) [@rohbotics](https://forum.ubiquityrobotics.com/u/rohbotics)\
**Post date:** [April 25, 2021, 7:02pm UTC](https://forum.ubiquityrobotics.com/t/activating-additional-uarts-on-raspberry-pi-4b/807/7 "2021-04-25T19:02:16Z")

</div>

For now the Donate button on the other downloads page should work: [https://downloads.ubiquityrobotics.com/pi.html](https://downloads.ubiquityrobotics.com/pi.html)

Thanks  
Rohan
