I2C/IIC working on RPI4

Mark Millard marklmi at yahoo.com
Sun May 2 21:01:08 UTC 2021


On 2021-May-2, at 11:05, Elwood Downey <elwood.downey at gmail.com> wrote:

> I've been trying everything to get I2C working since I started using
> freebsd on rpi a few years ago. With this change to config.txt, my hamclock
> <https://clearskyinstitute.com/ham/HamClock> project can finally access all
> the I2C devices. Now that everything works I will also submit hamclock as a
> new package.

Turns out this is controllable from FreeBSD's shells and
programmatically: sysctl and its internal-call equivalents.
(This basically repeats a note to Mark Murray.)

For example of via sysctl usage from /bin/sh :

# 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

# 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>
. . .

Such can be used to avoid folks needing to adjust
the contents of the msdos file system that has the
RPi* firmware ( and its config.txt ).

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-arm mailing list