-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Provide a means to use an alternate config.txt based on a gpio pin level #593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you describe the use case for this? |
having a fallback os that I can boot from when the "target" os does not work. During the testing of the merges to enable the clock framework this would have been very handy - I had to resort to using u-boot instead to avoid "bricking" the rpi and having to get back to the rpi to rpi out the sd card to modify config.txt so that the default firmware gets used. |
Booting via USB is only possible on bcm2708 devices without ethernet... |
We currently support sections. E.g.
where config_testing.txt contains your risky options. |
fine with that as well... We may only need to make sure we have the correct pullups/pulldowns for those gpios, so that we get consistent behavior. So but that could be a separate thing to allow to set the gpio pullup/pulldown prior to testing the conditions... |
The plan is that the config.txt decision is purely made by reading a gpio level. |
That makes is slightly "wobbly", but then I would just need to find a gpio that has a pullup or pulldown by default... As per datasheet the SOC should come up with these pull-ups/pull-downs:
If the firmware does not change them, then we should be able to use those as their default states. |
Note as an aside: if there is a means to chang the base directory where the firmware looks for all of its files, then this would also help keeping all the setups different. So that could get used like this:
This way we can make kernels, dts and overlays for development go to a separate sub-dir and then these would get used without causing conflict (I just had one such situation where |
Thank you msperl for beating me to it in opening this issue :)
|
Actually I got u-boot working fine on my cm - there was not even a major change needed (not that I can remember the details how I did it, but it was not that complicated - you may only need to set the jumpers on the CM-connection-board slightly differently than documented - disable USB slave disable) |
https://dl.dropboxusercontent.com/u/3669512/temp/firmware_gpio.zip The |
looking at it. I guess most of the needs could be solved by having a command to define the directory for the overlays - this would be just short of having distinctive firmware based on gpio... That way I could make it look like:
|
So I gave it a try with the following fragment:
but regardless of the GPIO it always uses gpio37=1 Here some diagnostics with GPIO37 pulled low by another RPI:
and when I switch level to 1:
Does it only work for gpio4? Note: I originally had one with Here something more, to show the firmware used:
|
Note I have also attached an oscilloscope - the pin levels always stay at the expected values during boot |
note that I went all the way to use gpio4:
still cm1 is loaded:
|
Doesn't work for me either and I have shorted the GPIO4 hard to GND or 3V3 on RPI 2 B at home.
|
Can you try the updated https://dl.dropboxusercontent.com/u/3669512/temp/firmware_gpio.zip |
Sorry, still doesn't work and I have something as simple as this in config.txt: kernel=kernel7.img It always uses rescue.img, regardless of forced level on GPIO4 (PIN16 on J8 with RPI2B). FYI: bootcode.bin has same md5sum as before, if that makes sense. |
The change was to start.elf not bootcode.bin.
|
This is what I've got: |
Looks okay - I guess you are using start_x.elf or start_cd.elf hence the slightly different build time. |
Have tried both start_x.elf and start.elf, still doesn't work. |
GPIO 4 is pin 7 of J8 by my numbering. |
As far as I can test I can now switch between u-boot and foundation with a single GPIO... As far as I can tell the functionality work now! When do you plan the next update of the firmware, so that I can start distributing it to all the different machines via "normal" means? @popcornmix : Thanks for all your efforts! |
It may be a few days. There is a raspbian update imminent, so we are avoiding pushing anything risky. We'll push this once that is finalised. The GPIO commit did require some reordering of startup calls: |
Awesome! Works! |
I did not test 47 as it is 1.8v and that requires a transistor to control from a second pi.... @popcornmix : thanks again - I am happy if it takes a bit longer - anything is better than having to rip out the sd card (besides USB boot on the cm or model a) |
@popcornmix : so the overlay_prefix thing seems to work, but it is slightly hard to verify - it would help if there was better logging in the firmware for:
I guess that would complete that patch. |
I don't think the lack of verbose logging makes it harder to verify - you just have to be more creative, using overlay names as trace points, etc. One thing you need to be aware of is that DT directives are parsed in a separate pass, after the other settings. As a result, you can't change the overlay prefix part way through a set of overlays - the value of the prefix at the end of the file is the one which is used. |
yes, it is acceptable as is - I just wanted to mention that there is some place for improvement... I just found out because I thought that using |
FYI, I have tried gpio47=0 and shorted GPIO47_CTL_1V8 (PIN59 of J5 on CMIO) to ground just now and it doesn't work on the CM. |
Look at the schematics of the CMIO board with regards to "USB Boot Enable" GPIO47 is used for something entirely different on the CMIO - select USB boot or boot for MMC. This may be different when using gpio47 on your custom IO board - there you can define your preference as it does not necessarily come with that specific logic for USB boot. Note that basic USB Boot is part of the BCM283X ROM, so that code can not get changed! |
EMMC_DISABLE_N is used for USB Boot, GPIO47_1V8 can disable USB Boot over EMMC_DISABLE_N, if for example the slave USB cable is disconnected. snip BCM2835 BootROM boot from eMMC with GPIO boot select:
snip I couldn't find any further documentation on that 'alternate' boot :( |
"Boot SW" = ROM boot loader and not bootcode.bin or start*.elf! I guess there is one more ROM-boot loader option besides:
The ROM boot-loader has GPIO47 as input for a short period of time and then will switch to output (but that may also only happen in the later firmware stages), so that emmc becomes available again on the CM. |
Thank you for clarifying that we cannot use gpio47=0 in config.txt :) |
kernel: adau1977-adc: Add basic machine driver for adau1977 codec driver See: raspberrypi/linux#1454 kernel: Allow up to 24dB digital gain to be applied when using IQAudIO DAC See: raspberrypi/linux#1458 kernel: config: Add CONFIG_DRM_LOAD_EDID_FIRMWARE See: raspberrypi/linux#1456 kernel: Rpi 4.4.y: HDMI hotplug detection, overlay cleanup See: raspberrypi/linux#1457 kernel: BCM270X_DT: Add umbrella I2C Mux overlay i2c-mux See: raspberrypi/linux#1465 kernel: BCM270X_DT: Fix the tinylcd35 overlay RTC support firmware: ldconfig: Support filter based on gpio level firmware: ldconfig: Allow specifying a overlay_prefix from config.txt See: #593 firmware: dispmanx: Avoid dispmanx updates when running vc4-kms-v3d driver See: #595 firmware: RIL Camera: Correct buffer size checking for RGB and BGR888 firmware: RIL video_encode: Add support for levels 4.1 and 4.2 firmware: IMX219: Add assert on failure to init firmware: imx219: New VGA and full FOV 720p modes firmware: imx219: Reorder modes to roughly match OV5647 firmware: imx219: Enable sensor DPC See: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=145815
kernel: adau1977-adc: Add basic machine driver for adau1977 codec driver See: raspberrypi/linux#1454 kernel: Allow up to 24dB digital gain to be applied when using IQAudIO DAC See: raspberrypi/linux#1458 kernel: config: Add CONFIG_DRM_LOAD_EDID_FIRMWARE See: raspberrypi/linux#1456 kernel: Rpi 4.4.y: HDMI hotplug detection, overlay cleanup See: raspberrypi/linux#1457 kernel: BCM270X_DT: Add umbrella I2C Mux overlay i2c-mux See: raspberrypi/linux#1465 kernel: BCM270X_DT: Fix the tinylcd35 overlay RTC support firmware: ldconfig: Support filter based on gpio level firmware: ldconfig: Allow specifying a overlay_prefix from config.txt See: raspberrypi/firmware#593 firmware: dispmanx: Avoid dispmanx updates when running vc4-kms-v3d driver See: raspberrypi/firmware#595 firmware: RIL Camera: Correct buffer size checking for RGB and BGR888 firmware: RIL video_encode: Add support for levels 4.1 and 4.2 firmware: IMX219: Add assert on failure to init firmware: imx219: New VGA and full FOV 720p modes firmware: imx219: Reorder modes to roughly match OV5647 firmware: imx219: Enable sensor DPC See: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=145815
This feature is in latest rpi-update firmware. |
thanks! |
kernel: adau1977-adc: Add basic machine driver for adau1977 codec driver See: raspberrypi/linux#1454 kernel: Allow up to 24dB digital gain to be applied when using IQAudIO DAC See: raspberrypi/linux#1458 kernel: config: Add CONFIG_DRM_LOAD_EDID_FIRMWARE See: raspberrypi/linux#1456 kernel: Rpi 4.4.y: HDMI hotplug detection, overlay cleanup See: raspberrypi/linux#1457 kernel: BCM270X_DT: Add umbrella I2C Mux overlay i2c-mux See: raspberrypi/linux#1465 kernel: BCM270X_DT: Fix the tinylcd35 overlay RTC support firmware: ldconfig: Support filter based on gpio level firmware: ldconfig: Allow specifying a overlay_prefix from config.txt See: raspberrypi#593 firmware: dispmanx: Avoid dispmanx updates when running vc4-kms-v3d driver See: raspberrypi#595 firmware: RIL Camera: Correct buffer size checking for RGB and BGR888 firmware: RIL video_encode: Add support for levels 4.1 and 4.2 firmware: IMX219: Add assert on failure to init firmware: imx219: New VGA and full FOV 720p modes firmware: imx219: Reorder modes to roughly match OV5647 firmware: imx219: Enable sensor DPC See: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=145815
Uh oh!
There was an error while loading. Please reload this page.
Can you please provide a means to use/load an alternate config.txt based on a gpio pin - say:
use_alt_config_gpio=26
to use GPIO 26 as a signal for which one to load?The text was updated successfully, but these errors were encountered: