[iMX8QM-MEK] LPUART2 setting

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

[iMX8QM-MEK] LPUART2 setting

跳至解决方案
2,674 次查看
sushi_happy
Contributor III

Hi, all.

I want to know how to use LPUART2 from coreA.
By default, LPUART2 is assigned to the coreM4, and I think that access is prohibited from the coreA.


I used scfw_tcm.bin which was built by changing the SCFW setting.
・board.c (/imx-scfw-porting-kit-1.12.1/src/scfw_export_mx8qm_b0/platform/board/mx8qm_mek)
- changed the following code.

/* List of pads */
static const sc_pad_t pad_list[6U] =
{
    RM_RANGE(SC_P_M41_I2C0_SCL, SC_P_M41_GPIO0_01),
    // RM_RANGE(SC_P_UART0_CTS_B, SC_P_UART0_RTS_B),
    RM_RANGE(SC_P_FLEXCAN0_RX, SC_P_FLEXCAN2_TX),
    RM_RANGE(SC_P_QSPI0A_DATA0, SC_P_COMP_CTL_GPIO_1V8_3V3_QSPI0)
};

 

Also, I made the following changes.

environment
・Android-11.0.0_2.6.0
・MCIMX8QM-CPU + MCIMX8-8X-BB

changes
・init.rc (/device/nxp/imx8q/mek_8q)
- Added the following code before "on boot".

chmod 0777 /dev/ttyLP2

・imx8qm-mek.dts (/vendor/nxp-opensource/kernel-imx/arch/arm64/boot/dts/freescale)
- changed the following code.

&lpuart2 {
pinctrl-0 = <&pinctrl_lpuart2>;
status = "okay";
};


However, LPUART2 is not enabled.
The ttyLP2 device file is not added.
What other settings do I need?

ttyLP2_ss_2.png

0 项奖励
回复
1 解答
2,478 次查看
sushi_happy
Contributor III


I was able to enable ttyLP2 with the following changes:

1.
Change the boot setting
BoardConfig.mk(/device/nxp/imx8q/mek_8q)
 Added the following code.
    # SELinux
    BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive


init.rc (/device/nxp/imx8q/mek_8q)
 Added the following code before "on boot".
    chmod 0777 /dev/ttyLP2

 

2.
Change the device tree.
imx8qm-mek.dts(vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dts/freescale)
 Changed the following code.
    &lpuart2 {
        pinctrl-0 = <&pinctrl_lpuart2>;
        status = "okay";
    };

imx8qm-mek-rpmsg.dts(vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dts/freescale)
 Changed the following code.
    &lpuart2 {
        status = "okay";
    };

    &uart2_lpcg {
        status = "okay";
    };

 

3.
Remove pin assignment of M4 core
・Base on board-imx8qm.c (vendor/nxp/fsl-property/uboot-firmware/imx8q), change as follows.
    /* Create M4 1 partition */
    if (rm_is_resource_avail(SC_R_M4_1_PID0) != SC_FALSE)
    {
            sc_rm_mr_t mr;

            /* List of resources */
            static const sc_rsrc_t rsrc_list[8U] =
            {
                    SC_R_IRQSTR_M4_1,
//                  SC_R_UART_2,
                    SC_R_MU_6B,
                    SC_R_MU_7B,
                    SC_R_MU_9B,
                    SC_R_GPT_3,
                    RM_RANGE(SC_R_CAN_0, SC_R_CAN_2),
                    SC_R_FSPI_0
             };

            /* List of pads */
             static const sc_pad_t pad_list[6U] =
             {
                    RM_RANGE(SC_P_M41_I2C0_SCL, SC_P_M41_GPIO0_01),
//                  RM_RANGE(SC_P_UART0_CTS_B, SC_P_UART0_RTS_B),
                    RM_RANGE(SC_P_FLEXCAN0_RX, SC_P_FLEXCAN2_TX),
                    RM_RANGE(SC_P_QSPI0A_DATA0, SC_P_COMP_CTL_GPIO_1V8_3V3_QSPI0)
              };
・Build with gcc-toolchain and place the generated binary file in vendor/nxp-opensource/imx-mkimage/iMX8QM.
 Refer:https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/System-Controller-Firmware-101-Getting-s... 
・At this time, change the name of the binary file.
Also, change the code of "scfw-tcm.bin" in the following makefile as above.
(soc.mak, android.mak, autobuild.mak, m4.mak, misc.mak)

在原帖中查看解决方案

0 项奖励
回复
5 回复数
2,479 次查看
sushi_happy
Contributor III


I was able to enable ttyLP2 with the following changes:

1.
Change the boot setting
BoardConfig.mk(/device/nxp/imx8q/mek_8q)
 Added the following code.
    # SELinux
    BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive


init.rc (/device/nxp/imx8q/mek_8q)
 Added the following code before "on boot".
    chmod 0777 /dev/ttyLP2

 

2.
Change the device tree.
imx8qm-mek.dts(vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dts/freescale)
 Changed the following code.
    &lpuart2 {
        pinctrl-0 = <&pinctrl_lpuart2>;
        status = "okay";
    };

imx8qm-mek-rpmsg.dts(vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dts/freescale)
 Changed the following code.
    &lpuart2 {
        status = "okay";
    };

    &uart2_lpcg {
        status = "okay";
    };

 

3.
Remove pin assignment of M4 core
・Base on board-imx8qm.c (vendor/nxp/fsl-property/uboot-firmware/imx8q), change as follows.
    /* Create M4 1 partition */
    if (rm_is_resource_avail(SC_R_M4_1_PID0) != SC_FALSE)
    {
            sc_rm_mr_t mr;

            /* List of resources */
            static const sc_rsrc_t rsrc_list[8U] =
            {
                    SC_R_IRQSTR_M4_1,
//                  SC_R_UART_2,
                    SC_R_MU_6B,
                    SC_R_MU_7B,
                    SC_R_MU_9B,
                    SC_R_GPT_3,
                    RM_RANGE(SC_R_CAN_0, SC_R_CAN_2),
                    SC_R_FSPI_0
             };

            /* List of pads */
             static const sc_pad_t pad_list[6U] =
             {
                    RM_RANGE(SC_P_M41_I2C0_SCL, SC_P_M41_GPIO0_01),
//                  RM_RANGE(SC_P_UART0_CTS_B, SC_P_UART0_RTS_B),
                    RM_RANGE(SC_P_FLEXCAN0_RX, SC_P_FLEXCAN2_TX),
                    RM_RANGE(SC_P_QSPI0A_DATA0, SC_P_COMP_CTL_GPIO_1V8_3V3_QSPI0)
              };
・Build with gcc-toolchain and place the generated binary file in vendor/nxp-opensource/imx-mkimage/iMX8QM.
 Refer:https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/System-Controller-Firmware-101-Getting-s... 
・At this time, change the name of the binary file.
Also, change the code of "scfw-tcm.bin" in the following makefile as above.
(soc.mak, android.mak, autobuild.mak, m4.mak, misc.mak)

0 项奖励
回复
2,645 次查看
joanxie
NXP TechSupport
NXP TechSupport

try to set this in the uboot

setenv console ttyLP2

setenv mmcargs setenv bootargs console=${console},${baudrate} root=${mmcroot}

when board boot up, use command " dmesg | grep -i console", what do you get?

 

0 项奖励
回复
2,634 次查看
sushi_happy
Contributor III

@joanxie 

Is this okay?
ttyLP2 is not registered yet.

uboot_20220822-1.png

uboot_20220822-2.png

0 项奖励
回复
2,614 次查看
joanxie
NXP TechSupport
NXP TechSupport

could you share the logfile with me?

0 项奖励
回复
2,601 次查看
sushi_happy
Contributor III

@joanxie 

I sent you the log file by private message.

Could you please check?

0 项奖励
回复