Discussion:
I2C/IIC working on RPI4
Elwood Downey
2021-05-02 18:05:42 UTC
Permalink
Yes yes yes!!

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.

Many thanks to everyone for all their work.

Elwood Downey, WB0OEW
Tucson AZ
Mark Millard via freebsd-arm
2021-05-02 21:00:58 UTC
Permalink
Post by Elwood Downey
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)

Loading...