-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to change GPIO14&15 to alt5(uart1) #1566
Comments
The UART-handling code in the firmware is quite complex, with a number of different factors to consider. It would help to know if you have set "enable_uart=1" in config.txt. |
enable_uart=1 is not present in my config.txt |
Here is my config.txt: gpu_mem=32 gpio=14=a5,pn dtparam=i2c2_iknowwhatimdoing=on dtparam=audio=off |
Compute Modules prior to CM4 are unusual because they don't have onboard Bluetooth (making UART0 the obvious console UART for GPIOs 14 & 15) but they also allow a UART to be enabled on the higher GPIOs (32 & 33, 40 & 41). For other non-Bluetooth Pis you wouldn't want to enable UART1 on 14 & 15 because UART0 is superior in every respect, but this isn't necessarily true for CM1 & CM3 - as you have shown. The firmware tries to configure its UARTs to match the kernel UART usage by examining the Device Tree, otherwise you can end up with deadlocks when the kernel start. It takes its cues from the DT aliases "serial0" and "serial1". On a CM3, these are set up such that "serial0" points to UART0 and "serial1" points to UART1, where "serial0" is expected to be the console UART on 14 & 15. Based on this, the firmware concludes that it should configure UART0 to be on 14 & 15, overriding your Unfortunately there is currently no convenient way to achieve your perfectly reasonable goal. The options are:
I think option 4 is definitely required, but options 2 and/or 3 are probably also sensible. |
Thank you for your answer. I would also prefer option 4. |
I'm testing a patch for this at the moment. It will be necessary to use something like "dtoverlay=uart1" (or a custom dtb) if you want to enable ttyS0 in the kernel. |
The patch has been merged and will be in future releases. You can download a preview firmware build (just start.elf and fixup.dat) here: https://drive.google.com/file/d/1tquz4DGRZ25qCJMpbaEDhao-wSoPBsEp/view?usp=sharing |
From my point of view FW now works as expected. Thank you for your effort. Can I close this issue? |
Please do! |
See: raspberrypi/linux#4303 kernel: HDMI support for modes that require the scrambler (4k @ 60Hz, most importantly) See: raspberrypi/linux#4302 kernel: overlays: spi-rtc: Add ds3232 and ds3234 See: raspberrypi/linux#4292 firmware: isp: Ensure the VRF is locked when setting up video colour denoise See: raspberrypi/rpicam-apps#19 firmware: isp: Remove custom EV mappings from camera tunings firmware: Add support for board-type=0xXX conditional filters in bootloader, bootcode and firmware firmware: Two UART1 patches See: #1566
See: raspberrypi/linux#4303 kernel: HDMI support for modes that require the scrambler (4k @ 60Hz, most importantly) See: raspberrypi/linux#4302 kernel: overlays: spi-rtc: Add ds3232 and ds3234 See: raspberrypi/linux#4292 firmware: isp: Ensure the VRF is locked when setting up video colour denoise See: raspberrypi/rpicam-apps#19 firmware: isp: Remove custom EV mappings from camera tunings firmware: Add support for board-type=0xXX conditional filters in bootloader, bootcode and firmware firmware: Two UART1 patches See: raspberrypi/firmware#1566
This fix is now in latest rpi-update firmware. |
I am unable to set GPIO14&15 to alt5(uart1) in config.txt using:
gpio=14=a5=pn
gpio=15=a5=pu
after reboot pins are set as alt0:
GPIO 14: level=1 fsel=4 alt=0 func=TXD0
GPIO 15: level=1 fsel=4 alt=0 func=RXD0
I would expect to see GPIO14&15 set to alt5.
If I commnet out:
#gpio=14=a5=pn
#gpio=15=a5=pu
pins are set as input (witch is ok - that's defaut state)
GPIO 14: level=0 fsel=0 func=INPUT
GPIO 15: level=0 fsel=0 func=INPUT
board type: CM3+
vcgencmd version:
Mar 26 2021 16:34:43
Copyright (c) 2012 Broadcom
version edf2e9c318863999c97c50cdb74eee235ede3af5 (clean) (release) (start)
uname -a:
Linux raspberrypi 4.19.127-v7 #1 SMP Tue Oct 20 16:21:29 CEST 2020 armv7l GNU/Linux
The text was updated successfully, but these errors were encountered: