cancel
Showing results for 
Search instead for 
Did you mean: 

cant get the RTS line working on STM32MP1 in linux (stm32mp157c-dk2)

Aurelian Lazarut
Associate III

I configured UART7 and USART3 to work with RTS in linux (for A7) - I generated the DTS and checked to use the correct pins (according to schematics) to make sure are mapped to the Arduino connector (UART7) amd RPI GPIO like connector 

The UART7 & USART3 are getting mapped correctly to /dev/ttySTM1 & /dev/ttySTM2 and work as expected but the RTS line doesn't toggle. 

I wrote a small program which is opening the /dev/ttySTM1 & /dev/ttySTM2 and I'm forcing the RTS line but nothing happens (monitoring the lines with the logic analyzer)

any idea why RTS is not working?

The relevant sections from device tree below

*******

uart7_pins_mx: uart7_mx-0 {

pins1 {

pinmux = <STM32_PINMUX('E', 7, AF7)>; /* UART7_RX */

bias-disable;

};

pins2 {

pinmux = <STM32_PINMUX('E', 8, AF7)>, /* UART7_TX */

<STM32_PINMUX('E', 9, AF7)>; /* UART7_RTS */

bias-disable;

drive-push-pull;

slew-rate = <0>;

};

};

************

usart3_pins_mx: usart3_mx-0 {

pins1 {

pinmux = <STM32_PINMUX('B', 12, AF8)>; /* USART3_RX */

bias-disable;

};

pins2 {

pinmux = <STM32_PINMUX('B', 10, AF7)>, /* USART3_TX */

<STM32_PINMUX('G', 8, AF8)>; /* USART3_RTS */

bias-disable;

drive-push-pull;

slew-rate = <0>;

};

********

1 REPLY 1
Calvin Ageneau
Associate II

Hi Aurelian Lazarut (Adaptive design ltd),

Thanks for sharing your issue.

After some investigation it seems that CubeMx does not generate a proper device tree for usart3 and uart7.

You need to configure the 4 pins of the usart (RX, TX, RTS and CTS) as well as adding the st,hw-flow-ctrl property in the uart configuration.

(example for usart3)

usart3_pins_mx: usart3_mx-0 {

u-boot,dm-pre-reloc;

pins1 {

u-boot,dm-pre-reloc;

pinmux = <STM32_PINMUX('B', 10, AF7)>, /* USART3_TX */

<STM32_PINMUX('G', 8, AF8)>; /* USART3_RTS */

bias-disable;

drive-push-pull;

slew-rate = <0>;

};

pins2 {

u-boot,dm-pre-reloc;

pinmux = <STM32_PINMUX('B', 12, AF8)>, /* USART3_RX */

<STM32_PINMUX('I', 10, AF8)>; /* USART3_CTS_NSS */

bias-disable;

};

};

usart3_sleep_pins_mx: usart3_sleep_mx-0 {

u-boot,dm-pre-reloc;

pins {

u-boot,dm-pre-reloc;

pinmux = <STM32_PINMUX('B', 10, ANALOG)>, /* USART3_TX */

<STM32_PINMUX('B', 12, ANALOG)>, /* USART3_RX */

<STM32_PINMUX('I', 10, ANALOG)>, /* USART3_CTS_NSS */

<STM32_PINMUX('G', 8, ANALOG)>; /* USART3_RTS */

};

};

&usart3{

u-boot,dm-pre-reloc;

pinctrl-names = "default", "sleep";

pinctrl-0 = <&usart3_pins_mx>;

pinctrl-1 = <&usart3_sleep_pins_mx>;

st,hw-flow-ctrl;

status = "okay";

/* USER CODE BEGIN usart3 */

/* USER CODE END usart3 */

};

By adding those I managed to get the RTS line working.

BR,

Calvin