RPI4/8GB i2c not working?

Klaus Küchemann maciphone2 at googlemail.com
Wed Mar 10 18:28:18 UTC 2021



> Am 10.03.2021 um 18:26 schrieb Klaus Küchemann <maciphone2 at googlemail.com>:
> 
> 
> Also possibly some things cood depend on loaded overlays/config.txt 
> and which corresponding GPIO-pins are configured 
> 

So let's give adding devices & gpio-pins  a shot with an example :

1.: we place e.g. the following files in dtb/overlays into the msdos-partition :

i2c1.dtbo
i2c3.dtbo
i2c4.dtbo
i2c6.dtbo

2.: in config.txt  we add them and assign pins to them: 
---
dtoverlay=i2c1,pins_2_3
dtoverlay=i2c3,pins_4_5
dtoverlay=i2c4,pins_6_7
dtoverlay=i2c6,pins_0_1
--

3.: reboot the machine :

root at generic:~ # dmesg
.....

iicbus1: <OFW I2C bus> on iichb1
iic1: <I2C generic I/O> on iicbus1
iicbus2: <OFW I2C bus> on iichb2
iic2: <I2C generic I/O> on iicbus2
iicbus3: <OFW I2C bus> on iichb3
iic3: <I2C generic I/O> on iicbus3
...

root at generic:~ # ls /dev
...
iic0
iic1  
iic2
iic3   
..
              
That's totally exciting   ! :-) Ha Ha 


4.: so let's probe again, this time on /dev/iic2 :

root at generic:~ # ktrace -t+ i2c -s -f /dev/iic2

root at generic:~ # kdump
….
1246 i2c      RET   open 3
  1246 i2c      CALL  read(0x3,0x4027cc18,0x80)
  1246 i2c      GIO   fd 3 read 128 bytes
       0x0000 4568 6e74 0100 0000 8000 0000 d500 0000  |Ehnt............|
       0x0010 0000 0000 d400 0000 0000 0000 0000 0000  |................|
       0x0020 0000 0000 0000 0000 0000 0000 0000 0000  |................|
       0x0030 0000 0000 0000 0000 0000 0000 0000 0000  |................|
       0x0040 0000 0000 0000 0000 0000 0000 0000 0000  |................|
       0x0050 0000 0000 0000 0000 0000 0000 0000 0000  |................|
       0x0060 0000 0000 0000 0000 0000 0000 0000 0000  |................|
       0x0070 0000 0000 0000 0000 0000 0000 0000 0000  |................|
  1246 i2c      RET   read 128/0x80
...


Wow, everything works as expected !   :-) 

I have no clue what happens when you assign the wrong pins to the wrong voltage ;-) Ha Ha 

K.




More information about the freebsd-arm mailing list