3

I need to use all five of the PL011 UARTs on a Raspberry Pi 4. I am having no problems with UART2 - UART5. It is only UART0 that is giving me problems.

I connect a serial cable from a laptop to the raspi on UART0, run a terminal on COM1 on the laptop, and I SSH into the raspi and run a terminal (minicom) for "/dev/ttyAMA0". On any other UART when I do this, I can type in either terminal and get the characters echoed on the other terminal. On UART0, however, I get random garble on the raspi side, and I get the string "Minicom2.7.1" echoed repeatedly on the laptop side. If I type in characters on the raspi side, I do see them echoed on the laptop along with the "Minicom" string. What could cause this?

These are the steps I used to enable UART0:

  1. Disabled bluetooth by adding "dtoverlay=disable-bt" to "/boot/config.txt"
  2. Setting "enable_uart=1" in the same config file.
  3. Using raspi-config to enable serial ports and disable the shell over serial
  4. Disabled the service "hciuart".

The OS is updated with the latest versions of everything.

Also, if I wire the RX to the TX (pin 8 to pin 10) then it behaves as expected, i.e. typing characters into a terminal echoes them back.

Here is part of the output of "raspi-gpio get"

GPIO 14: level=1 fsel=4 alt=0 func=TXD0 pull=NONE
GPIO 15: level=1 fsel=4 alt=0 func=RXD0 pull=UP

There is no func=TXD1 or RXD1. So I am not sure why some people are saying UART 0 and 1 are clashing.

YWE
  • 143
  • 3
  • Do you have anything for the serial console in cmdline.txt ? You will need to take that out. –  Aug 25 '20 at 14:03
  • @Andyroo, here is my cmdline.txt: "console=tty1 root=PARTUUID=df23dc83-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait" – YWE Aug 25 '20 at 14:25
  • Try taking the `console=tty1` part out - leave everything else on one line and reboot. –  Aug 25 '20 at 17:52
  • @Andyroo, There is no difference after removing "console=tty1" – YWE Aug 25 '20 at 19:24
  • @YWE. Rpi4B UART 0,1 clashes: (1) https://i.imgur.com/85Pu9OU.png, (2) https://raspberrypi.stackexchange.com/questions/45570/how-do-i-make-serial-work-on-the-raspberry-pi3-or-later-model and you might have a problem setting them to work "at the same time". If you want many more UARTS, why not try USB to UART adapters? – tlfong01 Aug 26 '20 at 02:56
  • @tlfong01. So are you saying that UART0 and UART1 can never be used? Except for one of them with Bluetooth? Why have another UART if it can't even be used? UARTS2-5 do not clash. – YWE Aug 26 '20 at 12:53
  • 1
    (1) Well I also use UART 0, but never with BlueTooth at the same time. I am pessimistic and I think BlueZ5x might not be clean for the next couple of years. (2) Also I think it is very tricky to use both UART0 and UART1 at the same time. (3) I always use UART0, for basic testing/prototyping. I prefer to use USB UARTn because it is easy to swap/scale up. (4) I don't use other on board UARTS, because I want to use the other 5 on board SPIs, and I2Cs, and I don't have enough pins to go around. – tlfong01 Aug 26 '20 at 13:04

1 Answers1

2

AFAIK you can not use 5 UART.

Although the SOC has 6 UART not all are accessible on the Pi4 because some share the same pins (the other GPIO banks are not accessible). One can only use the reserved pins on the header used for HATS and I²C extender.

It may be possible if you disable Bluetooth (which uses one UART).

See Raspberry Pi4 UART

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • I did disable Bluetooth. I also disabled SPI and I2C. – YWE Aug 26 '20 at 12:39
  • Though I still do not know why this is true, I believe this is correct that 5 UARTs cannot all be used simultaneously. I disabled UARTS2-5 and UART0 worked. In fact, just enabling any one of UARTS2-4 messed up UART0 (5 didn't for some reason). – YWE Aug 26 '20 at 13:55