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

时间:2018-10-26 21:02:22

标签: beagleboneblack i2c eeprom

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(带帽),根据BBB SRM第8.2节的要求,该EEPROM受支持。它是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读取的,就像我对“内部”硬盘所做的那样,以确认它可以正常工作。我在做什么错了?

1 个答案:

答案 0 :(得分:0)

问题在于,海角管理器正在“请求” i23c-2上的那些地址。我们将需要禁用Cape Manager,以释放这些地址。这样做之后,它在i2c-2下显示0x57,因此以后应该可以工作。

请检查以下链接,了解如何在BeagleBone上禁用Cape Manager:

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/beagleboard/NG8cDWuv2Y0/69vk5F5ZAgAJ

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

 #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>;
};
相关问题