GPIO access via VS-Code Torizon-Plugin

Hello all =)

im working with the following setup:

  • Verdin AM62 1GB WB IT (V1.1A)
  • Verdin Development Board (V1.1F)
  • Torizon 6
  • Host-System Win 10

I’m just starting with the whole docker and torizon stuff. I’m currently at the point where I have build and flashed a Torizon-Image onto the SOM and can build and deploy a C++ Hello-World application inside a Docker container. I’m also able to toggle the GPIOs via CLI on the target.

The next goal it is to toggle a GPIO via C++ application.

To controll the GPIO I’m using the following tutorials/threads:

I know the Docker container has to get access to the GPIO device, like it’s described in this Docker run command. So I’ve tried to add --device /dev/gpiochip0:/dev/gpiochip0 or --device /dev/gpiochip0 to the auto generated file task.json where the Docker run command is defined, so on execution the access will be granted to the container. Here’s a snipped:

	"label": "build-debug-arm64",
	"detail": "Build a debug version of the application for arm64 using\nthe toolchain from the SDK container.",
    "command": "DOCKER_HOST=",
    "type": "shell",
    "args": [
	"problemMatcher": [
    "icon": {
    	"id": "flame",
        "color": "terminal.ansiYellow"
    "dependsOrder": "sequence",
    "dependsOn": [

The problem is: i get this error message if the Debug process is trying to execute the task:

Executing task: DOCKER_HOST= docker run --rm -it --device /dev/gpiochip0:/dev/gpiochip0 -v /home/buwe/Projekte/Verdin-AM62/Docker/scDockerGPIO:/home/torizon/app cross-toolchain-arm64-sc-docker-gpio make ARCH=arm64 CC=aarch64-linux-gnu-g++ debug 

docker: Error response from daemon: error gathering device information while adding custom device "/dev/gpiochip0": no such file or directory.

The terminal process "/usr/bin/bash '-c', 'DOCKER_HOST= docker run --rm -it --device /dev/gpiochip0:/dev/gpiochip0 -v /home/buwe/Projekte/Verdin-AM62/Docker/scDockerGPIO:/home/torizon/app cross-toolchain-arm64-sc-docker-gpio make ARCH=arm64 CC=aarch64-linux-gnu-g++ debug'" terminated with exit code: 127. 

Can anyone explain what I’m doing wrong? Is the message "/dev/gpiochip0": no such file or directory refering to the host system instead of the target system?

Hopefully I haven’t forgotten any information needed to resolve this issue…
Thank in advance


Hi @buw3 !

Welcome to Toradex Community! :tada:
Feel free to browse around! :smiley:

That’s great! Nice to see that you are covering the basics step-by-step :+1:

That is right, but…

Here is where you mixed up some stuff :sweat_smile:

You added the gpiochip0 device to the docker run of build-debug-arm64, which will launch the build container on the host instead of on the target. For sure this is not what you want: you are sharing a device with the container that doesn’t exists on your computer.

Although it is possible to do it like you are doing, this is not recommended.

In this case, the recommended approach is to edit the docker-compose.yml and add in there the access to the devices you need. You can see we have an example for it in here:

You can find the Docker Compose reference from Docker’s documentation:

And, if I may, there is a very nice Docker Essentials on Udemy which helped me a lot to understand the basics of containerization/Docker and get me up to speed. I am sharing it here with you, so you can learn this stuff faster :wink:

Let us know if you need further help :slight_smile:

Best regards,

Hello @henrique.tx
i really appriciate the fast reply.
You were right, I messed up some stuff, but thanks to your suggetion its working now!

Also thank you for the suggestions to learn more about Docker. I will for sure check it out.

Best regards,

Hi @buw3 !

Great that it helped!

I hope the Udemy course suggestion helps you to grow faster with Docker.

And, as always, you can use this Community to help with your question :wink:

Have a nice day!