The GPIO settings in the eeprom_settings.txt file, https://github.com/raspberrypi/hats/blo ... ttings.txt, are not clear to me with respect to their usage. Are these setting informational only or do setting these options cause default configuration of the GPIO pins?
When I un-commented the lines corresponding to the GPIO pins of interest and compiled and flashed this to the eeprom in my hat, I was expecting to see gpio pins available in the same way as if I had used the /sys/class/gpio/export type gpio configuration. I am pretty sure that I compiled and loaded this properly because the DTS fragment that used for enabling an ADC did function as expected.
Thanks
Ken
-
- Posts: 5
- Joined: Wed Sep 13, 2023 5:06 am
-
- Posts: 8395
- Joined: Tue Jun 30, 2015 1:35 pm
Re: gpio setting in pi hat eeprom_settings.txt file
the options will change the default pin configuration
as an example
changing this to
will result in having them configure as DPI_D6 (GPIO10) and DPI_D7 (GPIO11)
as an example
Code: Select all
..
#setgpio 10 INPUT DEFAULT
#setgpio 11 INPUT DEFAULT
..
Code: Select all
..
setgpio 10 ALT2 NONE
setgpio 11 ALT2 NONE
..
-
- Posts: 5
- Joined: Wed Sep 13, 2023 5:06 am
Re: gpio setting in pi hat eeprom_settings.txt file
Thanks. I am beginning to fill in the blanks with respect to the GPIO on the PI.
Because I see the ability to set the GPIO state through the settings.txt file, as well as being to export the GPIO through the /sys filesystem and there are interfaces such as the RPi.GPIO python module, I wrongly assumed that there was consistency among the methods.
Now, for the purpose of confirming my understanding as well as helping others who are starting, what I see is that the use of the settings.txt file is analogous to (not the same, but analogous to) the method used by RPi.GPIO with the important part of this comparison being that the GPIO controls are NOT exposed through the /sys filesystem and any user space program would then operate on the GPIO in a way similar to the method used by RPi.GPIO by going through the /dev/gpiomem interface as shown here https://sourceforge.net/p/raspberry-gpi ... e/c_gpio.c and by using the peripheral information from the relevant document here: https://www.raspberrypi.com/documentati ... ssors.html (eg the BCM2711 for the Pi 4).
The second fundamental method would then be to ignore the controls from the settings file and to expose the GPIO of interest by going through the /sys filesystem (e.g. use echo 17 > /sys/class/gpio/export to expose GPIO 17; set to output with echo out > /sys/class/gpio/gpio17/direction; etc)
Thanks in advance for any comments
Because I see the ability to set the GPIO state through the settings.txt file, as well as being to export the GPIO through the /sys filesystem and there are interfaces such as the RPi.GPIO python module, I wrongly assumed that there was consistency among the methods.
Now, for the purpose of confirming my understanding as well as helping others who are starting, what I see is that the use of the settings.txt file is analogous to (not the same, but analogous to) the method used by RPi.GPIO with the important part of this comparison being that the GPIO controls are NOT exposed through the /sys filesystem and any user space program would then operate on the GPIO in a way similar to the method used by RPi.GPIO by going through the /dev/gpiomem interface as shown here https://sourceforge.net/p/raspberry-gpi ... e/c_gpio.c and by using the peripheral information from the relevant document here: https://www.raspberrypi.com/documentati ... ssors.html (eg the BCM2711 for the Pi 4).
The second fundamental method would then be to ignore the controls from the settings file and to expose the GPIO of interest by going through the /sys filesystem (e.g. use echo 17 > /sys/class/gpio/export to expose GPIO 17; set to output with echo out > /sys/class/gpio/gpio17/direction; etc)
Thanks in advance for any comments