Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Apr 2021 08:55:17 +0100
From:      Mark Murray <markm@FreeBSD.org>
To:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: I2C/IIC working on RPI4 8GB?
Message-ID:  <E9098242-5ED4-401B-9D46-E11A214A0E2F@FreeBSD.org>
In-Reply-To: <A10EA46D-6FE5-4FCD-895C-5A08A974D6DB@yahoo.com>
References:  <1C2DD11C-B1F6-4C2A-9AB0-5F1553520FF5@FreeBSD.org> <20210426161138.a8f44b6e1134f73a411be57d@bidouilliste.com> <CF4C4332-BB2F-47E9-B879-8EEA0E53E848@FreeBSD.org> <C4828BF2-E8B7-45D1-B0F8-5E72AF84D565@yahoo.com> <47A634E3-4938-4AFC-9341-E480CEBF67FB@FreeBSD.org> <20210428101945.67417ef8eba251dcbcb38078@bidouilliste.com> <ED9ABBBE-9B5A-4B51-806C-F91AABE39731@FreeBSD.org> <486E3EA3-EBAE-492E-B12E-E72E3E3E7B6A@FreeBSD.org> <A10EA46D-6FE5-4FCD-895C-5A08A974D6DB@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_5CB670C0-14E2-423F-8534-980FC59D8EF1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

On 29 Apr 2021, at 19:17, Mark Millard <marklmi@yahoo.com> wrote:
>=20
> On 2021-Apr-29, at 09:57, Mark Murray <markm at freebsd.org> wrote:
>=20
>> On 28 Apr 2021, at 22:07, Mark Murray <markm at FreeBSD.org> wrote:
>>>=20
>>> On 28 Apr 2021, at 09:19, Emmanuel Vadot <manu@bidouilliste.com> =
wrote:
>>>=20
>>>> According to this document is this just to detect that the slave =
hold
>>>> the scl line too long so I don't think that this is the problem =
here.
>>>> If you have a scope or a logic analyzer I suggest you start by =
using
>>>> it to confirm that when you scan with i2c -s you see something.
>>>=20
>>> As it turns out, my logic analyser arrived today.
>>=20
>> I got an oscilloscope onto pins 3 and 5 (GPIO2 and GPIO3), and "i2c =
-s" does not a jot on them.
>>=20
>> I don't know if this helps, but the gpioctl utility thinks the pins =
are both inputs:
>=20
> Looking around, I see:
>=20
> https://github.com/raspberrypi/hats/blob/master/designguide.md

That's a useful document, thanks, but I'm not yet making much progress.

=46rom a verbose boot, I extract the following gpio/i2c items:

[root@grasshopper ~]# dmesg | egrep 'gpio|i2c|iic'
gpio0: <BCM2708/2835 GPIO controller> mem 0x7e200000-0x7e2000b3 irq =
14,15 on simplebus0
gpiobus0: <OFW GPIO bus> on gpio0
gpio0: set pin 9 to func 4
gpio0: set pin 10 to func 4
gpio0: set pin 11 to func 4
gpio0: set pin 8 to func 1
gpio0: set pin 7 to func 1
Processing 1 pin-config node(s) in pinctrl-0 for i2c@7e804000 <<< =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Something here?
gpio0: set pin 40 to func 4
gpio0: set pin 41 to func 4
gpio0: set pin 48 to func 7, pull 0
gpio0: set pin 49 to func 7, pull 2
gpio0: set pin 50 to func 7, pull 2
gpio0: set pin 51 to func 7, pull 2
gpio0: set pin 52 to func 7, pull 2
gpio0: set pin 53 to func 7, pull 2
gpio1: <Raspberry Pi Firmware GPIO controller> on bcm2835_firmware0
gpiobus1: <GPIO bus> on gpio1
gpioc0: <GPIO controller> on gpio0
simplebus0: <i2c@7e205000> mem 0x7e205000-0x7e2051ff irq 19 disabled =
compat brcm,bcm2711-i2c (no driver attached)
simplebus0: <i2c0mux> disabled compat i2c-mux-pinctrl (no driver =
attached)
iichb0: <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 26 =
on simplebus0
simplebus0: <i2c@7e205600> mem 0x7e205600-0x7e2057ff irq 50 disabled =
compat brcm,bcm2711-i2c (no driver attached)
simplebus0: <i2c@7e205800> mem 0x7e205800-0x7e2059ff irq 51 disabled =
compat brcm,bcm2711-i2c (no driver attached)
simplebus0: <i2c@7e205a00> mem 0x7e205a00-0x7e205bff irq 52 disabled =
compat brcm,bcm2711-i2c (no driver attached)
simplebus0: <i2c@7e205c00> mem 0x7e205c00-0x7e205dff irq 53 disabled =
compat brcm,bcm2711-i2c (no driver attached)
simplebus0: <i2c@7ef04500> mem =
0x7ef04500-0x7ef045ff,0x7ef00b00-0x7ef00dff disabled compat =
brcm,bcm2711-hdmi-i2c (no driver attached)
simplebus0: <i2c@7ef09500> mem =
0x7ef09500-0x7ef095ff,0x7ef05b00-0x7ef05dff disabled compat =
brcm,bcm2711-hdmi-i2c (no driver attached)
gpioc1: <GPIO controller> on gpio1
simplebus0: <gpiomem> mem 0x7e200000-0x7e200fff compat =
brcm,bcm2835-gpiomem (no driver attached)
gpioled0: <GPIO LEDs> on ofwbus0
ofwbus0: <sd_io_1v8_reg> compat regulator-gpio (no driver attached)
iicbus0: <OFW I2C bus>usbus0: 5.0Gbps Super Speed USB v3.0
 on iichb0
iic0: <I2C generic I/O> on iicbus0

The iic/i2c device is there, yet the physical pins on the RPI4 8GB are =
vigourously resisting doing anything at all. Does the above look OK to =
you folks who are in the know?

I decompiled the .dtb file to see if anything looked wrong (trying to =
follow whats happening in the .dts source files makes my brain hurt):

[root@grasshopper ~]# ls -al /boot/msdos/
:
-rwxr-xr-x   1 root  wheel    49090 Mar  3 13:29 =
bcm2711-rpi-4-b-BACKUP.dtb
-rwxr-xr-x   1 root  wheel    49089 Apr 30 07:20 bcm2711-rpi-4-b.dtb
-rwxr-xr-x   1 root  wheel    56933 Apr 30 07:19 bcm2711-rpi-4-b.dts
:

I did find this snippet:

                i2c@7e804000 {

                        compatible =3D "brcm,bcm2711-i2c", =
"brcm,bcm2835-i2c";
                        reg =3D <0x7e804000 0x1000>;
                        interrupts =3D <0x0 0x75 0x4>;
                        clocks =3D <0x7 0x14>;
                        #address-cells =3D <0x1>;
                        #size-cells =3D <0x0>;
                        pinctrl-names =3D "default";
                        pinctrl-0 =3D <0x17>;
                        clock-frequency =3D <0x186a0>;
                        phandle =3D <0x35>;
                        status =3D "disabled";
                };

... and I didn't like the look of that ' status =3D "disabled"; ' line, =
but removing it, recompiling and rebooting had no effect. I2c is all =
over that .dts, and its confusing the hell out of me. Does pinctrl-0 =
have something to do with this? The pins 2/3 need to be configured to be =
BCM2835_FSEL_ALT0 (FSEL[2-3]=3D4), and pinctrl-0 is 0x17, but that =
doesn't seem to help register GPFSEL0 fields FSEL3(11:9) and FSEL(8:6).

Somebody must have this working?! :-)

> If this note is redundant for you, sorry.

I'm not sure yet - the information definitely adds to what I know, but =
I'm still too new to this to put it together properly,, and I can only =
do it in short bursts of time (because life!), so thanks!

M
--
Mark R V Murray

--
Mark R V Murray


--Apple-Mail=_5CB670C0-14E2-423F-8534-980FC59D8EF1
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.2
Comment: GPGTools - http://gpgtools.org

iQEzBAEBCgAdFiEEyzPHvybPbOpU9MCxQlsJDh9CUqAFAmCLt+UACgkQQlsJDh9C
UqDvRwgAgVXLeZnuDSDZSfCoQIVexcliTz+E9OKgj/h2cvdKhxXsI2iifiOQjmXx
2gLp85i3pNrL3XHSsu8OYwhEfYFGn2HhBunv5w4uu0J79QkrwNufwm/88qgiL/C6
6REBLhWqErgA8sAqfsTWMYay9mxd85uS5eGWj/ALnaJYZcmTWTpCYWjnaBRfF2km
E3bToer/QGrXSatXQcpBKW8kz3NnmvzOMS/hoLLaJz3aHFpTtK2dMhagi4HfXX6U
Grpx1xoNSYqEC6P+UYyYQcCErcViZqKCQ7TXwOcgdaYecWGXAhkfkDbO9efGexHJ
nB7Ky7O18X2tB+5Mx8IVX6ycfykNbA==
=pHCp
-----END PGP SIGNATURE-----

--Apple-Mail=_5CB670C0-14E2-423F-8534-980FC59D8EF1--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E9098242-5ED4-401B-9D46-E11A214A0E2F>