[iMX8QM-MEK] LPUART2 setting

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

[iMX8QM-MEK] LPUART2 setting

ソリューションへジャンプ
2,524件の閲覧回数
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

ラベル(2)
0 件の賞賛
返信
1 解決策
2,328件の閲覧回数
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,329件の閲覧回数
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,495件の閲覧回数
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,484件の閲覧回数
sushi_happy
Contributor III

@joanxie 

Is this okay?
ttyLP2 is not registered yet.

uboot_20220822-1.png

uboot_20220822-2.png

0 件の賞賛
返信
2,464件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

could you share the logfile with me?

0 件の賞賛
返信
2,451件の閲覧回数
sushi_happy
Contributor III

@joanxie 

I sent you the log file by private message.

Could you please check?

0 件の賞賛
返信