设置扩展 EEPROM i2c-2 BeagleBoneBlack Rev-C

问题描述 投票:0回答:1

BeagleBoneBlack 带有一个连接到 i2c-0 线的“内部”EEPROM。当我执行 i2cdetect 时我可以清楚地看到这一点:

debian@beaglebone:~$ i2cdetect -y -r 0
 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: UU -- -- -- -- -- -- -- 

它显示在地址0x50下。当我尝试执行 ahexdump 时,我毫无问题地得到以下值:

sudo hexdump -C /sys/class/i2c-dev/i2c-0/device/0-0050/eeprom | head -5
00000000  aa 55 33 ee 41 33 33 35  42 4e 4c 54 30 30 30 43  |.U3.A335BNLT000C|
00000010  31 38 33 37 42 42 42 47  30 36 32 32 ff ff ff ff  |1837BBBG0622....|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00001000  aa 55 33 ee 41 33 33 35  42 4e 4c 54 30 30 30 43  |.U3.A335BNLT000C|

现在我想在 i2c-2 线上添加另一个 EEPROM(带 Cape),根据 BBB SRM 第 8.2 节支持。就是SRM中提到的CAT24C256。扩展卡允许的地址范围是 0x54-0x57。当我执行 i2cdetect 时,我可以看到以下内容:

debian@beaglebone:~$ i2cdetect -r -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --   

我可以看到地址 0x54-0x57 显示,但是当我尝试十六进制转储时,出现错误:

  hexdump: /sys/class/i2c-dev/i2c-2/device/2-0054/eeprom: Connection timed out

问题:

  1. 为什么它们显示为 U 而非实际地址号码?我知道 U 代表已用资源?
  2. 为什么我无法读取该 EEPROM?我已经尝试了 0x54-0x57 之间的所有地址,但没有成功。我可以确认这些地址显示在 /sys/class/i2c-dev/i2c-2/device 中,并且每个目录中都有以下内容:

     debian@beaglebone:~$ ls /sys/class/i2c-dev/i2c-2/device/2-0054/ -la
     total 0
     drwxr-xr-x 4 root root     0 Oct 26 19:46 .
     drwxr-xr-x 8 root root     0 Oct 26 19:46 ..
     drwxr-xr-x 3 root root     0 Oct 26 19:47 2-00540
     lrwxrwxrwx 1 root root     0 Oct 26 19:47 driver -> ../../../../../../bus/i2c/drivers/at24
     -rw------- 1 root root 32768 Oct 26 19:47 eeprom
     -r--r--r-- 1 root root  4096 Oct 26 19:47 modalias
     -r--r--r-- 1 root root  4096 Oct 26 19:47 name
     lrwxrwxrwx 1 root root     0 Oct 26 19:47 of_node -> ../../../../../../firmware/devicetree/base/ocp/i2c@4819c000/cape_eeprom0@54
     drwxr-xr-x 2 root root     0 Oct 26 19:47 power
     lrwxrwxrwx 1 root root     0 Oct 26 19:47 subsystem -> ../../../../../../bus/i2c
     -rw-r--r-- 1 root root  4096 Oct 26 19:47 uevent 
    

我可以看到映射到内核的地址,但是当我尝试十六进制转储 eeprom 时,它根本不起作用。我认为这应该是由内核设置的,因为 BeagleBone SRM 中提到了它。我需要为此添加一个覆盖层到 uboot 吗?

我想做的就是从 EEPROM 中读取数据,就像我对“内部”EEPROM 所做的那样,以确认它正在工作。我做错了什么?

beagleboneblack i2c eeprom
1个回答
0
投票

问题在于 Cape 管理器“霸占”了 i23c-2 上的这些地址。我们需要禁用 Cape 管理器才能释放这些地址。完成此操作后,它在 i2c-2 下显示 0x57,因此之后应该可以工作。

请阅读如何在 BeagleBone 上禁用 Cape Manager

确保编辑 am335x-boneblack-uboot.dts 文件删除第 11 行的包含内容并替换为以下内容:

 #include "am335x-bone-common-no-capemgr.dtsi"

请注意,默认情况下这将禁用您的 i2c-2 线路,因此可以通过覆盖启用它或编辑 am335x-bone-common-no-capemgr.dtsi 并在 &i2c0 之后添加(大约第 245 行):

&i2c2 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c2_pins>;

    status = "okay";
    clock-frequency = <100000>;
};
© www.soinside.com 2019 - 2024. All rights reserved.