JuanGomez
JuanGomez

Reputation: 35

How to add UART support for DTS and compile it for STM32MP157F-DK2

I created a custom linux image for this target using the distribution package + x-linux-qt and the image "st-image-qt". This image is working correctly on my target.

Now, I want to add UART5 and UART4 to receive data over those 2 serial ports. As far as I understand, I need to add something like this in the DTS

&usart4 {
        pinctrl-names = "default", "sleep", "idle";/* pin configurations definition */
        pinctrl-0 = <&usart4_pins_a>; /* default pin configuration selection */
        pinctrl-1 = <&usart4_sleep_pins_a>; /* sleep pin configuration selection */
        pinctrl-2 = <&usart4_idle_pins_a>; /* idle pin configuration selection */
        status = "okay";

};

and something like this in the DTSI

   usart3_pins_a: usart3-0 {
            pins1 {
                    pinmux = <STM32_PINMUX('B', 10, AF7)>, /* USART3_TX */
                             <STM32_PINMUX('G', 8, AF8)>; /* USART3_RTS */
                    bias-disable;
                    drive-push-pull;
                    slew-rate = <0>;
            };
            pins2 {
                    pinmux = <STM32_PINMUX('B', 12, AF8)>, /* USART3_RX */
                             <STM32_PINMUX('I', 10, AF8)>; /* USART3_CTS_NSS */
                    bias-disable;
            };
    };

    usart3_idle_pins_a: usart3-idle-0 {
            pins1 {
                    pinmux = <STM32_PINMUX('B', 10, ANALOG)>, /* USART3_TX */
                             <STM32_PINMUX('G', 8, ANALOG)>, /* USART3_RTS */
                             <STM32_PINMUX('I', 10, ANALOG)>; /* USART3_CTS_NSS */
            };
            pins2 {
                    pinmux = <STM32_PINMUX('B', 12, AF8)>; /* USART3_RX */
                    bias-disable;
            };
    };

    usart3_sleep_pins_a: usart3-sleep-0 {
            pins {
                    pinmux = <STM32_PINMUX('B', 10, ANALOG)>, /* USART3_TX */
                             <STM32_PINMUX('G', 8, ANALOG)>, /* USART3_RTS */
                             <STM32_PINMUX('I', 10, ANALOG)>, /* USART3_CTS_NSS */
                             <STM32_PINMUX('B', 12, ANALOG)>; /* USART3_RX */
            };
    };

My question is, should I override these files in my tmp-glibc/work-shared folder? or do I need to create new ones in my custom layer?

There's so much different paths and different documentation that I don't really understand which one should I be using

Upvotes: 0

Views: 55

Answers (0)

Related Questions