gianc
Posts: 16
Joined: Sun Oct 23, 2016 11:34 am

Strange with raspi-gpio get

Fri Feb 09, 2024 7:12 pm

I have a Raspberry Pi 4 and I need to use all 5 UART ports.
I've modified the config.txt file like this

Code: Select all

dtoverlay=uart2
gpio=0-1=a4
# /dev/ttyAMA3
dtoverlay=uart3
gpio=4-5=a4
# /dev/ttyAMA4
dtoverlay=uart4
gpio=8-9=a4
# /dev/ttyAMA5
dtoverlay=uart5
gpio=12-13=a4
if I check in /dev/, I find all the UARTs,

Code: Select all

pi@Rpi-NVR:~ $ ll /dev/ttyAMA*
crw-rw---- 1 root dialout 204, 64  9 feb 19.34 /dev/ttyAMA0
crw-rw---- 1 root dialout 204, 65  9 feb 19.34 /dev/ttyAMA1
crw-rw---- 1 root dialout 204, 66  9 feb 19.34 /dev/ttyAMA2
crw-rw---- 1 root dialout 204, 67  9 feb 19.34 /dev/ttyAMA3
crw-rw---- 1 root dialout 204, 68  9 feb 19.34 /dev/ttyAMA4
but if I run the command raspi-gpio get 0-15, appear only uart0,uart2, uart3,uart4

Code: Select all

raspi-gpio get 0-15
GPIO 0: level=1 fsel=3 alt=4 func=TXD2 pull=NONE
GPIO 1: level=1 fsel=3 alt=4 func=RXD2 pull=UP
GPIO 2: level=1 fsel=4 alt=0 func=SDA1 pull=UP
GPIO 3: level=1 fsel=4 alt=0 func=SCL1 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=1 fsel=0 func=INPUT pull=NONE
GPIO 13: level=1 fsel=0 func=INPUT pull=UP
GPIO 14: level=1 fsel=4 alt=0 func=TXD0 pull=NONE
GPIO 15: level=1 fsel=4 alt=0 func=RXD0 pull=UP
Do you know why

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 15860
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Strange with raspi-gpio get

Sun Feb 11, 2024 4:47 pm

The uartN overlays already configure the GPIOs, and if required/applicable then the overrides should be applied to the overlays instead of adding gpio= lines
https://github.com/raspberrypi/linux/bl ... 4650-L4720

Most likely something else has been configured and claimed GPIOs 12&13, setting them as inputs in the process.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

gianc
Posts: 16
Joined: Sun Oct 23, 2016 11:34 am

Re: Strange with raspi-gpio get

Mon Feb 12, 2024 3:52 pm

Thank you, readme said:
Name: uart5
Info: Enable uart 5 on GPIOs 12-15. BCM2711 only.
Load: dtoverlay=uart5,<param>
Params: ctsrts Enable CTS/RTS on GPIOs 14-15 (default off)

raspi-gpio funcs 0-20 give me
GPIO, DEFAULT PULL, ALT0, ALT1, ALT2, ALT3, ALT4, ALT5
0, UP, SDA0, SA5, PCLK, SPI3_CE0_N, TXD2, SDA6
1, UP, SCL0, SA4, DE, SPI3_MISO, RXD2, SCL6
2, UP, SDA1, SA3, LCD_VSYNC, SPI3_MOSI, CTS2, SDA3
3, UP, SCL1, SA2, LCD_HSYNC, SPI3_SCLK, RTS2, SCL3
4, UP, GPCLK0, SA1, DPI_D0, SPI4_CE0_N, TXD3, SDA3
5, UP, GPCLK1, SA0, DPI_D1, SPI4_MISO, RXD3, SCL3
6, UP, GPCLK2, SOE_N_SE, DPI_D2, SPI4_MOSI, CTS3, SDA4
7, UP, SPI0_CE1_N, SWE_N_SRW_N, DPI_D3, SPI4_SCLK, RTS3, SCL4
8, UP, SPI0_CE0_N, SD0, DPI_D4, I2CSL_CE_N, TXD4, SDA4
9, DOWN, SPI0_MISO, SD1, DPI_D5, I2CSL_SDI_MISO, RXD4, SCL4
10, DOWN, SPI0_MOSI, SD2, DPI_D6, I2CSL_SDA_MOSI, CTS4, SDA5
11, DOWN, SPI0_SCLK, SD3, DPI_D7, I2CSL_SCL_SCLK, RTS4, SCL5
12, DOWN, PWM0_0, SD4, DPI_D8, SPI5_CE0_N, TXD5, SDA5
13, DOWN, PWM0_1, SD5, DPI_D9, SPI5_MISO, RXD5, SCL5
14, DOWN, TXD0, SD6, DPI_D10, SPI5_MOSI, CTS5, TXD1
15, DOWN, RXD0, SD7, DPI_D11, SPI5_SCLK, RTS5, RXD1
16, DOWN, -, SD8, DPI_D12, CTS0, SPI1_CE2_N, CTS1
17, DOWN, -, SD9, DPI_D13, RTS0, SPI1_CE1_N, RTS1
18, DOWN, PCM_CLK, SD10, DPI_D14, SPI6_CE0_N, SPI1_CE0_N, PWM0_0
19, DOWN, PCM_FS, SD11, DPI_D15, SPI6_MISO, SPI1_MISO, PWM0_1
20, DOWN, PCM_DIN, SD12, DPI_D16, SPI6_MOSI, SPI1_MOSI, GPCLK0

I use gpio15 for rxd0 then rasp-gpio funcs is wrong.
Can I change gpio uart5, your readme link seems not.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 15860
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Strange with raspi-gpio get

Mon Feb 12, 2024 4:25 pm

gianc wrote:
Mon Feb 12, 2024 3:52 pm
Thank you, readme said:
Name: uart5
Info: Enable uart 5 on GPIOs 12-15. BCM2711 only.
Load: dtoverlay=uart5,<param>
Params: ctsrts Enable CTS/RTS on GPIOs 14-15 (default off)

raspi-gpio funcs 0-20 give me
GPIO, DEFAULT PULL, ALT0, ALT1, ALT2, ALT3, ALT4, ALT5
0, UP, SDA0, SA5, PCLK, SPI3_CE0_N, TXD2, SDA6
1, UP, SCL0, SA4, DE, SPI3_MISO, RXD2, SCL6
2, UP, SDA1, SA3, LCD_VSYNC, SPI3_MOSI, CTS2, SDA3
3, UP, SCL1, SA2, LCD_HSYNC, SPI3_SCLK, RTS2, SCL3
4, UP, GPCLK0, SA1, DPI_D0, SPI4_CE0_N, TXD3, SDA3
5, UP, GPCLK1, SA0, DPI_D1, SPI4_MISO, RXD3, SCL3
6, UP, GPCLK2, SOE_N_SE, DPI_D2, SPI4_MOSI, CTS3, SDA4
7, UP, SPI0_CE1_N, SWE_N_SRW_N, DPI_D3, SPI4_SCLK, RTS3, SCL4
8, UP, SPI0_CE0_N, SD0, DPI_D4, I2CSL_CE_N, TXD4, SDA4
9, DOWN, SPI0_MISO, SD1, DPI_D5, I2CSL_SDI_MISO, RXD4, SCL4
10, DOWN, SPI0_MOSI, SD2, DPI_D6, I2CSL_SDA_MOSI, CTS4, SDA5
11, DOWN, SPI0_SCLK, SD3, DPI_D7, I2CSL_SCL_SCLK, RTS4, SCL5
12, DOWN, PWM0_0, SD4, DPI_D8, SPI5_CE0_N, TXD5, SDA5
13, DOWN, PWM0_1, SD5, DPI_D9, SPI5_MISO, RXD5, SCL5
14, DOWN, TXD0, SD6, DPI_D10, SPI5_MOSI, CTS5, TXD1
15, DOWN, RXD0, SD7, DPI_D11, SPI5_SCLK, RTS5, RXD1
16, DOWN, -, SD8, DPI_D12, CTS0, SPI1_CE2_N, CTS1
17, DOWN, -, SD9, DPI_D13, RTS0, SPI1_CE1_N, RTS1
18, DOWN, PCM_CLK, SD10, DPI_D14, SPI6_CE0_N, SPI1_CE0_N, PWM0_0
19, DOWN, PCM_FS, SD11, DPI_D15, SPI6_MISO, SPI1_MISO, PWM0_1
20, DOWN, PCM_DIN, SD12, DPI_D16, SPI6_MOSI, SPI1_MOSI, GPCLK0

I use gpio15 for rxd0 then rasp-gpio funcs is wrong.
Why do you think that?
14, DOWN, TXD0, SD6, DPI_D10, SPI5_MOSI, CTS5, TXD1
15, DOWN, RXD0, SD7, DPI_D11, SPI5_SCLK, RTS5, RXD1
It uses GPIOs 14&15 as CTS and RTS if, and only if, you use "dtoverlay=uart5,ctsrts"
You haven't added the ctsrts override, and as per the readme it defaults to off, therefore 14&15 should be available for other purposes (including as uart0 in your case).
gianc wrote:Can I change gpio uart5, your readme link seems not.
The full pin mapping options are in section 5.3 of https://datasheets.raspberrypi.com/bcm2 ... herals.pdf
No, there are no other exposed pin muxing options for UART5.

Just added "dtoverlay=uart5" to my system

Code: Select all

pi@bookworm64:~ $ raspi-gpio get 12-13
GPIO 12: level=1 alt=4 func=TXD5 pull=NONE
GPIO 13: level=1 alt=4 func=RXD5 pull=UP

Code: Select all

pi@bookworm64:~$ cat /sys/kernel/debug/pinctrl/fe200000.gpio-pinctrl-bcm2711/pinmux-pins 
Pinmux settings per pin
Format: pin (name): mux_owner gpio_owner hog?
...
pin 12 (gpio12): fe201a00.serial (GPIO UNCLAIMED) function alt4 group gpio12
pin 13 (gpio13): fe201a00.serial (GPIO UNCLAIMED) function alt4 group gpio13

Code: Select all

pi@bookworm64:~ $ ls -l  /dev/ttyAMA5
crw-rw---- 1 root dialout 204, 69 Feb 12 16:19 /dev/ttyAMA5
/sys/kernel/debug/pinctrl/fe200000.gpio-pinctrl-bcm2711/pinmux-pins is likely to tell you what else has claimed GPIOs 12&13 on your system, or "sudo vclog -m" would tell you if the firmware has failed to apply the overlay.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

gianc
Posts: 16
Joined: Sun Oct 23, 2016 11:34 am

Re: Strange with raspi-gpio get [solved]

Mon Feb 12, 2024 5:02 pm

Thank you, Thank you, Thank you!! :!:
I did not know vclog
everything is fine

Pinmux settings per pin
.....
pin 12 (gpio12): fe201a00.serial pinctrl-bcm2711:12 function alt4 group gpio12
pin 13 (gpio13): fe201a00.serial pinctrl-bcm2711:13 function alt4 group gpio13

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 15860
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Strange with raspi-gpio get

Mon Feb 12, 2024 5:10 pm

So you have /dev/ttyAMA5, and "raspi-gpio get 12-13" is also reporting alt4 for RXD5/TX5?
I'm confused as to what has changed since your original post.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

gianc
Posts: 16
Joined: Sun Oct 23, 2016 11:34 am

Re: Strange with raspi-gpio get

Mon Feb 12, 2024 6:02 pm

-->So you have /dev/ttyAMA5, and "raspi-gpio get 12-13" is also reporting alt4 for RXD5/TX5?
no, raspi-gpio get 12-13 show
GPIO 12: level=1 fsel=0 func=INPUT pull=NONE
GPIO 13: level=1 fsel=0 func=INPUT pull=UP

but cat /sys/kernel/debug/pinctrl/fe200000.gpio-pinctrl-bcm2711/pinmux-pins |grep serial show
pin 0 (gpio0): fe201400.serial (GPIO UNCLAIMED) function alt4 group gpio0
pin 1 (gpio1): fe201400.serial (GPIO UNCLAIMED) function alt4 group gpio1
pin 4 (gpio4): fe201600.serial (GPIO UNCLAIMED) function alt4 group gpio4
pin 5 (gpio5): fe201600.serial (GPIO UNCLAIMED) function alt4 group gpio5
pin 8 (gpio8): fe201800.serial (GPIO UNCLAIMED) function alt4 group gpio8
pin 9 (gpio9): fe201800.serial (GPIO UNCLAIMED) function alt4 group gpio9
pin 12 (gpio12): fe201a00.serial pinctrl-bcm2711:12 function alt4 group gpio12
pin 13 (gpio13): fe201a00.serial pinctrl-bcm2711:13 function alt4 group gpio13

and vclog -m|grep uart show
005423.027: brfs: File read: /mfs/sd/overlays/uart2.dtbo
005431.340: Loaded overlay 'uart2'
005459.943: brfs: File read: /mfs/sd/overlays/uart3.dtbo
005468.287: Loaded overlay 'uart3'
005496.945: brfs: File read: /mfs/sd/overlays/uart4.dtbo
005505.328: Loaded overlay 'uart4'
005534.041: brfs: File read: /mfs/sd/overlays/uart5.dtbo
005542.463: Loaded overlay 'uart5'

raspi-gpio get is wrong, (I think ...) what do you think?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 15860
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Strange with raspi-gpio get

Mon Feb 12, 2024 6:08 pm

gianc wrote:
Mon Feb 12, 2024 6:02 pm
raspi-gpio get is wrong, (I think ...) what do you think?
raspi-gpio is reading the hardware registers and decoding the pin muxing from those. Unless you have a buggy version of rapsi-gpio from somewhere (and I don't believe one really exists), then I would trust it.

I'd suspect something else is messing with the pin mux setup after the kernel has configured everything, quite likely through the use of raspi-gpio or one of the GPIO libraries that also go direct to the hardware registers.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

gianc
Posts: 16
Joined: Sun Oct 23, 2016 11:34 am

Re: Strange with raspi-gpio get

Mon Feb 12, 2024 6:18 pm

OK, maybe I fiddled with the system a little too much, I'll make a new SD card.
Thanks for your help

Return to “Troubleshooting”