UART4 as a debug (console) for the main OS

Hello Everyone,
The HW and SW are as follows:

Apalis 4GB iMX8QM WB IT V1.1 C
IXORA V1.2A
Host OS: Ubuntu 20.04 LTS

I am trying to make UART4:ttyLP2 (X27 Header on Ixora carrier board) a debug (console) for the main OS. (Instead of UART1:ttyLP1)

So I have found a related post here:

I have done the following changes:
In board/toradex/apalis-imx8/apalis-imx8.c (u-boot-toradex)

  static iomux_cfg_t uart2_pads[] = {
          SC_P_UART2_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
          SC_P_UART2_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
  };
  /*
  static void setup_iomux_uart(void)
  {
          imx8_iomux_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
  }
  */
  
  static void setup_iomux_uart(void)
  {
         imx8_iomux_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads));
  }


 int board_early_init_f(void)
 {
.....
          ret = sc_pm_setup_uart(SC_R_UART_2, rate);
          if (ret)
                  return ret;
}

In arch/arm/dts/fsl-imx8qm-apalis.dts (u-boot-toradex)

 /*
          chosen {
                  bootargs = "console=ttyLP1,115200 earlycon=lpuart32,0x5a070000,115200";
                  stdout-path = &lpuart1;
          };
  */
           chosen {
                   bootargs = "console=ttyLP2,9600 earlycon=lp        uart32,0x5a080000,9600";
                    stdout-path = &lpuart2;
           };

It is not working. Could you please provide further details?

Thank you.

Hello Everyone,

I am able to get the U-boot Boot-up log on UART4 (lpuar2 / ttyLP2). But, Kernel does not startup.

Port /dev/ttyUSB0, 21:07:43
Press CTRL-A Z for help on special keys
MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC… OK
In: serial
Out: serial
Err: serial
Model: Toradex Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT V1.1C, Serial# 06980587
BuildInfo:
SCFW 99e479ce, SECO-FW 2f7f6f59, IMX-MKIMAGE 8947fea3, ATF 835a8f6
U-Boot 2020.04-5.6.0-devel+git.f12ce3b69a53
switch to partitions #0, OK
mmc0(part 0) is current device
flash target is MMC:0
Net: eth0: ethernet@5b040000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1…
166807 bytes read in 43 ms (3.7 MiB/s)
MMC: no card present
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1…
Found U-Boot script /boot.scr
5754 bytes read in 24 ms (233.4 KiB/s)
## Executing script at 83100000
** Bad device specification ${boot_devtype} ${boot_devnum} **
** Bad device specification ${boot_devtype} ${boot_devnum} **
Loading hdp firmware from 0x000000009c000000 offset 0x0000000000002000
Loading hdp firmware Complete
Loading DeviceTree: imx8qm-apalis-v1.1-eval.dtb
166807 bytes read in 25 ms (6.4 MiB/s)
43 bytes read in 19 ms (2 KiB/s)
Applying Overlay: apalis-imx8_hdmi_overlay.dtbo
2177 bytes read in 26 ms (81.1 KiB/s)
10258646 bytes read in 323 ms (30.3 MiB/s)
Uncompressed size: 24201728 = 0x1714A00
Bootargs: pci=nomsi root=PARTUUID=ad87ffb0-02 ro rootwait
## Flattened Device Tree blob at 83000000
Booting using the fdt blob at 0x83000000
Loading Device Tree to 00000000fd601000, end 00000000fd64cfff … OK
Starting kernel …

The patch applied can be found here
0001-apalis-imx8-use-uart4-as-debug.patch (1.9 KB)

I have checked no same signal/pin is being used anywhere.
Can you suggest what is missing?

Best Regards,
Salman

Hi!

But, Kernel does not startup.

I’m not familiar with the UART side of the BSP, so its just an idea, but based on the patch file, maybe you’re only changing the U-Boot output to UART4, and possibly the kernel still outputs to UART3? So it starts, but you cannot see the output?

Sincerely,
Csongor

Hello Csongor,

Thank you for your response.
I am building tdx-reference-minimal-image which does have a desktop environment that outputs on the connected HDMI device. However, I am not able to see it when I apply the UART patch. So, I suppose the Kernel refuses to start. I have tried disabling some of the devices from the device tree, but still Kernel doesn’t start.

Anyone from Toradex who can give me direction?

Best Regards,
Salman

Hi @Salman ,

Sorry for the delay.

Could you please explain, based on your use-case, why you need to change the default Linux debug UART?

Best regards,

Hello Henrique,

Since I have access to UART header to USB cable only, I would like to use UART4. Basically, working on TTL level, and I do not have UART header to RS232, null modem and RS232 to USB connectors.

Best Regards,
Salman

Hi @Salman !

It is highly recommended to have an RS232-USB cable to be able to access the default debug console of the module. An Apalis Evaluation board might come in hand as well, as it exposes the debug console in TTL levels as well as USB-B type.

Are you able to get output from Linux debug console? The information from it are of great importance to solve your issues.

Besides Uboot modifications, have you made any other modifications?

By default the reference minimal image does not have a desktop environment. Maybe you are using Multimedia Image?

Just to be sure: you were able to get image from HDMI before applying your patch, right? After applying it, there is no more image from HDMI, right? How are you debugging it if you do not have access to the debug console?

Also, although the desktop environment is not coming up, have you tested if the module is accessible via SSH?

Best regards,