2021-01-28 05:32 PM
I want to control defined GPIO in DT in Applicatoin code.
But I can't control this, please let me know how to control gpio with DT in applicatoin.
1) I can control GPIO in Application without DT . (unused at gpioinfo)
2) I can't control GPIO in application with DT, like below.
line 14: unnamed "stm32mp:green:user" output active-low [used]
occurred error massage when running application code
Failed to issue GET LINEHANDLE IOCTL (-25)
Failed to issue GPIOHANDLE_SET_LINE_VALUES_IOCTL (-25)
Failed to issue GPIOHANDLE_SET_LINE_VALUES_IOCTL (-25)
Failed to issue GPIOHANDLE_SET_LINE_VALUES_IOCTL (-25)
reference code
https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_userspace
Device Tree - add green led
led {
compatible = "gpio-leds";
blue {
label = "heartbeat";
gpios = <&gpiod 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
green {
label = "stm32mp:green:user";
gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
default-state = "on";
};
};
2021-02-01 06:08 AM
Hello BKwak.1 (Community Member),
You should care not to mix user space and kernel space. Either you control the GPIO in user space using gpiolib, like it is specified in:https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_userspace
or you modify the DT and you control the GPIO in kernel space.
https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_kernel_space
For the specific gpio-leds driver, you can refer to
https://wiki.st.com/stm32mpu/wiki/How_to_cross-compile_with_the_Developer_Package
Regards,
Olivier
2021-03-18 08:10 AM
Hi, so to be clear - Is there in fact no way to enable a pull-down at the low level, like (preferably) u-boot or kernel device tree, but then be able to control the GPIO from user space as we are now? We forgot an external pull down to a FET and would prefer not to rework it if possible.