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.

Linux/AM5749: Dtb -How to add Uart2

Other Parts Discussed in Thread: AM5749

Hello

I use ti-processor-sdk-linux-am57xx-evm-06.03.00.106 on am5749 (custom board).

I would like to turn on Uart2...

So I checked kernel config:  CONFIG_SERIAL_8250=y

then I should to add DT code but I don't know where exactly maybe here: am57xx-idk-common.dtsi ???

I saw: https://software-dl.ti.com/processor-sdk-linux/esd/docs/06_03_00_106/linux/Foundational_Components/Kernel/Kernel_Drivers/UART.html?highlight=uart

But it is not good example...From k3-j721e-main.dtsi

I tryed to use pinmux configurator like analogy with CAN but I didnt see some code in devicetree.txt

BR,

Oleg

  • Hi Oleg,

    The base file arch/arm/boot/dts/dra7.dtsi already has the alias serial1 = &uart2;

    The device tree node:

    uart2: serial@4806c000 {
    compatible = "ti,dra742-uart", "ti,omap4-uart";
    reg = <0x4806c000 0x100>;
    interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
    ti,hwmods = "uart2";
    clock-frequency = <48000000>;
    status = "disabled";
    dmas = <&sdma_xbar 51>, <&sdma_xbar 52>;
    dma-names = "tx", "rx";
    };

    The status is set to disabled. So we need to set that to okay.

    Something similar to uart3 enabling in "arch/arm/boot/dts/am57xx-idk-common.dtsi":

    &uart3 {
    status = "okay";
    interrupts-extended = <&crossbar_mpu GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH
    &dra7_pmx_core 0x248>;
    };

    What is the usage of uart2 in your case? Do you want it to be used as the console UART?

    Best Regards,
    Keerthy

  • Hello Keerthy,

    Thank you so much I will check it ...I would like to use it for RS422 transceiver

    1.I open am57xx-idk-common.dtsi and I have a qustion for what is it:

    chosen {
            stdout-path = &uart3;
        };


    Is it for debug console out?

    2.

    &uart3 {
    status = "okay";
    interrupts-extended = <&crossbar_mpu GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH  <- this one  will be same for all UARTS???
    &dra7_pmx_core 0x248>; <-this one will be same too...???
    };

    3.Like analogy between can interface. I tryed to do it throught pinmux but I didn't see some code in devicetree.txt

    4. I add it:

            serial@4806c000 {
                compatible = "ti,dra742-uart", "ti,omap4-uart";
                reg = <0x4806c000 0x100>;
                interrupts = <0x0 0x44 0x4>;
                ti,hwmods = "uart2";
                clock-frequency = <0x2dc6c00>;
                status = "okay";
                dmas = <0x8d 0x33 0x8d 0x34>;
                dma-names = "tx", "rx";
                interrupts-extended = <0x1 0x0 0x44 0x4 0x8e 0x3f0>;
            };

    5. Should I add?? :

    uart2_pins_default: uart2_pins_default {
              pinctrl-single,pins = <
                   DRA7XX_CORE_IOPAD(0x37f0, (PIN_INPUT_PULLUP | MUX_MODE4)) /* uart2_rxd.uart2_rxd */
                   DRA7XX_CORE_IOPAD(0x37f4, (PIN_INPUT_PULLUP | MUX_MODE4)) /* uart2_txd.uart2_txd */
               >;
         };

    6. Should I turn on something else in mux_data.h ???

    I think it is doesn't work.

    But I don't know how to check my Uart2 throught echo comand for example.

    Please guide me step by step.

    BR,

    Oleg

  •  Hi Oleg,

    I tried that myself on my am574x-idk board. The schematics bring out 2 instances of UARTs on the USB port. UART3 as debug UART &
    the other instances is for JTAG. So if you are using AM574x-IDK or a custom board similar to AM574x-IDK
    we cannot use uart2 instance. Apologies for the late reply.



     RS485 is not directly compatible with RS422 that you plan to use it for. Hope you can resolve this.

    Best Regards,
    Keerthy

  • Hi Keerthy,

    I didn't understand your answer.....

    Acctually it doesn't matter what exactly  Installed on my custom board Rs-422 or RS485 both connected to UART2 (D26, D28 PINS).

    The Problem Is: it is doesn't work...I can't understend why I can't use it and why it doesn't work....

    I need Your help with right configuration in device tree...

    If I am right my uart2 it is ttyS1...but I am not sure...No one doesn't work except uart3.

    root@am57xx-evm:~# echo "hello" > /dev/ttyS1
    -sh: echo: write error: Input/output error

    Best Regards,

    Oleg

  • Oleg,

    diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
    index 8022cec49b..27b90332d1 100644
    --- a/arch/arm/boot/dts/dra7.dtsi
    +++ b/arch/arm/boot/dts/dra7.dtsi
    @@ -628,7 +628,7 @@
                            interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
                            ti,hwmods = "uart2";
                            clock-frequency = <48000000>;
    -                       status = "disabled";
    +                       status = "okay";
                            dmas = <&sdma_xbar 51>, <&sdma_xbar 52>;
                            dma-names = "tx", "rx";
                    };

    The above should get echo "hello" > /dev/ttyS1 work but i am not sure how you plan to use it.

    Best Regards,
    Keerthy

  • Keerthy,

    I add status = "okay";

    I recompile DT and load my board but when I try to use: echo "hello" > /dev/ttyS1 I see this one error:

    am57xx-evm login: root
    root@am57xx-evm:~# echo "hello" > /dev/ttyS1
    -sh: echo: write error: Input/output error

    Best Regards,

    Oleg

  • root@am57xx-evm:~#
    root@am57xx-evm:~# ls -l /dev/ttyS1
    crw-rw----    1 root     dialout     4,  65 Sep 30 09:51 /dev/ttyS1

  • Hello Keerthy,
    I have localized the problem, but I don’t know how to fix it...the problem is in bootloader.
    Keerthy I have 2 bootloaders. Previous programmer give me this one bootloader and Uart work here without problem.
    And I have onether one which I builded from SDK and used right memory configuration Emif toool. But here uart doesn't work and I find some strange things with dcan2, it is doesen't work here too...
    Obviously the bootloader is the problem. But since I do not have the source codes for one loader, I cannot compare them with the second one and understand what exactly was changed.
    What changes could have resulted in such consequences? It is possible that I missed something when assembling and configuring the bootloader....
    I will give you both...Could you check it please???
    BR,
    Oleg
  • Hi Oleg,

    Sorry i do not understand the changes. I believe we cannot support this as UART2 cannot be used on AM5749
    and i have no way to reproduce this. Hope you understand.

    Best Regards,
    Keerthy

  • Hello Keerthy,

    Why do you think so...What reason? Why can't I use UART2 on am5749? If UART2 is absent on EVM, then this is not a reason to say that it cannot be used just because it cannot be checked on EVM.

    BR,

    Oleg

  • Hi Oleg,

    As replied here: 

    If you need further confirmation i can loop in a hardware expert.

    Best Regards,
    Keerthy

  • Hi Keerthy,

    Yes I need ...it is will be great

    Best Regards,

    Oleg

  • Oleg,

    Can you help us with your custom board schematic where you have brought out the UART2?
    On am574x-idk as you know UART2 can not be used. I want to know if that is done differently
    on your custom board so that it can be used on your custom board? Can you show
    us how it is being brought out on your custom board?

    Best Regards,
    Keerthy

  • HI Keerthy,

    Of course I can. Sorry I should have done this before ....
    Best Regards,
    Oleg
  • Hi Oleg,

    Thanks for sharing the schematics snapshot. I got the checked from our hardware expert who has acknowledged that it is fine.

    All i did was:

     git diff arch/arm/boot/dts/dra7.dtsi
    diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
    index 8022cec49b..27b90332d1 100644
    --- a/arch/arm/boot/dts/dra7.dtsi
    +++ b/arch/arm/boot/dts/dra7.dtsi
    @@ -628,7 +628,7 @@
                            interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
                            ti,hwmods = "uart2";
                            clock-frequency = <48000000>;
    -                       status = "disabled";
    +                       status = "okay";
                            dmas = <&sdma_xbar 51>, <&sdma_xbar 52>;
                            dma-names = "tx", "rx";

    For me with the above change: echo "hello" > /dev/ttyS1 works.

    I can not test beyond this as my am574x-idk does not have the lines brought out.

    Best Regards,
    Keerthy