-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4924
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
New "gpio" config.txt command announcement
This topic is for discussion of and questions about the announcement of the new "gpio" config.txt command, which can be found here.
Re: New "gpio" config.txt command announcement
gpio readall doesnot behave as it used to when running PI3B+ under 2018-3-13. Is there a problem ? I have posted this question earlier in Beginners before I found this announcement.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4924
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: New "gpio" config.txt command announcement
The error message is fairly clear:
```
Oops - unable to determine board type... model: 13
```
gpio is part of the WiringPi package maintained by Gordon Henderson (gordon@drogon.net). He needs to add the type for 3B+ (13) to the list - I'll ping him an email.
But that is nothing to do with this announcement, which is about a new config.txt setting.
```
Oops - unable to determine board type... model: 13
```
gpio is part of the WiringPi package maintained by Gordon Henderson (gordon@drogon.net). He needs to add the type for 3B+ (13) to the list - I'll ping him an email.
But that is nothing to do with this announcement, which is about a new config.txt setting.
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6394
- Joined: Fri Jul 29, 2011 5:36 pm
Re: New "gpio" config.txt command announcement
He has updated it, we just don't have it in apt yet.PhilE wrote: ↑Thu Mar 22, 2018 5:26 pmThe error message is fairly clear:
```
Oops - unable to determine board type... model: 13
```
gpio is part of the WiringPi package maintained by Gordon Henderson (gordon@drogon.net). He needs to add the type for 3B+ (13) to the list - I'll ping him an email.
But that is nothing to do with this announcement, which is about a new config.txt setting.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4924
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: New "gpio" config.txt command announcement
Unsurprisingly, Gordon has already updated WiringPi - it's just the the Raspbian packages haven't picked up the latest build (2.46). You can download directly from drogon.net like this:
I'll redirect my ping to ShiftPlusOne to pull in the update.
Code: Select all
cd /tmp
wget https://unicorn.drogon.net/wiringpi-2.46-1.deb
sudo dpkg -i wiringpi-2.46-1.deb
- DougieLawson
- Posts: 42379
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: New "gpio" config.txt command announcement
How do we avoid your gpio command conflicting with Gordon's (long time) existing gpio command? It appears you've missed the clashing of names or is it a copy of his code with new function?
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: New "gpio" config.txt command announcement
From the announcement; "the syntax is based on the raspi-gpio utility"
Can someone provide a link to where that is described for those of us not familiar with raspi-gpio. I Googled but what I found seemed to have a very different syntax to the examples shown in the announcement.
I don't know how relevant what it is based on is so it might be best not to even mention that, just describe the syntax used.
Can someone provide a link to where that is described for those of us not familiar with raspi-gpio. I Googled but what I found seemed to have a very different syntax to the examples shown in the announcement.
I don't know how relevant what it is based on is so it might be best not to even mention that, just describe the syntax used.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4924
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: New "gpio" config.txt command announcement
@DougieLawson Read the post (or even just the bit you quoted) - it is a config.txt setting.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4924
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: New "gpio" config.txt command announcement
Code: Select all
pi@raspberrypi:~ $ raspi-gpio help
WARNING! raspi-gpio set writes directly to the GPIO control registers
ignoring whatever else may be using them (such as Linux drivers) -
it is designed as a debug tool, only use it if you know what you
are doing and at your own risk!
The raspi-gpio tool is designed to help hack / debug BCM283x GPIO.
Running raspi-gpio with the help argument prints this help.
raspi-gpio can get and print the state of a GPIO (or all GPIOs)
and can be used to set the function, pulls and value of a GPIO.
raspi-gpio must be run as root.
Use:
raspi-gpio get [GPIO]
OR
raspi-gpio set <GPIO> [options]
OR
raspi-gpio funcs [GPIO]
OR
raspi-gpio raw
GPIO is a comma-separated list of pin numbers or ranges (without spaces),
e.g. 4 or 18-21 or 7,9-11
Note that omitting [GPIO] from raspi-gpio get prints all GPIOs.
raspi-gpio funcs will dump all the possible GPIO alt funcions in CSV format
or if [GPIO] is specified the alternate funcs just for that specific GPIO.
Valid [options] for raspi-gpio set are:
ip set GPIO as input
op set GPIO as output
a0-a5 set GPIO to alternate function alt0-alt5
pu set GPIO in-pad pull up
pd set GPIO pin-pad pull down
pn set GPIO pull none (no pull)
dh set GPIO to drive to high (1) level (only valid if set to be an output)
dl set GPIO to drive low (0) level (only valid if set to be an output)
Examples:
raspi-gpio get Prints state of all GPIOs one per line
raspi-gpio get 20 Prints state of GPIO20
raspi-gpio get 20,21 Prints state of GPIO20 and GPIO21
raspi-gpio set 20 a5 Set GPIO20 to ALT5 function (GPCLK0)
raspi-gpio set 20 pu Enable GPIO20 ~50k in-pad pull up
raspi-gpio set 20 pd Enable GPIO20 ~50k in-pad pull down
raspi-gpio set 20 op Set GPIO20 to be an output
raspi-gpio set 20 dl Set GPIO20 to output low/zero (must already be set as an output)
raspi-gpio set 20 ip pd Set GPIO20 to input with pull down
raspi-gpio set 35 a0 pu Set GPIO35 to ALT0 function (SPI_CE1_N) with pull up
raspi-gpio set 20 op pn dh Set GPIO20 to ouput with no pull and driving high
- DougieLawson
- Posts: 42379
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: New "gpio" config.txt command announcement
So it's not a "gpio" command, it's new function in your "raspi-gpio" command. Which really isn't clear from what you've written (unless you're applying Humpty Dumpty's rules).
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4924
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: New "gpio" config.txt command announcement
Really?So it's not a "gpio" command, it's new function in your "raspi-gpio" command. Which really isn't clear from what you've written (unless you're applying Humpty Dumpty's rules).
New "gpio" config.txt command announcementThe latest firmware - build date 21/03/18 or later - includes a new config.txt commandThe "gpio" command respects the "[...]" section headers in config.txt,
- DougieLawson
- Posts: 42379
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: New "gpio" config.txt command announcement
It's NOT a "command" it's a "keyword with operands" in config.txt. In my vocabulary a "command" is usually a program in /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin or /usr/local/sbin that runs from a command line.
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4924
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: New "gpio" config.txt command announcement
It is interpreted and acted upon as it is encounted, as opposed to simply setting a flag for use layer, so I think the word command is reasonable and reflects the imperative nature. I considered the word directive, but that's a bit highbrow.
This is turning into a bikeshed discussion.
This is turning into a bikeshed discussion.
Re: New "gpio" config.txt command announcement
It looks like a new gpio command modelled on an existing raspi-gpio shell command, but the new one applies only in config.txt.DougieLawson wrote: ↑Thu Mar 22, 2018 5:50 pmSo it's not a "gpio" command, it's new function in your "raspi-gpio" command. Which really isn't clear from what you've written (unless you're applying Humpty Dumpty's rules).
So this sets pullup on GPIO20 from command prompt or script file:
Code: Select all
raspi-gpio set 20 pu
Code: Select all
gpio set 20 pu
Re: New "gpio" config.txt command announcement
From the announcement ...
"np - No pull"
From raspi-gpio help ...
"pn set GPIO pull none (no pull)"
"np - No pull"
From raspi-gpio help ...
"pn set GPIO pull none (no pull)"
Re: New "gpio" config.txt command announcement
My reading of the announcment is the last should be as follows when in config.txt ...PiGraham wrote: ↑Thu Mar 22, 2018 6:07 pmSo this sets pullup on GPIO20 from command prompt or script file:
And this will do the same thing from config.txt at boot:Code: Select all
raspi-gpio set 20 pu
I think that's what it means.Code: Select all
gpio set 20 pu
Code: Select all
gpio=20=pu
Re: New "gpio" config.txt command announcement
You seem to be correct on both counts.hippy wrote: ↑Thu Mar 22, 2018 6:10 pmMy reading of the announcment is the last should be as follows when in config.txt ...PiGraham wrote: ↑Thu Mar 22, 2018 6:07 pmSo this sets pullup on GPIO20 from command prompt or script file:
And this will do the same thing from config.txt at boot:Code: Select all
raspi-gpio set 20 pu
I think that's what it means.Code: Select all
gpio set 20 pu
I think that perhaps the reference to raspi-gpio has got everyone confused.Code: Select all
gpio=20=pu

Re: New "gpio" config.txt command announcement
Does anyone actually have anything useful to say on this cool new feature?
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.
Working in the Applications Team.
Re: New "gpio" config.txt command announcement
Re: New "gpio" config.txt command announcement
This is great!
We’re a step closer to not needing custom device tree blobs in our compute module application now
Any chance you can do something for camera (dual) configuration in a similar style?
We’re a step closer to not needing custom device tree blobs in our compute module application now

Any chance you can do something for camera (dual) configuration in a similar style?
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4924
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: New "gpio" config.txt command announcement
By that you mean add the ability to assign a pin number to one of the named roles - CAMERA_0_SDA_PIN etc.? The plumbing internally is likely to be the hardest part, but I can take a look.Any chance you can do something for camera (dual) configuration in a similar style?
Re: New "gpio" config.txt command announcement
Will this, or has it already, be back-ported into Jessie? Thanks!
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6394
- Joined: Fri Jul 29, 2011 5:36 pm
Re: New "gpio" config.txt command announcement
What reads the config.txt and sets the GPIO pins? bootcode.bin, start.elf or is it passed to the kernel?
Basically is this config.txt option available to those who don't use Linux.
Basically is this config.txt option available to those who don't use Linux.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges
Raspberries are not Apples or Oranges
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 4924
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: New "gpio" config.txt command announcement
It's handled by start.elf and its variants, so the mechanism should be usable with any operating system that doesn't overwrite the pin states at boot time.