0

I have 2 Atmel EEPROMs - 24c128 - at addresses 0x0A and 0x0B.

sudo i2cdetect -y -r -a 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- 02 03 -- -- -- -- -- -- 0a 0b -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- UU UU -- -- 
40: UU UU UU UU -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- UU UU -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

I can read/write using i2c commands:

$ sudo i2ctransfer -y -f 1 w4@0x0a 0 0 123 22 $ sudo i2ctransfer -y -f 1 w2@0x0a 0 0 r10 0x7b 0x16 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff

I can't figure out how to see the eeprom as a file in order to be able to open, seek, write, read using file commands:

/sys/bus/i2c/devices/i2c-1/1-000a$ ll total 0 drwxr-xr-x 3 root root 0 Mar 14 13:51 ./ drwxr-xr-x 15 root root 0 Mar 14 13:51 ../ -r--r--r-- 1 root root 4096 Mar 14 14:56 modalias -r--r--r-- 1 root root 4096 Mar 14 14:56 name lrwxrwxrwx 1 root root 0 Mar 14 14:56 of_node -> '../../../../firmware/devicetree/base/i2c@c240000/ub960@3C/link@2/ub953@42/sc9732cam_EEP@A'/ drwxr-xr-x 2 root root 0 Mar 14 14:56 power/ lrwxrwxrwx 1 root root 0 Mar 14 13:51 subsystem -> ../../../../bus/i2c/ -rw-r--r-- 1 root root 4096 Mar 14 13:51 uevent

In the dtsi file:

 EEP_NODE: EEP_NODE_NAME {
  status = "okay";
  compatible = "24c128","at24";
  address-width = <16>;
  #address-cells = <1>;
  #size-cells = <0>;
  reg = <0x0A>;
  physical-addr = <0x52>;
  pagesize = <64>;
  size = <16384>;
  has-eeprom = "1";  /* Enable EEPROM support */
  node_name_alias = "EEP";

};

I used this post to try to instantiate eeprom in user space

As user: /sys/bus/i2c/devices/i2c-1$ sudo echo 24c128 0xa > new_device -bash: new_device: Permission denied

As root: root@mechi:/sys/devices/c240000.i2c/i2c-1# sudo echo 24c128 0xa > new_device echo: write error: Invalid argument

Any ideas would be appreciated. Thanks, Mechi

Mechi
  • 3
  • 4
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 16 '23 at 00:43

1 Answers1

0

The problem was that I relied on the d3_defconfig file. I used:

sudo make linux-menuconfig 

And chose in Device Drivers/Misc./EEPROM the i2c option. Now it works.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Mechi
  • 3
  • 4