Forums » Software Development »
AM62x Enable UART2
Added by Tim Troester 19 days ago
Hi,
On the AM62x how do we enable UART2 during the Yocto build? We have created our own machine variation of k3-am62x-mitysom and created a dts file for it per the wiki instructions you provided. We thought we need to add this...
&main_uart2 { pinctrl-names = "default"; pinctrl-0 = <&main_uart2_pins>; status = "okay"; }; main_uart2_pins: main-uart2-pins { pinctrl-single,pins = < AM62X_IOPAD(0x1d4, PIN_OUTPUT, 3) /* (B15) UART2_TXD Console */ AM62X_IOPAD(0x1d0, PIN_INPUT, 3) /* (A15) UART2_RXD Console */ >; };
We also removed those pins from "main_gpio_p3_pins_default" since we muxed them.
It doesn't seem to be working when I cat /proc/tty/driver/serial.
I also see the below error at boot so it may be related.
[ 1.509258] omap8250 2820000.serial: failed to get alias
Any help would be appreciated.
Tim
Replies (6)
RE: AM62x Enable UART2 - Added by Bob Duke 16 days ago
Tim,
What you have shown looks OK. Can you share your entire device tree file ? Nathan has access to our private project if you prefer to post the information there. You could also share your boot log and the output of cat /proc/tty/driver/serial
.
Thanks,
-Bob
RE: AM62x Enable UART2 - Added by Jonathan Cormier 16 days ago
I'm not sure why but it seems like setting the serial alias is required.
8250_omap.c:
ret = of_alias_get_id(np, "serial");
if (ret < 0) {
dev_err(&pdev->dev, "failed to get alias\n");
return ret;
}
There are currently several serial aliases set in the k3-am62x-mitysom-som.dtsi file, I'd recommend skipping a few numbers to prevent conflicts in the future if more serial aliases are added.
aliases { serial0 = &mcu_uart0; serial1 = &wkup_uart0; serial2 = &main_uart0; ...
Example of adding the alias
diff --git a/arch/arm64/boot/dts/ti/k3-am62x-mitysom-devkit.dts b/arch/arm64/boot/dts/ti/k3-am62x-mitysom-devkit.dts
index 229f95f7c292..d900051e56c1 100644
--- a/arch/arm64/boot/dts/ti/k3-am62x-mitysom-devkit.dts
+++ b/arch/arm64/boot/dts/ti/k3-am62x-mitysom-devkit.dts
@@ -10,6 +10,10 @@
#include "k3-am62x-mitysom-som.dtsi"
/ {
+ aliases {
+ serial10 = &main_uart2;
+ };
+
vcc_12v: vcc_12v {
Then the port will show up as ttyS10 since we set the alias to serial5
root@mitysom-am62x:~# dmesg | grep serial [ 1.476861] 2800000.serial: ttyS2 at MMIO 0x2800000 (irq = 238, base_baud = 3000000) is a 8250 [ 1.507633] 2820000.serial: ttyS10 at MMIO 0x2820000 (irq = 240, base_baud = 3000000) is a 8250
RE: AM62x Enable UART2 - Added by Tim Troester 16 days ago
Bob,
Thanks for the response. I was getting ready to reply saying that I was able to get it working. Here is what I did in case it helps others.
- Removed the previous mapping of the pins we wanted to use for UART2. There were being muxed as GPIO pins.
AM62X_IOPAD(0x01d0, PIN_INPUT_PULLDOWN, 7) /* (A15) UART0_CTSn.GPIO1_22 */AM62X_IOPAD(0x01d4, PIN_INPUT_PULLDOWN, 7) /* (B15) UART0_RTSn.GPIO1_23 */ - Muxed the pins to be part of UART2.
main_uart2_pins: main-uart2-pins { pinctrl-single,pins = < AM62X_IOPAD(0x1d4, PIN_OUTPUT, 3) /* (B15) UART2_TXD Console */ AM62X_IOPAD(0x1d0, PIN_INPUT, 3) /* (A15) UART2_RXD Console */ >; };
- Altered main_uart2 to use the pins that were repurposed and to enable it.
&main_uart2 { pinctrl-names = "default"; pinctrl-0 = <&main_uart2_pins>; status = "okay"; };
- Added an alias for uart2 (this is what I missing in my original question). This serial port will now be at /dev/ttyS4 (I would have used "serial2" but it was being used by something else).
&{/} { aliases { serial4 = &main_uart2; }; };
RE: AM62x Enable UART2 - Added by Tim Troester 16 days ago
Jonathan,
Thanks for the additional info. I didn't see your response before I submitted mine. However, it looks like we are on the same page with the solution.
Tim
RE: AM62x Enable UART2 - Added by Jonathan Cormier 9 days ago
Note to capture some of this information, we made a wiki page for it. https://support.criticallink.com/redmine/projects/mitysom_am62x/wiki/Example_-_uart2_Serial_CONSOLE