2021-10-11 06:23 AM
Hi All,
i have my own board based on STM32MP157C.
I connected usart1 (tx, rx, cts, rts) to Wifi/Ble module and i still got the same error:
stm32-usart: probe of 5c000000.serial failed with error -22
I discovered that USART1 is a secure device so i need to know ho to enable it into my dts.
Thanks in advance
2021-10-15 07:19 AM
Hi @IDe P.1
The USART1 is a secure instance (under ETZPC control) as explained here: https://wiki.st.com/stm32mpu/wiki/USART_internal_peripheral#Security_support
That means that the USART1 can be configured as Secure, but also as a non secure device.
You can also find in the same wiki page, the peripheral assignment array: https://wiki.st.com/stm32mpu/wiki/USART_internal_peripheral#Peripheral_assignment
Which confirms that the USART1 can be assigned to Secure or non-secure world.
Did you use CubeMx to add the USART1 to your project?
Please, can you provide me the DT (Device Tree) of your TF-A, the one with the etzpc peripheral.
Regards,
Kevin
2021-10-15 09:00 AM
Hi Kevin,
thank's a lot for your reply.
I fixed the usart1 issue but not 100%.
On my own board usart1 is configured as below:
PZ6 is RX
PZ7 is TX
PA11 is CTS
PA12 is RTS
At the moment i made the override of pinctr_z and USART1 is probed but i'm not able to configure flowctrl because PA11 and PA12 are under another node (pinctrl).
I attached my dts (NOT TF-A).
Where I can find the DT with etzpc peripheral? I'm using buildroot....
Regards,
Ilie
2021-10-19 09:27 AM
Hello @IDe P.1 ,
In buildroot, I do not know, but I asks some people and I come back to you.
Regarding your problem, I tried to do the same things as you, but on my STM32MP157F-DK2 and I think I didn't encounter issue.
For enabling the usart1, I used CubeMx V6.3.0 and I enabled the hardware flow control for RS232.
CubeMx automatically made all the configurations except the aliases part below.
In my linux DT, I assigned the USART1 to serial1 like you:
aliases{
ethernet0 = ðernet0;
serial0 = &uart4;
serial1 = &usart1;
};
By default, CubeMx set the pin RTS to PA12
usart1_pins_mx: usart1_mx-0 {
pins {
pinmux = <STM32_PINMUX('A', 12, AF7)>; /* USART1_RTS */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
usart1_sleep_pins_mx: usart1_sleep_mx-0 {
pins {
pinmux = <STM32_PINMUX('A', 12, ANALOG)>; /* USART1_RTS */
};
};
The RX to PZ1, TX to PZ2 and CTS to PZ3, as shown in the datasheet page 106: https://www.st.com/resource/en/datasheet/stm32mp157c.pdf
usart1_pins_z_mx: usart1_mx-0 {
pins1 {
pinmux = <STM32_PINMUX('Z', 1, AF7)>, /* USART1_RX */
<STM32_PINMUX('Z', 3, AF7)>; /* USART1_CTS */
bias-disable;
};
pins2 {
pinmux = <STM32_PINMUX('Z', 2, AF7)>; /* USART1_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
usart1_sleep_pins_z_mx: usart1_sleep_mx-0 {
pins {
pinmux = <STM32_PINMUX('Z', 1, ANALOG)>, /* USART1_RX */
<STM32_PINMUX('Z', 2, ANALOG)>, /* USART1_TX */
<STM32_PINMUX('Z', 3, ANALOG)>; /* USART1_CTS */
};
};
Then we put the usart1 to "okay":
&usart1{
pinctrl-names = "default", "sleep";
pinctrl-0 = <&usart1_pins_mx &usart1_pins_z_mx>;
pinctrl-1 = <&usart1_sleep_pins_mx &usart1_sleep_pins_z_mx>;
status = "okay";
/* USER CODE BEGIN usart1 */
/* USER CODE END usart1 */
};
When the DK2 board boots, we see that the usart1 is probed and linked to ttySTM1
2.905086] stm32-usart 5c000000.serial: interrupt mode for rx (no dma)
[ 2.910322] stm32-usart 5c000000.serial: interrupt mode for tx (no dma)
[ 2.916952] 5c000000.serial: ttySTM1 at MMIO 0x5c000000 (irq = 63, base_baud = 4164062) is a stm32-usart
Then since I am with the standard board STM32MP157F-DK2, I can't test the hardware flow control with a RS232 for the moment, so I checked at least it was well enabled.
I followed this page: https://wiki.st.com/stm32mpu/wiki/How_to_use_TTY_with_User_Terminal#Change_serial_port_configuration_-28with_stty_tool-29
And when I run the command to display the configuration of the usart1, with a grep on the hardware flow control option
root@stm32mp1-disco:~# stty -a -F /dev/ttySTM1 | grep crtscts
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
The port has the option crtscts, so normally the hardware flow control must be functional.
I didn't encounter issue due to PA11, PA12, but since I'm on a DK2, I will test again on an eval board tomorrow. Because your DTS is for an eval board.
If you have an issue due to PA11, PA12, you can use other pins for the USART1.
For instance, I used
PZ1 to RX
PZ2 to TX
PZ3 to CTS
PA12 to RTS
So I advice you to look at the datasheet and set another pin if PA11 and PA12 are already used. Because you can also use PZ5 for the RTS and PZ3 for CTS
Please if you need more help, can you detail what means "i'm not able to configure flowctrl because PA11 and PA12 are under another node (pinctrl).", do you have an error?
And please provide me
Hope it helps!
Regards,
Kévin
2021-10-22 07:02 AM
Hi Kevin,
Thanks a lot, it works!!!!!!!!
Have a nice day.
Ilie
Ilie De Peccati
Technical office – Software dept.
2021-10-25 12:13 AM
Hi @IDe P.1
You're welcome. Please can you edit your post to remove all the email thread.
Regards,
Kevin
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'