I2C/IIC working on RPI4 8GB? [gpio2 and 3 input vs. alt0 control via sysctl use is avilable]
Mark Millard
marklmi at yahoo.com
Sun May 2 03:40:47 UTC 2021
On 2021-May-1, at 20:14, Mark Millard <marklmi at yahoo.com> wrote:
>
>
> On 2021-May-1, at 19:58, Mark Millard <marklmi at yahoo.com> wrote:
>
> On 2021-May-1, at 08:31, Mark Millard <marklmi at yahoo.com> wrote:
>
>> On 2021-May-1, at 04:48, Mark Murray <markm at freebsd.org> wrote:
>>
>>> On 30 Apr 2021, at 15:22, Klaus Küchemann <maciphone2 at googlemail.com> wrote:
>>>>
>>>>
>>>> yet another useful document(at least that's what I hope to fix your usecase) :
>>>>
>>>> https://www.raspberrypi.org/documentation/configuration/config-txt/gpio.md
>>>
>>> BINGO!!
>>>
>>> I added
>>>
>>> gpio=2,3=a0
>>>
>>> to my config.txt file and after a reboot,
>>>
>>> # i2c -f /dev/iic0 -s worked!
>>
>>
>> Cool.
>>
>> But it leaves me wondering what the FreeBSD equivalent
>> for setting the mode of those 2 gpio's to a0 (or other
>> alternatives) is supposed to look like (even if such
>> code would not work as things are in the implementation).
>>
>> (But, for me, it is idle wondering.)
>
> [I was given a code hint that I've not investigated yet.]
> . . .
Going more in a code exploration direction I found evidence
of sysctl for:
# sysctl dev.gpio.0.pin.3.function dev.gpio.0.pin.2.function
dev.gpio.0.pin.3.function: input
dev.gpio.0.pin.2.function: input
and for:
# sysctl dev.gpio.0.pin.3.function=alt0 dev.gpio.0.pin.2.function=alt0
dev.gpio.0.pin.3.function: input -> alt0
dev.gpio.0.pin.2.function: input -> alt0
# sysctl dev.gpio.0.pin.3.function dev.gpio.0.pin.2.function
dev.gpio.0.pin.3.function: alt0
dev.gpio.0.pin.2.function: alt0
# gpioctl -f /dev/gpioc0 -l -v
pin 00: 1 pin 0<IN>, caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 01: 1 pin 1<IN>, caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 02: 1 pin 2<>, caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 03: 1 pin 3<>, caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 04: 1 pin 4<IN>, caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 05: 1 pin 5<IN>, caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
. . .
So it appears that there is no need of the config.txt
way of doing it and there is both command-line and
code-internal ways of controlling the assignments (via
the internal way of initiating sysctl activity).
===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
More information about the freebsd-arm
mailing list