View unanswered posts | View active topics It is currently Wed Jun 19, 2019 1:19 am



Reply to topic  [ 6 posts ] 
 How to use UART2 and UART3 as console ports? 
Author Message

Joined: Fri Oct 14, 2011 6:37 am
Posts: 17
Post How to use UART2 and UART3 as console ports?
I've been trying to get the UART2 and UART3 serial ports to work (via TS-Debugger board), without any luck. It looked like all I should need to do is instantiate devices and configure the pin mux. I tried making the kernel changes below to do this. The devices now appear to be enumerated as expected at boot time, but I'm still unable to receive any output over the RS-232 cable (which works fine when connected to UART1).

Any ideas as to what I am doing wrong?

UPDATE: I realized that I could simplify the patch. Updated diff and dmesg output below.

Code:
root@trimslice:~# dmesg | grep 8250
[    0.611359] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.864693] serial8250.0: ttyS0 at MMIO 0x70006000 (irq = 68) is a XScale
[    1.964628] serial8250.0: ttyS1 at MMIO 0x70006040 (irq = 69) is a XScale
[    2.024618] serial8250.0: ttyS2 at MMIO 0x70006200 (irq = 78) is a XScale

Code:
diff --git a/arch/arm/mach-tegra/board-trimslice-pinmux.c b/arch/arm/mach-tegra/board-trimslice-pinmux.c
index cc6d522..9c8ffcf 100644
--- a/arch/arm/mach-tegra/board-trimslice-pinmux.c
+++ b/arch/arm/mach-tegra/board-trimslice-pinmux.c
@@ -54,8 +54,8 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = {
   {TEGRA_PINGROUP_GPV,   TEGRA_MUX_PCIE,          TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
   {TEGRA_PINGROUP_HDINT, TEGRA_MUX_HDMI,          TEGRA_PUPD_PULL_UP,     TEGRA_TRI_NORMAL},
   {TEGRA_PINGROUP_I2CP,  TEGRA_MUX_I2C,           TEGRA_PUPD_NORMAL,      TEGRA_TRI_TRISTATE},
-   {TEGRA_PINGROUP_IRRX,  TEGRA_MUX_UARTB,         TEGRA_PUPD_PULL_UP,     TEGRA_TRI_TRISTATE},
-   {TEGRA_PINGROUP_IRTX,  TEGRA_MUX_UARTB,         TEGRA_PUPD_PULL_UP,     TEGRA_TRI_TRISTATE},
+   {TEGRA_PINGROUP_IRRX,  TEGRA_MUX_UARTB,         TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
+   {TEGRA_PINGROUP_IRTX,  TEGRA_MUX_UARTB,         TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
   {TEGRA_PINGROUP_KBCA,  TEGRA_MUX_KBC,           TEGRA_PUPD_PULL_UP,     TEGRA_TRI_TRISTATE},
   {TEGRA_PINGROUP_KBCB,  TEGRA_MUX_KBC,           TEGRA_PUPD_PULL_UP,     TEGRA_TRI_TRISTATE},
   {TEGRA_PINGROUP_KBCC,  TEGRA_MUX_KBC,           TEGRA_PUPD_PULL_UP,     TEGRA_TRI_TRISTATE},
@@ -127,9 +127,9 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = {
   {TEGRA_PINGROUP_UAA,   TEGRA_MUX_ULPI,          TEGRA_PUPD_PULL_UP,     TEGRA_TRI_NORMAL},
   {TEGRA_PINGROUP_UAB,   TEGRA_MUX_ULPI,          TEGRA_PUPD_PULL_UP,     TEGRA_TRI_NORMAL},
   {TEGRA_PINGROUP_UAC,   TEGRA_MUX_RSVD2,         TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
-   {TEGRA_PINGROUP_UAD,   TEGRA_MUX_IRDA,          TEGRA_PUPD_PULL_UP,     TEGRA_TRI_TRISTATE},
-   {TEGRA_PINGROUP_UCA,   TEGRA_MUX_UARTC,         TEGRA_PUPD_PULL_UP,     TEGRA_TRI_TRISTATE},
-   {TEGRA_PINGROUP_UCB,   TEGRA_MUX_UARTC,         TEGRA_PUPD_PULL_UP,     TEGRA_TRI_TRISTATE},
+   {TEGRA_PINGROUP_UAD,   TEGRA_MUX_IRDA,          TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
+   {TEGRA_PINGROUP_UCA,   TEGRA_MUX_UARTC,         TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
+   {TEGRA_PINGROUP_UCB,   TEGRA_MUX_UARTC,         TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
   {TEGRA_PINGROUP_UDA,   TEGRA_MUX_ULPI,          TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
   {TEGRA_PINGROUP_CK32,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
   {TEGRA_PINGROUP_DDRC,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index 7e45b60..b113120 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -68,6 +68,22 @@ static struct plat_serial8250_port debug_uart_platform_data[] = {
      .regshift   = 2,
      .uartclk   = 216000000,
   }, {
+      .membase   = IO_ADDRESS(TEGRA_UARTB_BASE),
+      .mapbase   = TEGRA_UARTB_BASE,
+      .irq      = INT_UARTB,
+      .flags      = UPF_BOOT_AUTOCONF,
+      .iotype      = UPIO_MEM,
+      .regshift   = 2,
+      .uartclk   = 216000000,
+   }, {
+      .membase   = IO_ADDRESS(TEGRA_UARTC_BASE),
+      .mapbase   = TEGRA_UARTC_BASE,
+      .irq      = INT_UARTC,
+      .flags      = UPF_BOOT_AUTOCONF,
+      .iotype      = UPIO_MEM,
+      .regshift   = 2,
+      .uartclk   = 216000000,
+   }, {
      .flags      = 0
   }
};
@@ -79,6 +95,7 @@ static struct platform_device debug_uart = {
      .platform_data   = debug_uart_platform_data,
   },
};
+
static struct tegra_sdhci_platform_data sdhci_pdata1 = {
   .cd_gpio   = -1,
   .wp_gpio   = -1,
@@ -276,6 +293,8 @@ static void __init tegra_trimslice_fixup(struct machine_desc *desc,
static __initdata struct tegra_clk_init_table trimslice_clk_init_table[] = {
   /* name      parent      rate      enabled */
   { "uarta",   "pll_p",   216000000,   true },
+   { "uartb",   "pll_p",   216000000,   true },
+   { "uartc",   "pll_p",   216000000,   true },
   { "pll_p",   "clk_m",   216000000,   true },
   { "pll_p_out1",   "pll_p",   28800000,   true },
   { "pll_a",   "pll_p_out1",   56448000,   true },


Last edited by crm114 on Fri Jan 13, 2012 8:22 am, edited 1 time in total.



Tue Jan 10, 2012 12:45 pm
Profile
Site Admin

Joined: Sun Mar 13, 2011 11:52 am
Posts: 390
Post Re: How to use UART2 and UART3 as console ports?
An important clarification: the current Trim-Slice version supports only the UART port on the TS debugger - not the RS232 ports. The UART ports (TTL voltage levels) are available through headers P29 and P28. RS232 connectors P4 and P3 can not be used with the current Trim-Slice.

_________________
---------------------------
Igor Vaisbein
Utilite Product Manager

---------------------------


Wed Jan 11, 2012 3:48 pm
Profile

Joined: Fri Oct 14, 2011 6:37 am
Posts: 17
Post Re: How to use UART2 and UART3 as console ports?
Ah, thanks for the clarification. Could you elaborate on this? Is it just because the TS doesn't supply 3.3V on P19 connector pin 9? I hadn't noticed that before. In theory, should it work if I supplied 3.3V through pin 2 of the P29 and/or P28 header, or is there something else that would prevent it? Is P19 pin 9 a no-connect on the TS side?

This partly explains what I was seeing, then. The logic analyzer shows that UART3_TXD, UART3_nRTS, and UART2_nRTS are working as expected. However, UART2_TXD is always stuck low. I'm not sure what is causing that. I thought that maybe I needed to change the pull-up/down configuration for the pins back to TEGRA_PUPD_PULL_UP, but that didn't seem to help--what is correct pull-up configuration for the UART pins?

Thanks again!


Thu Jan 12, 2012 7:15 am
Profile
Site Admin

Joined: Sun Mar 13, 2011 11:52 am
Posts: 390
Post Re: How to use UART2 and UART3 as console ports?
Your analysis is absolutely correct. Pin 9 on the TS FPC connector was originally intended for another purpose, so it does not supply the VDD_3V3 voltage. If you connect an external voltage source to pin 9 on connector P20 it should work. You can connect the GND of the voltage source to pin 10 on P20. Pin 9 on P19 is connected to one of the Tegra GPIOs, so there's going to be a contention on that pin, but it should not affect functionality.

I do not think that the pull-up configuration matters to the UART pins as they are actively driven. At any rate you can use the same configuration as used for UART1. It is worth checking whether the problem is specifically with UART2_TXD or all of UART2 pins do not work properly.
If the problem is not pin specific, it is more likely that the configuration problem applies to the whole UART2 group.

I've discussed your code with our kernel engineer and it looks fine. Once you localize the problem, I'll ask the SW people to take a deeper look into the config code.

_________________
---------------------------
Igor Vaisbein
Utilite Product Manager

---------------------------


Thu Jan 12, 2012 10:13 am
Profile

Joined: Fri Oct 14, 2011 6:37 am
Posts: 17
Post Re: How to use UART2 and UART3 as console ports?
Awesome. Thanks for your help!

I updated the patch above after realizing that I could simplify it.

I figured out the problem with UART2_TXD. I had noticed that this is the edge conductor on the ribbon cable; I was worried that I had damaged the cable when installing it, since I had to crimp one edge in order to route it through the micro-SD slot when re-installing the case. I re-opened the case tonight and inspected the cable. Sure enough, I had accidentally stripped away some insulation on the UART2_TXD line, so it was making contact with the metal case. Fortunately, the conductor wasn't broken, so I just put a bit of tape over the area and re-installed the case.

That seemed to do the trick. I have verified that all of the TXD/RXD lines are now working by wiring up a crossover connection between UART2 and UART3. I was able to log in on ttyS1 via ttyS2 by running the commands below. I didn't check RTS/CTS but I expect that those are also working.

Code:
sudo sh -c '/sbin/agetty -8 -L 115200 /dev/ttyS1 &'
cu -115200 -l ttyS2


Fri Jan 13, 2012 10:06 am
Profile
Site Admin

Joined: Sun Mar 13, 2011 11:52 am
Posts: 390
Post Re: How to use UART2 and UART3 as console ports?
I am glad to hear that you managed to get it working.
Let me know if you need any help.

_________________
---------------------------
Igor Vaisbein
Utilite Product Manager

---------------------------


Fri Jan 13, 2012 3:14 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.