I2C/IIC working on RPI4 8GB?
Mark Murray
markm at FreeBSD.org
Fri Apr 30 07:55:20 UTC 2021
On 29 Apr 2021, at 19:17, Mark Millard <marklmi at yahoo.com> wrote:
>
> On 2021-Apr-29, at 09:57, Mark Murray <markm at freebsd.org> wrote:
>
>> On 28 Apr 2021, at 22:07, Mark Murray <markm at FreeBSD.org> wrote:
>>>
>>> On 28 Apr 2021, at 09:19, Emmanuel Vadot <manu at bidouilliste.com> wrote:
>>>
>>>> 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.
>>>
>>> As it turns out, my logic analyser arrived today.
>>
>> I got an oscilloscope onto pins 3 and 5 (GPIO2 and GPIO3), and "i2c -s" does not a jot on them.
>>
>> I don't know if this helps, but the gpioctl utility thinks the pins are both inputs:
>
> Looking around, I see:
>
> https://github.com/raspberrypi/hats/blob/master/designguide.md
That's a useful document, thanks, but I'm not yet making much progress.
From a verbose boot, I extract the following gpio/i2c items:
[root at 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 at 7e804000 <<< ============= 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 at 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 at 7e205600> mem 0x7e205600-0x7e2057ff irq 50 disabled compat brcm,bcm2711-i2c (no driver attached)
simplebus0: <i2c at 7e205800> mem 0x7e205800-0x7e2059ff irq 51 disabled compat brcm,bcm2711-i2c (no driver attached)
simplebus0: <i2c at 7e205a00> mem 0x7e205a00-0x7e205bff irq 52 disabled compat brcm,bcm2711-i2c (no driver attached)
simplebus0: <i2c at 7e205c00> mem 0x7e205c00-0x7e205dff irq 53 disabled compat brcm,bcm2711-i2c (no driver attached)
simplebus0: <i2c at 7ef04500> mem 0x7ef04500-0x7ef045ff,0x7ef00b00-0x7ef00dff disabled compat brcm,bcm2711-hdmi-i2c (no driver attached)
simplebus0: <i2c at 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 at 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 at 7e804000 {
compatible = "brcm,bcm2711-i2c", "brcm,bcm2835-i2c";
reg = <0x7e804000 0x1000>;
interrupts = <0x0 0x75 0x4>;
clocks = <0x7 0x14>;
#address-cells = <0x1>;
#size-cells = <0x0>;
pinctrl-names = "default";
pinctrl-0 = <0x17>;
clock-frequency = <0x186a0>;
phandle = <0x35>;
status = "disabled";
};
... and I didn't like the look of that ' status = "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]=4), 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 556 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20210430/0b759bae/attachment.sig>
More information about the freebsd-arm
mailing list