2021-08-12 03:34 AM
I have a DK1 and have wired to UART7, and got UART7 working by grafting this section (by using the CubeMX tool latest version as of a few days ago) into the existing st32mp157d-dk1.dts and rebuilding. (The real product is intended to use UART7.)
===
aliases {
serial0 = &uart4;
serial1 = &usart3;
serial2 = &uart7;
};
uart7 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart7_pins_mx>;
pinctrl-1 = <&uart7_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN uart7 */
/* USER CODE END uart7 */
};
pinctrl {
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_DE */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
uart7_sleep_pins_mx: uart7_sleep_mx-0 {
pins {
pinmux = <STM32_PINMUX('E', 7, ANALOG)>, /* UART7_RX */
<STM32_PINMUX('E', 8, ANALOG)>, /* UART7_TX */
<STM32_PINMUX('E', 9, ANALOG)>; /* UART7_DE */
};
};
};
===
I booted a fresh kernel and this dtb (using the bootm command) and now I have UART7 (on /dev/ttySTM2).
It receives and transmits correctly but DE (PE9) is stuck low (possibly undriven).
In /sys/kernel/debug/pinctrl/soc\:pin-controller\@50002000/pinmux-pins
I see these
===
pin 71 (PE7): device 40018000.serial function af7 group PE7
pin 72 (PE8): device 40018000.serial function af7 group PE8
pin 73 (PE9): UNCLAIMED
===
So
1) What's gone wrong here ? The port works (except for DE) and picctrl says af7. FIXED by shuffling the DTS.
2) What about the DEM bit of the UART7's CR3 ? This is clear (even when the port is open) and needs to be set. Can I set this with with an ioctl from userland (otherwise will just bash the driver in the interests of progress). Found FIXABLE by poking cr3 (during temporarily disabling the port after userland open.)
Thank you.
Jon
2021-08-25 06:40 AM
Hi @JSchn.5 ,
Don't know how to understand "SOLVED more or less" sentence.
Is it a edit update ?
Else looks like property "st,hw-flow-ctrl;" is missing in your UART7 node.
Maybe https://community.st.com/s/question/0D53W0000037Pi0SAE/how-to-enable-hardware-flow-control-rs485 can also give you further hints.
Olivier