Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Mar 2021 19:28:13 +0100
From:      =?utf-8?Q?Klaus_K=C3=BCchemann?= <maciphone2@googlemail.com>
To:        Mark Murray <markm@FreeBSD.org>, freebsd-arm@freebsd.org, Mark Millard <marklmi@yahoo.com>, bob prohaska <fbsd@www.zefox.net>
Subject:   Re: RPI4/8GB i2c not working?
Message-ID:  <7223573B-4DA5-4BE9-A259-6C271B36C08F@googlemail.com>
In-Reply-To: <3B3786FE-7A47-4D29-8F99-98C1F483C0AA@googlemail.com>
References:  <0D013C24-3CDD-4262-922C-524916ACCB10@FreeBSD.org> <E4AACBB5-4ADB-4BDC-936F-9BF8D45B3EC9@googlemail.com> <DD3F8DC8-03ED-40A7-8709-86F7BD06F8C8@googlemail.com> <599EDCF7-D716-4645-8832-E429C5E17F6E@yahoo.com> <D7553FC1-7545-4823-A04D-598BA53BA94D@googlemail.com> <D854419D-8182-4D59-9EB5-16A958DAB15F@FreeBSD.org> <526E2EA2-DF46-4CF0-B75C-1D1118AA4FD8@googlemail.com> <3B3786FE-7A47-4D29-8F99-98C1F483C0AA@googlemail.com>

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



> Am 10.03.2021 um 18:26 schrieb Klaus Küchemann <maciphone2@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@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@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@generic:~ # ktrace -t+ i2c -s -f /dev/iic2

root@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.




home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7223573B-4DA5-4BE9-A259-6C271B36C08F>