Showing results for 
Search instead for 
Did you mean: 

Problem with controlling GPIO



I have a problem with controlling the LED on the stm32mp135f-dk board.


root@techs:~# gpioinfo -c0

gpiochip0 - 16 lines:

 line   0: "PA0"            input

 line   1: "PA1"            input consumer="kernel"

 line   2: "PA2"            input consumer="kernel"

 line   3: "PA3"            input

 line   4: "PA4"            input

 line   5: "PA5"            input

 line   6: "PA6"            input consumer="kernel"

 line   7: "PA7"            input

 line   8: "PA8"            input

 line   9: "PA9"            input

 line  10: "PA10"           input

 line  11: "PA11"           input

 line  12: "PA12"           input consumer="kernel"

 line  13: "PA13"           input active-low bias=pull-up consumer="User-PA13"

 line  14: "PA14"           output active-low consumer="blue:heartbeat"

 line  15: "PA15"           input consumer="kernel"

This is the output of gpioinfo command, which shows the information about the GPIO lines on chip gpiochip0. I want to read the value of line PA13 and write a value to line PA14, which are connected to the LED.

However, when I try to read the value of PA13 using gpioget command, I get an error message:


root@techs:~# gpioget PA13

gpioget: unable to request lines: Device or resource busy

This means that some other process or driver is using this line and preventing me from accessing it. I tried to find out which module could be occupying the line using lsmod command, but I got no output:


root@techs:~# lsmod

Module                  Size  Used by


This suggests that the line is used by a module that is compiled into the kernel and not loaded as a separate module.

I have a similar situation when I try to write a value to PA14 using gpioset command:


root@techs:~# gpioset -c0 PA14=0

gpioset: unable to request lines on chip '/dev/gpiochip0': Device or resource busy

Again, this indicates that the line is already used by another process or driver.

How can I find out which process or driver is using these lines and how can I free them for my own use? Is there a way to disable or override the kernel modules that are using them?

Any help would be appreciated.

ST Employee

Hello @paul.yatsevich ,
As you see, the resource is busy and you cannot have access to a GPIO that is already used by another part of the system.

Let's take the GPIO PA14 for example:
In the device tree stm32mp135f-dk2.dts, you can see the following part:

led-blue {
	color = <LED_COLOR_ID_BLUE>;
	gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
	linux,default-trigger = "heartbeat";
	default-state = "off";

You can remove it from the device tree to release the ownership of the GPIO PA14, then you will be able to set it as you want with the gpioset command.

Kind regards,

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks, Erwan, for the help. However, it is not obvious why the same situation is observed on all other pins?