Raspberry Pi 4B uart3 enable documentation

 Raspberry Pi 4B  uart3 enable documentation

Rpi4 uart3 enable


https://forums.raspberrypi.com/viewtopic.php?t=340392   Forum Post about enabling uart3

dtoverlay=uart3 is all you need for enabling it (either w/ or w/o flow control).
I.e. on my CM4 DUT  You add a line to the config.txt file to apply a Device Tree overlay

dtoverlay=uart4 dtoverlay=uart3

or

dtoverlay=uart3,ctsrts //here I trying both with and without "ctsrts"

gives me

pi@64bit-test:~ $ raspi-gpio get BANK0 (GPIO 0 to 27): GPIO 0: level=1 fsel=0 func=INPUT pull=UP GPIO 1: level=1 fsel=0 func=INPUT pull=UP GPIO 2: level=1 fsel=0 func=INPUT pull=UP GPIO 3: level=1 fsel=0 func=INPUT pull=UP GPIO 4: level=1 fsel=3 alt=4 func=TXD3 pull=NONE GPIO 5: level=1 fsel=3 alt=4 func=RXD3 pull=UP GPIO 6: level=1 fsel=0 func=INPUT pull=UP GPIO 7: level=1 fsel=0 func=INPUT pull=UP GPIO 8: level=1 fsel=3 alt=4 func=TXD4 pull=NONE GPIO 9: level=1 fsel=3 alt=4 func=RXD4 pull=UP GPIO 10: level=0 fsel=0 func=INPUT pull=DOWN GPIO 11: level=0 fsel=0 func=INPUT pull=DOWN GPIO 12: level=0 fsel=0 func=INPUT pull=DOWN GPIO 13: level=0 fsel=0 func=INPUT pull=DOWN GPIO 14: level=1 fsel=0 func=INPUT pull=NONE GPIO 15: level=1 fsel=0 func=INPUT pull=UP GPIO 16: level=0 fsel=0 func=INPUT pull=DOWN GPIO 17: level=0 fsel=0 func=INPUT pull=DOWN GPIO 18: level=0 fsel=0 func=INPUT pull=DOWN GPIO 19: level=0 fsel=2 alt=5 func=PWM0_1 pull=NONE GPIO 20: level=0 fsel=0 func=INPUT pull=DOWN GPIO 21: level=0 fsel=0 func=INPUT pull=DOWN GPIO 22: level=0 fsel=0 func=INPUT pull=DOWN GPIO 23: level=0 fsel=0 func=INPUT pull=DOWN GPIO 24: level=0 fsel=0 func=INPUT pull=DOWN GPIO 25: level=0 fsel=0 func=INPUT pull=DOWN GPIO 26: level=1 fsel=1 func=OUTPUT pull=DOWN GPIO 27: level=1 fsel=1 func=OUTPUT pull=DOWN BANK1 (GPIO 28 to 45): GPIO 28: level=1 fsel=2 alt=5 func=RGMII_MDIO pull=UP GPIO 29: level=0 fsel=2 alt=5 func=RGMII_MDC pull=DOWN GPIO 30: level=0 fsel=7 alt=3 func=CTS0 pull=UP GPIO 31: level=0 fsel=7 alt=3 func=RTS0 pull=NONE GPIO 32: level=1 fsel=7 alt=3 func=TXD0 pull=NONE GPIO 33: level=1 fsel=7 alt=3 func=RXD0 pull=UP GPIO 34: level=1 fsel=7 alt=3 func=SD1_CLK pull=NONE GPIO 35: level=1 fsel=7 alt=3 func=SD1_CMD pull=UP GPIO 36: level=1 fsel=7 alt=3 func=SD1_DAT0 pull=UP GPIO 37: level=1 fsel=7 alt=3 func=SD1_DAT1 pull=UP GPIO 38: level=1 fsel=7 alt=3 func=SD1_DAT2 pull=UP GPIO 39: level=1 fsel=7 alt=3 func=SD1_DAT3 pull=UP GPIO 40: level=1 fsel=0 func=INPUT pull=DOWN GPIO 41: level=1 fsel=0 func=INPUT pull=DOWN GPIO 42: level=0 fsel=1 func=OUTPUT pull=DOWN GPIO 43: level=1 fsel=0 func=INPUT pull=DOWN GPIO 44: level=1 fsel=5 alt=1 func=SDA0 pull=NONE GPIO 45: level=1 fsel=5 alt=1 func=SCL0 pull=NONE BANK2 (GPIO 46 to 53): GPIO 46: level=0 fsel=0 func=INPUT pull=UP GPIO 47: level=0 fsel=0 func=INPUT pull=UP GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK pull=DOWN GPIO 49: level=0 fsel=4 alt=0 func=SD0_CMD pull=DOWN GPIO 50: level=0 fsel=4 alt=0 func=SD0_DAT0 pull=DOWN GPIO 51: level=0 fsel=4 alt=0 func=SD0_DAT1 pull=DOWN GPIO 52: level=0 fsel=4 alt=0 func=SD0_DAT2 pull=DOWN GPIO 53: level=0 fsel=4 alt=0 func=SD0_DAT3 pull=DOWN

Look at GPIO 4,5 for Uart 3 and 8,9 for Uart4

Look at GPIO 34,35,36,37,38,39 is this the Serial Data pins or the SD card interface?

GPIO 34: level=1 fsel=7 alt=3 func=SD1_CLK pull=NONE

GPIO 35: level=1 fsel=7 alt=3 func=SD1_CMD pull=UP

GPIO 36: level=1 fsel=7 alt=3 func=SD1_DAT0 pull=UP

GPIO 37: level=1 fsel=7 alt=3 func=SD1_DAT1 pull=UP

GPIO 38: level=1 fsel=7 alt=3 func=SD1_DAT2 pull=UP

GPIO 39: level=1 fsel=7 alt=3 func=SD1_DAT3 pull=UP


https://www.raspberrypi.com/documentation/computers/configuration.html#uarts-and-device-tree  uarts and device tree  configuration setup


The overlays uart2uart3uart4, and uart5 are used to enable the four additional UARTs on the Raspberry Pi 4. There are other UART-specific overlays in the folder. Refer to /boot/overlays/README for details on Device Tree overlays, or run dtoverlay -h overlay-name for descriptions and usage information.

You add a line to the config.txt file to apply a Device Tree overlay. Note that the -overlay.dts part of the filename is removed. For example:  dtoverlay=disable-bt


https://www.raspberrypi.com/documentation/computers/configuration.html#device-trees-overlays-and-parameters  Device Trees overlays and parameters.

find overlays in ESP EFI /boot/overlays  directory in the FAT32 partition

ivan@raspberrypi:~/Downloads/linux-1.20230405/arch/arm/boot/dts/overlays $ cd /boot/overlays

ivan@raspberrypi:/boot/overlays $ less README

ivan@raspberrypi:/boot/overlays $ mount

/dev/sda2 on / type ext4 (rw,noatime)

devtmpfs on /dev type devtmpfs (rw,relatime,size=3735168k,nr_inodes=933792,mode=755)

proc on /proc type proc (rw,relatime)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)

tmpfs on /run type tmpfs (rw,nosuid,nodev,size=1599760k,nr_inodes=819200,mode=755)

tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)

cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)

pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)

bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)

systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)

mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)

debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)

sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)

tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)

configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)

fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)

/dev/sda1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=799876k,nr_inodes=199969,mode=700,uid=1000,gid=1000)

gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

ivan@raspberrypi:/boot/overlays $ df -h .

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda1       255M   51M  205M  20% /boot

ivan@raspberrypi:/boot/overlays $ 


ivan@raspberrypi:~/Downloads/linux-1.20230405/arch/arm/boot/dts/overlays $ ls -l uart*
-rwxr-xr-x 1 ivan ivan 532 Apr  2 12:37 uart0-overlay.dts
-rw-r--r-- 1 ivan ivan 586 Apr  2 12:37 uart1-overlay.dts
-rw-r--r-- 1 ivan ivan 359 Apr  2 12:37 uart2-overlay.dts
-rw-r--r-- 1 ivan ivan 359 Apr  2 12:37 uart3-overlay.dts
-rw-r--r-- 1 ivan ivan 361 Apr  2 12:37 uart4-overlay.dts
-rw-r--r-- 1 ivan ivan 363 Apr  2 12:37 uart5-overlay.dts
ivan@raspberrypi:~/Downloads/linux-1.20230405/arch/arm/boot/dts/overlays $

 cat uart3-overlay.dts

/dts-v1/;
/plugin/;

/{
compatible = "brcm,bcm2711";

fragment@0 {
target = <&uart3>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart3_pins>;
status = "okay";
};
};

fragment@1 {
target = <&uart3_pins>;
__dormant__ {
brcm,pins = <4 5 6 7>;
brcm,pull = <0 2 2 0>;
};
};

__overrides__ {
ctsrts = <0>,"=1";
};
};

CONFIG.TXT file contents

 cat config.txt
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# setup Serial UART ports like for connecting to a Adafruit GPS device to uart3 at 9600 baud rate
# dtoverlay=uart0
# dtoverlay=uart1
# dtoverlay=uart2
dtoverlay=uart3
# dtoverlay=uart4
# dtoverlay=uart5


# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# Automatically load overlays for detected cameras
camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Disable compensation for displays with overscan
disable_overscan=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[all]

[pi4]
# Run as fast as firmware / board allows
arm_boost=1
[all]

CMDLINE.TXT contents

cat cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=a286e164-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
 

 raspi-gpio get

todo after reboot
fred@raspberrypi:~ $ sudo raspi-gpio get

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for fred: 
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=0 func=INPUT pull=UP
GPIO 1: level=1 fsel=0 func=INPUT pull=UP
GPIO 2: level=1 fsel=0 func=INPUT pull=UP
GPIO 3: level=1 fsel=0 func=INPUT pull=UP
GPIO 4: level=1 fsel=3 alt=4 func=TXD3 pull=NONE
GPIO 5: level=1 fsel=3 alt=4 func=RXD3 pull=UP
GPIO 6: level=1 fsel=0 func=INPUT pull=UP
GPIO 7: level=1 fsel=0 func=INPUT pull=UP
GPIO 8: level=1 fsel=0 func=INPUT pull=UP
GPIO 9: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 10: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 11: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 12: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 13: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 14: level=1 fsel=0 func=INPUT pull=NONE
GPIO 15: level=1 fsel=0 func=INPUT pull=UP
GPIO 16: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 17: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 18: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 19: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 20: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 21: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 22: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 23: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 24: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 25: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 26: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 27: level=0 fsel=0 func=INPUT pull=DOWN
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=2 alt=5 func=RGMII_MDIO pull=UP
GPIO 29: level=0 fsel=2 alt=5 func=RGMII_MDC pull=DOWN
GPIO 30: level=0 fsel=7 alt=3 func=CTS0 pull=UP
GPIO 31: level=0 fsel=7 alt=3 func=RTS0 pull=NONE
GPIO 32: level=1 fsel=7 alt=3 func=TXD0 pull=NONE
GPIO 33: level=1 fsel=7 alt=3 func=RXD0 pull=UP
GPIO 34: level=1 fsel=7 alt=3 func=SD1_CLK pull=NONE
GPIO 35: level=1 fsel=7 alt=3 func=SD1_CMD pull=UP
GPIO 36: level=1 fsel=7 alt=3 func=SD1_DAT0 pull=UP
GPIO 37: level=1 fsel=7 alt=3 func=SD1_DAT1 pull=UP
GPIO 38: level=1 fsel=7 alt=3 func=SD1_DAT2 pull=UP
GPIO 39: level=1 fsel=7 alt=3 func=SD1_DAT3 pull=UP
GPIO 40: level=1 fsel=4 alt=0 func=PWM1_0 pull=NONE
GPIO 41: level=1 fsel=4 alt=0 func=PWM1_1 pull=NONE
GPIO 42: level=0 fsel=1 func=OUTPUT pull=UP
GPIO 43: level=1 fsel=0 func=INPUT pull=UP
GPIO 44: level=1 fsel=0 func=INPUT pull=UP
GPIO 45: level=1 fsel=0 func=INPUT pull=UP
BANK2 (GPIO 46 to 53):
GPIO 46: level=0 fsel=0 func=INPUT pull=UP
GPIO 47: level=0 fsel=0 func=INPUT pull=UP
GPIO 48: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 49: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 50: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 51: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 52: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 53: level=0 fsel=0 func=INPUT pull=DOWN

SEE GPIO4,5   TXD3,RXD3 pin 7,29 


From https://ghostbsd-arm64.blogspot.com/2023/01/multifunction-ports-on-raspberry-pi-4b.html

There are additional UART on the Pi4.

Raspberry Pi4 UART is a more up to date answer.

https://raspberrypi.stackexchange.com/questions/104464/where-are-the-uarts-on-the-raspberry-pi-4/104466#104466

The following summarises the pin usage:-

        TXD RXD CTS RTS     Board Pins
uart0   14  15              8   10
uart1   14  15              8   10
uart2   0   1   2   3       27  28  (I2C)
uart3   4   5   6   7       7   29
uart4   8   9   10  11      24  21  (SPI0)
uart5   12  13  14  15      32  33  (gpio-fan)

https://forums.raspberrypi.com/viewtopic.php?f=107&t=138223  Overlay to remap Pi3 Uart0 and miniuart  Good discussion from 2016 for Pi3, way before Pi4B was created
Engineer PhilE writes about creating overlays to disable BlueTooth use of minuart.

Comments

Popular posts from this blog

HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024

How to install GhostBSD-Arm64 into a USB Flash Drive stick April 24, 2024 update edition.

January 19, 2024 Howto Download a Raspberry Pi 4B bootable image from http://ghostbsdarm64.hopto.org/packages/