On Mon, 15 Jun 2020 15:08:18 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user P B
<
mmmbarley-Re5JQE...@public.gmane.org> wrote:
>Unfortunately, I also want
>P9-12 (GPIO 60) as pulldown output to turn on pump 1 using a relay, where
>P9-12's default state is pullup input, and
>P9-15 (GPIO 48) as pulldown output to turn on pump 2 using a relay, where
>P9-15's default state is pulldown input.
>
>I have been trying to work through RCN's dtb-rebuilder with Derek Molloy's
>book to accomplish this.
First or second edition? It may be pertinent.
>
>But I have not impacted this default state.
>
OTOH, I note you mentioned checking using config-pin, but not trying to
set using it. Have you tried using config-pin at run time instead of all
this DTB hassle? {the /old/ config-pin script, not the less-capable binary
that is now in the path}
-=-=-=-
debian@beaglebone:~$ config-pin -h
GPIO Pin Configurator
Usage: config-pin -c <filename>
config-pin -l <pin>
config-pin -q <pin>
config-pin <pin> <mode>
debian@beaglebone:~$
/opt/source/bb.org-overlays/tools/beaglebone-universal-io/config-pin -h
config-pin [-a] <pin> <mode>
Set <pin> to <mode>, configuring pin multiplexing and optionally
configuring the gpio. Valid <mode> strings vary based on <pin>,
however all pins have a default and gpio mode. The default mode is
the reset state of the pin, with the pin mux set to gpio, the pull
up/down resistor set to it's reset value, and the pin receive buffer
enabled. To setup gpio, the following <mode> strings are all valid:
gpio :
Set pinmux to gpio, existing direction and value unchanged
in | input:
Set pinmux to gpio and set gpio direction to input
out | output :
Set pinmux to gpio and set gpio direction to output
hi | high | 1 :
Set pinmux to gpio and set gpio direction to output driving
high
lo | low | 0 :
Set pinmux to gpio and set gpio direction to output driving low
To enable pull-up or pull-down resistors, a suffex may be appended to
any of the above gpio modes. Use + or _pu to enable the pull-up
resistor
and - or _pd to enable the pull-down resistor. Examples:
in+ | in_pu:
Enable pull-up resistor and setup pin as per input, above.
hi- | hi_pd:
Enable pull-down resistor and setup pin as per high, above.
While the pull-down resistor will be enabled, it will not do
much
until application software changes the pin direction to input.
config-pin -l <pin>
list valid <mode> values for <pin>
config-pin -i <pin>
show information to <pin>
config-pin -q <pin>
query pin and report configuration details
config-pin -f [file]
Read list of pin configurations from file, one per line
Comments and white-space are allowed
With no file, or when file is -, read standard input.
config-pin -h
Display this help text
debian@beaglebone:~$
-=-=-=- <snipping irrelevant>
debian@beaglebone:~$ /opt/scripts/device/bone/
show-pins.pl
P9.15 16 R13 fast rx down 7 gpio 1.16
ocp/P9_15_pinmux (pinmux_P9_15_default_pin)
P9.12 30 U18 fast rx up 7 gpio 1.28
ocp/P9_12_pinmux (pinmux_P9_12_default_pin)
debian@beaglebone:~$ config-pin -q p9.12
Current mode for P9_12 is: default
debian@beaglebone:~$ config-pin -q p9.15
Current mode for P9_15 is: default
debian@beaglebone:~$
/opt/source/bb.org-overlays/tools/beaglebone-universal-io/config-pin -q
p9.12
P9_12 Mode: default Direction: in Value: 1
debian@beaglebone:~$
/opt/source/bb.org-overlays/tools/beaglebone-universal-io/config-pin -q
p9.15
P9_15 Mode: default Direction: in Value: 1
debian@beaglebone:~$
/opt/source/bb.org-overlays/tools/beaglebone-universal-io/config-pin p9.12
out_pd
debian@beaglebone:~$
/opt/source/bb.org-overlays/tools/beaglebone-universal-io/config-pin p9.15
out_pd
debian@beaglebone:~$
/opt/source/bb.org-overlays/tools/beaglebone-universal-io/config-pin -q
p9.12
P9_12 Mode: gpio_pd Direction: out Value: 0
debian@beaglebone:~$
/opt/source/bb.org-overlays/tools/beaglebone-universal-io/config-pin -q
p9.15
P9_15 Mode: gpio_pd Direction: out Value: 0
debian@beaglebone:~$ config-pin -q p9.12
Current mode for P9_12 is: gpio_pd
debian@beaglebone:~$ config-pin -q p9.15
Current mode for P9_15 is: gpio_pd
debian@beaglebone:~$
-=-=-=-
{the "modern" config-pin binary seems to lack an ability to set direction,
but does have gpio_pd/gpio_pu; the old script version has direction and
option to set _pu/_pd on the direction: out, out_pu, out_pd, in, in_pu,
in_pd}
As an aside -- setting an output to pull-up/pull-down seems to me
rather perverse. My understanding of circuits is that pull-up/-down is
meant to ensure one reads a particular state when external devices are
/not/ driving a line to either rail, or are tri-stated (floating) when the
line is shared among devices. Once your application is running, your
outputs should be driven to one or the other state, they won't be floating.
From the script config-pin help:
"""
While the pull-down resistor will be enabled, it will not do
much
until application software changes the pin direction to input.
"""
{config-pin, either version, are not available if using the BB AI -- that
board must use device tree edits}
--
Dennis L Bieber