iMX6 - EEPROM(AT2432) Accessing From user space

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX6 - EEPROM(AT2432) Accessing From user space

5,365 Views
dhanyahc
Contributor II


Hello

I am using iMX 6 quad board from Phytec.

This question is regarding accessing EEPROM from user space either by using console / programming in other words How can I read from / write into EEPROM memory from user space?

 

AT24c32 EEPROM is connected to my iMX6 processor via I2C-2 bus. Device tree and make menu configuration are done correctly to enable EEPROM driver.

On bootup I see EEPROM is successfully detected.

[    2.036834] at24 2-0050: 4096 byte 24c32 EEPROM, writable, 1 bytes/write

However, I don’t see EEPROM device is listed under /dev OR /sys/class, but I can see eeprom listed under sys/bus/i2c/devices/2-0050/eeprom

I tried using eeprog utility but it fails (Error at line 256: unable to open eeprom device file)

Regards

Dhanyakumar

Labels (3)
0 Kudos
3 Replies

2,694 Views
igorpadykov
NXP Employee
NXP Employee

Hi Dhanyakumar

for eeprom integration one can look at

linux/Documentation/devicetree/bindings/eeprom.txt

24c02 eeprom example:

http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/boot/dts/imx6qdl-rex.dtsi?...

usage

http://www.imx6rex.com/open-rex/software/how-to-use-access-openrex-peripherals/#eeprom

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

2,694 Views
dhanyahc
Contributor II

Thanks Igor, Thank you for your time and response.

I understand device tree structure and usage of I2C tools to test EEPROM but my question was how can I access EEPROM using AT24 driver.

I am able to see EEPROM device at  /sys/bus/i2c/devices/2-0050/eeprom

Kernel uses AT24 driver to communicate with EEPROM over I2C. I wanted to know how can I use /invoke AT24 driver to access EEPROM from user space.

0 Kudos

2,694 Views
BiyongSUN
NXP Employee
NXP Employee

The at24 driver is also a i2c driver.

Igor already provided the link, which contains the i2c user space tools/command line usage.

The sys directory operations depend on the attributions populated in the driver.

You can use the i2c user space tools, such as i2cdetect

root@imx6qdlsolo:~# i2cdetect -y  -q 0

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00:          -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- UU -- UU -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- 4a -- -- -- -- --

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --

root@imx6qdlsolo:~# i2cget  -y 0 0x4a 0x9  b

0x03

0 Kudos