This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: two uart consoles at a time

Part Number: AM5728

how to enable two consoles in am5728 has already one console is working using uart3 i want one more console to enable. plz i need it if any one is having idea

Thanks&regards

Rajkumar

  • Hi Rajkumar,

    Are you using custom board or is it a TI EVM? TI EVM has only one UART instance connected to UART port on AM5728 IDK so it won't be possible to use two UART instances simultaneously.

    Can you provide more details on what is the use case here?, we will be able to give more pointed suggestions with that information.

    Regards,
    Parth

  • we are using custom board and the use case is we need two consoles so that the one console is required for reading input in to the board and one more console is for sending data output.

  • Hi Rajkumar,

    You can write two custom UART_stdioinit APIs one for input and one for output which creates two global UART_handles (one for each instance). You can take reference of UART_stdioinit.c at PDK\packages\ti\drv\uart\src\UART_stdio.c. This will initialize two UART instances and then you have to modify the UART_printf and UART_scanf to use these two handles for UART input and output.

    Regards,
    Parth  

  • I am a beginner. please could you explain in detail if possible

  • Hi Raj Kumar,

    Apologies for delay in response.

    Please try the following steps:
    1) Refer to UART_stdioInit API in PDK\packages\ti\drv\uart\src\UART_stdio.c.
    UART_stdioInit basically initializes the UART instance to use for console operations and also initializes UART_Stdio_Object.
    You need to create two UART_Stdio_Object 1) uart_stdio_read, 2)uart_stdio_write



    2) Write two more API's similar to UART_stdioInit - (UART_stdioInitRead and UART_stdioInitWrite) to initialize uart_stdio_read and uart_stdio_write.

    3) Modify Board_uartStdioInit in PDK\ti\board\src\idkAM572x\idkAM572x_lld_init.c to call UART_stdioInitRead and UART_stdioInitWrite with respective instances instead of UART_stdioInit.

    4) Modify uart_console_getc and uart_console_putc in PDK\packages\ti\drv\uart\src\UART_stdio.c to pass respective read and write handles to UART_write and UART_readPolling.

    Regards,
    Parth

  • thanks parth

    for the response

    I think that this modifications are related to rtos sdk

    but we are not using  ti-processor-sdk-rtos-am57xx-evm-06.03.00.106.we are using ti-processor-sdk-linux-am57xx-evm-04.01.00.06

    so could you help regarding ti-processor-sdk-linux-am57xx-evm-04.01.00.06 sdk

    and we also used patch file given in this fourm

    /cfs-file/__key/communityserver-discussions-components-files/791/7838.0001_2D00_AM57xx_2D00_Change_2D00_U_2D00_Boot_2D00_console_2D00_to_2D00_UART9.patch

    here is the code:-

    From 40c726ffd98ea57d1b28ec4ff8a2719ff1dac896 Mon Sep 17 00:00:00 2001
    From: "Kemal R. Shakir" <kemal@ti.com>
    Date: Tue, 4 Dec 2018 10:45:16 +0200
    Subject: [PATCH 1/1] AM57xx: Change U-Boot console to UART9

    ---
     arch/arm/dts/am57xx-beagle-x15-common.dtsi | 6 +++++-
     arch/arm/dts/am57xx-idk-common.dtsi        | 6 +++++-
     arch/arm/dts/omap5-u-boot.dtsi             | 2 +-
     arch/arm/include/asm/omap_common.h         | 4 ++++
     arch/arm/mach-omap2/clocks-common.c        | 2 +-
     arch/arm/mach-omap2/omap5/prcm-regs.c      | 5 +++++
     6 files changed, 21 insertions(+), 4 deletions(-)

    diff --git a/arch/arm/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/dts/am57xx-beagle-x15-common.dtsi
    index 49aeecd312..498f9f1d6a 100644
    --- a/arch/arm/dts/am57xx-beagle-x15-common.dtsi
    +++ b/arch/arm/dts/am57xx-beagle-x15-common.dtsi
    @@ -24,7 +24,7 @@
         };
     
         chosen {
    -        stdout-path = &uart3;
    +        stdout-path = &uart9;
         };
     
         memory@0 {
    @@ -398,6 +398,10 @@
                       <&dra7_pmx_core 0x3f8>;
     };
     
    +&uart9 {
    +    status = "okay";
    +};
    +
     &davinci_mdio {
         phy0: ethernet-phy@1 {
             reg = <1>;
    diff --git a/arch/arm/dts/am57xx-idk-common.dtsi b/arch/arm/dts/am57xx-idk-common.dtsi
    index fa5a078b27..1074d3d533 100644
    --- a/arch/arm/dts/am57xx-idk-common.dtsi
    +++ b/arch/arm/dts/am57xx-idk-common.dtsi
    @@ -15,7 +15,7 @@
         };
     
         chosen {
    -        stdout-path = &uart3;
    +        stdout-path = &uart9;
         };
     
         vmain: fixedregulator-vmain {
    @@ -361,6 +361,10 @@
                        &dra7_pmx_core 0x248>;
     };
     
    +&uart9 {
    +    status = "okay";
    +};
    +
     &rtc {
         status = "okay";
         ext-clk-src;
    diff --git a/arch/arm/dts/omap5-u-boot.dtsi b/arch/arm/dts/omap5-u-boot.dtsi
    index a6a7801a4b..7d4fbec59e 100644
    --- a/arch/arm/dts/omap5-u-boot.dtsi
    +++ b/arch/arm/dts/omap5-u-boot.dtsi
    @@ -34,7 +34,7 @@
         reg-shift = <2>;
     };
     
    -&uart3 {
    +&uart9 {
         u-boot,dm-spl;
         reg-shift = <2>;
     };
    diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
    index 5710136e88..06d32b8850 100644
    --- a/arch/arm/include/asm/omap_common.h
    +++ b/arch/arm/include/asm/omap_common.h
    @@ -284,6 +284,10 @@ struct prcm_regs {
         u32 cm_l4per_i2c5_clkctrl;
         u32 cm_l4per_uart5_clkctrl;
         u32 cm_l4per_uart6_clkctrl;
    +    u32 cm_l4per_uart7_clkctrl;
    +    u32 cm_l4per_uart8_clkctrl;
    +    u32 cm_l4per_uart9_clkctrl;
    +    u32 cm_l4per_uart10_clkctrl;
         u32 cm_l4sec_clkstctrl;
         u32 cm_l4sec_staticdep;
         u32 cm_l4sec_dynamicdep;
    diff --git a/arch/arm/mach-omap2/clocks-common.c b/arch/arm/mach-omap2/clocks-common.c
    index 93c4c6fe33..0846a4a4c7 100644
    --- a/arch/arm/mach-omap2/clocks-common.c
    +++ b/arch/arm/mach-omap2/clocks-common.c
    @@ -805,7 +805,7 @@ static void setup_clocks_for_console(void)
                 MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN <<
                 MODULE_CLKCTRL_MODULEMODE_SHIFT);
     
    -    clrsetbits_le32((*prcm)->cm_l4per_uart3_clkctrl,
    +    clrsetbits_le32((*prcm)->cm_l4per_uart9_clkctrl,
                 MODULE_CLKCTRL_MODULEMODE_MASK,
                 MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN <<
                 MODULE_CLKCTRL_MODULEMODE_SHIFT);
    diff --git a/arch/arm/mach-omap2/omap5/prcm-regs.c b/arch/arm/mach-omap2/omap5/prcm-regs.c
    index b5f1d700fd..01540e4450 100644
    --- a/arch/arm/mach-omap2/omap5/prcm-regs.c
    +++ b/arch/arm/mach-omap2/omap5/prcm-regs.c
    @@ -970,6 +970,11 @@ struct prcm_regs const dra7xx_prcm = {
         .cm_l4per_uart3_clkctrl            = 0x4a009850,
         .cm_l4per_uart4_clkctrl            = 0x4a009858,
         .cm_l4per_uart5_clkctrl            = 0x4a009870,
    +    .cm_l4per_uart6_clkctrl            = 0x4a005580,
    +    .cm_l4per_uart7_clkctrl            = 0x4a0098d0,
    +    .cm_l4per_uart8_clkctrl            = 0x4a0098e0,
    +    .cm_l4per_uart9_clkctrl            = 0x4a0098e8,
    +    .cm_l4per_uart10_clkctrl        = 0x4ae07880,
         .cm_l4sec_clkstctrl            = 0x4a009880,
         .cm_l4sec_staticdep            = 0x4a009884,
         .cm_l4sec_dynamicdep            = 0x4a009888,
    --

  • Hi Raj,

    Passing this thread to Linux experts. Please expect some delay due to Christmas and New Year's Holidays.

    Regards,
    Parth 

  • Hi Raj,

    Apologies for the long delay in responding. Are you still facing issues?

    What is the need to get logs on 2 console? I mean what is your use case?

    - Keerthy




  • Hi Keerthy,

    Thanks for replying back.still the is not resolved we are trying.

    The need for 2 consoles are we want to send data using 1 uart console and we want to moniter the sent data using another uart console.

    Hopefully I think you got it.if not i will explain it briefly.

    Thanks in Advance Keerthy.

  • The need for 2 consoles are we want to send data using 1 uart console and we want to moniter the sent data using another uart console.

    Raj,


     chosen {
    -        stdout-path = &uart3;
    +        stdout-path = &uart9;
         };

    Here we can choose one console. So uart3 will no longer be able to act as console.

    So it is either uart3 or uart9 right?

    - Keerthy

  • Ok,we are using uart3 at present.can't we able to use two uarts at a time like uart9 along with uart3 for console.

    Thanks in Advance Keerthy...