Page 1 of 1

Conditional config.txt

Posted: Mon Apr 23, 2018 11:29 pm
by procount
Is there a conditional setting in config.txt to isolate settings for the pi3B+ ?

https://www.raspberrypi.org/documentati ... itional.md only mentions the following:

[pi1]
[pi2]
[pi3]
[pi0]

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 7:27 am
by DougieLawson
I'm fairly sure James Hughes (JamesH on here) from RP(T)Ltd said there was some support for conditional stanzas in /boot/config.txt for the RPi3B+ but I can't find it (Google wasn't being my friend today).

The master copy of the documentation is at: https://github.com/raspberrypi/document ... itional.md

So your, best option is to open an issue at: https://github.com/raspberrypi/documentation/issues

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 7:52 am
by RaTTuS
or for temp stuff use
the serial number stuff .... i.e.
[0x12345678]

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 8:03 am
by DougieLawson
RaTTuS wrote:
Tue Apr 24, 2018 7:52 am
or for temp stuff use
the serial number stuff .... i.e.
[0x12345678]
I use that for all fifteen Raspberries. It means I can boot any Raspberry from any SDCard with my unified config.txt.

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 8:56 am
by 6by9
[pi0w] and [pi3+] both exist - yet more documentation updates required.
Looking at the code it appears you can also filter based on the state of a gpio using [gpio<num>=[0|1]], eg [gpio4=1]. One to confirm with dom and also document. (That could be really useful for switching between boot configs on a CM. Hmm).

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 9:32 am
by DougieLawson
6by9 wrote:
Tue Apr 24, 2018 8:56 am
[pi0w] and [pi3+] both exist - yet more documentation updates required.
Looking at the code it appears you can also filter based on the state of a gpio using [gpio<num>=[0|1]], eg [gpio4=1]. One to confirm with dom and also document. (That could be really useful for switching between boot configs on a CM. Hmm).
Thanks Dave. The [gpio?=0|1] looks amusing, could that be used to detect whether a camera is attached? I assume it doesn't have to be a GPIO that's externalised to the 40-pin header.

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 9:59 am
by procount
Thanks all.
Looks like [pi3+] is the one I want in order to ensure the reduced frequency stability settings are set for the 3B+ (in the general case, not for a specific serial number), whilst not affecting other Pi models.
I've added a github issue: https://github.com/raspberrypi/documentation/issues/892

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 10:05 am
by 6by9
DougieLawson wrote:
Tue Apr 24, 2018 9:32 am
6by9 wrote:
Tue Apr 24, 2018 8:56 am
[pi0w] and [pi3+] both exist - yet more documentation updates required.
Looking at the code it appears you can also filter based on the state of a gpio using [gpio<num>=[0|1]], eg [gpio4=1]. One to confirm with dom and also document. (That could be really useful for switching between boot configs on a CM. Hmm).
Thanks Dave. The [gpio?=0|1] looks amusing, could that be used to detect whether a camera is attached? I assume it doesn't have to be a GPIO that's externalised to the 40-pin header.
As I said, I only tripped over the code rather than knowing about this (I had to work backwards from the strncmp and strchr calls to work out the syntax).
Whilst you probably can read off the GPIO expander (GPIOs 128-135), I'm not sure if the camera will affect any input pins. The I2C lines may be pulled low if neither camera nor display is connected, but I wouldn't want to rely on that.

I was thinking more for swtiching between the multiple test configs that I have, although seeing as I tend to have to switch kernel between it may not be as trivial. AFAIK it doesn't allow for different cmdline.txt files, so not trivial to drop into different NFS mounts.

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 10:05 am
by 6by9
procount wrote:
Tue Apr 24, 2018 9:59 am
I've added a github issue: https://github.com/raspberrypi/documentation/issues/892
JamesH will love you for doing that ;)

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 10:10 am
by DougieLawson
6by9 wrote:
Tue Apr 24, 2018 10:05 am
procount wrote:
Tue Apr 24, 2018 9:59 am
I've added a github issue: https://github.com/raspberrypi/documentation/issues/892
JamesH will love you for doing that ;)
It's an addendum to one I opened.

I'd like every possible external option (not the hidden secret squirrel parms) to be documented in glorious detail so we can get away from pointing folks at https://elinux.org/RPiconfig as a source of documentation. We need words written for all of the /boot/config.txt things that can be tweaked and twiddled by regular users (with reasons why they might want to twiddle them).

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 10:36 am
by jamesh
6by9 wrote:
Tue Apr 24, 2018 10:05 am
procount wrote:
Tue Apr 24, 2018 9:59 am
I've added a github issue: https://github.com/raspberrypi/documentation/issues/892
JamesH will love you for doing that ;)
Yippeeee!!!

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 10:38 am
by jamesh
DougieLawson wrote:
Tue Apr 24, 2018 10:10 am
6by9 wrote:
Tue Apr 24, 2018 10:05 am
procount wrote:
Tue Apr 24, 2018 9:59 am
I've added a github issue: https://github.com/raspberrypi/documentation/issues/892
JamesH will love you for doing that ;)
It's an addendum to one I opened.

I'd like every possible external option (not the hidden secret squirrel parms) to be documented in glorious detail so we can get away from pointing folks at https://elinux.org/RPiconfig as a source of documentation. We need words written for all of the /boot/config.txt things that can be tweaked and twiddled by regular users (with reasons why they might want to twiddle them).
I've already, I think, done most of the work of incorporating the ELinux stuff to our docs. If there is anything missing, let me know via github.

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 10:49 am
by jamesh

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 11:28 am
by DougieLawson
jamesh wrote:
Tue Apr 24, 2018 10:38 am

I've already, I think, done most of the work of incorporating the ELinux stuff to our docs. If there is anything missing, let me know via github.
I think you're right (and it's a good job, that's been well done), but that won't stop me looking for missing pieces.

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 11:40 am
by jamesh
DougieLawson wrote:
Tue Apr 24, 2018 11:28 am
jamesh wrote:
Tue Apr 24, 2018 10:38 am

I've already, I think, done most of the work of incorporating the ELinux stuff to our docs. If there is anything missing, let me know via github.
I think you're right (and it's a good job, that's been well done), but that won't stop me looking for missing pieces.
I'm sure there are bits missing - search away!!

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 11:53 am
by procount
6by9 wrote:
Tue Apr 24, 2018 10:05 am
procount wrote:
Tue Apr 24, 2018 9:59 am
I've added a github issue: https://github.com/raspberrypi/documentation/issues/892
JamesH will love you for doing that ;)
Procount loves JamesH for completing the task within 2 hours! ;) Thanks.

(There's no point having great features in a great product if they are not documented. If no-one knows they are there, they may as well not be there.)

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 12:34 pm
by jamesh
procount wrote:
Tue Apr 24, 2018 11:53 am
(There's no point having great features in a great product if they are not documented. If no-one knows they are there, they may as well not be there.)
I agree entirely, which is why, whenever I see something missing, or something new and interesting that would benefit users, I try to ensure it gets included ASAP.

TBH, I didn't even know that gpio option was there....

Re: Conditional config.txt

Posted: Tue Apr 24, 2018 12:41 pm
by 6by9
jamesh wrote:
Tue Apr 24, 2018 12:34 pm
TBH, I didn't even know that gpio option was there....
Me neither. I just went looking for the pi3+ options and stumbled over it. Secret magic added by dom in May 2016, so it's been there a fair while.

Re: Conditional config.txt

Posted: Mon Apr 30, 2018 9:40 am
by procount
What is the expected behaviour on a Pi2, that uses old firmware (prior to the 3B+) when it encounters a config.txt file as follows? :

Code: Select all

[pi3+]
sdram_freq=450
arm_freq=1200
[all]
My experience is that this code is still processed, causing the Pi2 to halt /lock-up (maybe the freqs are too fast for it).
Is it possible to exclude such [pi3+] isolated code from firmware that don't understand it, or is it necessary to revert the above settings for every other model of Pi?