GPIO export on linux - Invalid argument

I’m trying to blink an LED connected to the GPIO pins of my Dragonboard, on linux.
I logged as root by sudo -i, entered the /sys/class/gpio folder, and did “echo 938 > export”, to access my LED which is on the pin 23.
The command doesn’t work and the output is "-bash: echo: write error: Invalid argument

Is the command wrong? How can I access the pins? Thanks.


The 938 looks wrong for Linux. I think it is only Android that has the high offset numbers. You might want to have a look at David Mandala’s very good blog where he does a similar experiment to what you are looking to do:

There is also a further blog by David where he talks about the different libraries for accessing the GPIO’s:

Hope that helps move things forward for you.



Thanks for your answer, I followed these guides but while the output seems to be sent to the GPIOs (which I can see by doing cat value), my LED won’t get on/off. Is there a different offset value for the pins on Linux? What am I missing?

Well that is progress! :slight_smile:

Are you sure the circuit is right for the LED? I got caught out by the fact that the GPIO on the Dragonboard is only 1.8v. Depending what type of LED you have there might not be enough voltage to light the LED.

I ended up doing an experiment to demonstrate this:

Hi Barry,
Thanks :slight_smile: I’m using a red LED so it should be working. It lights up when I put it on the pin36 for example. But I’m still unable to light it on the GPIO pins.

OK, seems like I’m not helping at this point…

Just wanted to check one thing about your reply for my own sanity. I’m not exactly sure what you are referring to when you say ‘pin36’ and ‘GPIO pins’

Here is a useful diagram that I use as reference.

Seems like connector pin 35 would be the pin to test that your LED is working with 1.8v. and the GPIO 36 for testing the commands.

Just to confirm, you are using “echo 36 > export”? What about “cd gpio36; echo out > direction”?

@barryb With the LED on the pin 35 the result is the same, the LED doesn’t light on.

@vchong Yes. I’m doing:

sudo -i
cd /sys/class/gpio
echo echo 35 > export
cd gpio35
echo out > direction
echo 1 > value

Any idea?

The pin number is not the same as the gpio number. Pin23 is gpio36 for db410c linux, so you need to first connect the negative(-) leg of the LED to ground. Then connect the positive(+) leg of your LED to pin 23, that is, based on barryb’s pinout (, the 12th hole from the top on the inside column (the column towards the inside of the board).

Then do:

sudo -i
cd /sys/class/gpio
echo 36 > export
cd gpio36
echo out > direction
echo 1 > value

Hi @greenh,

I don’t have a DB410c in front of me at the moment but I think the voltage is higher than 1.8v on connector pin 36.

It seems to me that if your LED doesn’t work on connector pin 35 then it isn’t going to work on GPIO 35 (connector pin 31).

@vchong I have done that and didn’t get any error message but my red LED still won’t light on…

Then as barryb said you might want to check the voltage rating of your LED to make sure you have one that works with 1.8v. Or if you have a multimeter you can maybe try to measure the voltage on the pin to see if it goes up and down when you set the gpio value to 1 and 0. Or maybe try one of the mezzanine boards ( that has built-in level shifters to give you 3.3 or 5v, but obviously it will cost more than an LED.

Thanks. I’ll try to measure the voltages once I find a multimeter, or look for another LED :slight_smile:

It doesn’t work for me.
sudo -i
cd /sys/class/gpio
echo 36 > export

It replies with
-bash: echo: write error: Invalid argument

For the dragonboard 410c, the values that we see in examples should be changed by adding an offet of 390.
To get the correct value, you can check with midnight commander (sudo apt install mc).
Midnight commander is a very convenient file manager on the console. It works fine on the Dragonboard.
On the command line:
cd /sys/class/gpio
cd gpiochip390
cat ngpio
It gives 122, the other 2 chips give 4.
cat base
It gives 390

So all the old docs should be converted:
user led 1 | 69 | 411
user led 2 | 69 | 510
user led 3 | 69 | 1 + 382 OR 386 (UNTESTED)
user led 4 | 69 | 2 + 382 OR 386 (UNTESTED)

D410c | Mezz | GPIO | OLD | NEW
J8.23 | G1.1 | GPIO A | 36 | 426
J8.24 | G1.2 | GPIO B | 12 | 402
J8.25 | (NA) | GPIO C | 13 | 403
J8.26 | (NA) | GPIO D | 69 | 459
J8.27 | G2.1 | GPIO E | 115 | 505
J8.28 | G2.2 | GPIO F | 4 | 4 + 382 OR 386 (UNTESTED)
J8.29 | G3.1 | GPIO G | 24 | 414
J8.30 | G3.2 | GPIO H | 25 | 415
J8.31 | G4.1 | GPIO I | 35 | 425
J8.32 | G4.2 | GPIO J | 34 | 424
J8.33 | G5.1 | GPIO K | 28 | 418
J8.34 | G5.2 | GPIO L | 33 | 423