beagleboneblacki2ceeprom

Set up expansion EEPROM i2c-2 BeagleBoneBlack Rev-C


The BeagleBoneBlack comes with an "internal" EEPROM connected to i2c-0 line. I can see that clearly when I do 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 -- -- -- -- -- -- -- 

It is showing under address 0x50. When I try to do ahexdump I get the following values with no issue:

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|

Now I want to add another EEPROM (with cape) on i2c-2 line which is supported according to BBB SRM section 8.2. It is the CAT24C256 as mentioned in the SRM. The allowable address range for the expansion cards is 0x54-0x57. When I do i2cdetect I can see the following:

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: -- -- -- -- -- -- -- --   

I can see the addresses 0x54-0x57 showing, but when I try hex dump I get an error:

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

Questions:

  1. Why are they showing as U's not actual address numbers? I know U stands for used resource?
  2. Why am I failing to read from that EEPROM? I have tried all addreses from 0x54-0x57 with no luck. I can confirm that those addresses are showing in /sys/class/i2c-dev/i2c-2/device and the each dir has the following in it:

     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 
    

I can see the addresses mapping into the kernel but when I try to hexdump eeprom it doesn't work at all. I though this was supposed to be setup by kernel since it is mentioned in BeagleBone SRM. Am I going to need an overlay to add to uboot for this?

All I'm trying to do is read from the EEPROM like I did with the "internal" one to confirm it is working. What am I doing wrong?


Solution

  • The issue was that the cape manager was "hogging" those addresses on i23c-2. We will need to disable the cape manager in order to free those addresses. After doing that it shows 0x57 under i2c-2 so it should work afterwards.

    Please read how to disable Cape Manager on BeagleBone.

    Make sure to edit the am335x-boneblack-uboot.dts file remove the include on line 11 and replace with the following:

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

    Note this will disable your i2c-2 line by default so either enable it via overlays or edit the am335x-bone-common-no-capemgr.dtsi & add after &i2c0 (around line 245):

    &i2c2 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c2_pins>;
    
        status = "okay";
        clock-frequency = <100000>;
    };