2021-06-14 10:27 AM
Hello i wanted to use the GPIOLib to control my pin manualy. so i added this in my device tree.
&usart3 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&usart3_pins_c>;
pinctrl-1 = <&usart3_sleep_pins_c>;
pinctrl-2 = <&usart3_idle_pins_c>;
uart-has-rtscts;
status = "ok";
ethernet {
compatible = "st,stm32_usart_net";
local-mac-address = [ A0 B0 C0 D0 E0 F0 ];
pinctrl-names = "default";
rts-gpios = <&gpioa 11 GPIO_ACTIVE_LOW>;
cts-gpios = <&gpioa 12 GPIO_ACTIVE_LOW>;
};
};
and in my code i wanted to change the pin state like that:
rtsGpio = devm_gpiod_get(&serdev->dev, "rts-gpios", GPIOD_OUT_HIGH);
ssleep(1);
gpiod_set_value(rtsGpio, 1);
but when i look at it the pin is not changing the status. and i get this log message:
gpiod_set_value: invalid GPIO (errorpointer)
2021-06-14 10:37 AM
I tagged this as MPU rather than MCU.
2021-06-15 03:31 AM
Ok thanks fpr it. Is there a way to check if devm_gpiod_get was sucessfull or not?
2021-06-16 05:26 AM
i tried diffent pins but i always get the same result. in my configuration i want to use the pin 3 and 5.
2021-06-25 06:25 AM
Hi @SAman.1 ,
Usage of GPIOLib is to control GPIO from Userspace.
https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_userspace
And here you want to drive a pin which is allocate to usart3 .. which is not possible.
Pin allocate to UART might be drive through UART driver.
What do you want to achieve ?
Olivier