Project

General

Profile

Example EEPROM

As noted in the Development Kit data-sheet:

A 256 Kbit EEPROM, U11, is available for user configuration information on the
MitySOM-AM57(F) Development Board. This EEPROM is accessible over the I2C5
interface to the AM57xx processor.

Goal

These notes indicate how to access the Baseboard EEPROM from within Linux.

Prerequisites

  • I2C5 as indicated in the data sheet is known internally to Linux as i2c-4.
  • The address of the EEPROM device is 50.
  • The device file for the EEPROM is /sys/bus/i2c/devices/4-0050/eeprom

Steps

  • Display the current values in the eeprom.
    root@mitysom-am57x:~# od -xc /sys/bus/i2c/devices/4-0050/eeprom
    0000000     ffff    ffff    ffff    ffff    ffff    ffff    ffff    ffff
             377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
    *
    0100000
    root@mitysom-am57x:~#
    
    # The above indicates that all of the bytes in the eeprom have values of 0xff.
    
  • Write values to the eeprom.
    root@mitysom-am57x:~# echo Hello World > /sys/bus/i2c/devices/4-0050/eeprom
    
  • Display the just written value in the eeprom
    root@mitysom-am57x:~# od -xc /sys/bus/i2c/devices/4-0050/eeprom
    0000000     6548    6c6c    206f    6f57    6c72    0a64    ffff    ffff
               H   e   l   l   o       W   o   r   l   d  \n 377 377 377 377
    0000020     ffff    ffff    ffff    ffff    ffff    ffff    ffff    ffff
             377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
    *
    0100000
    root@mitysom-am57x:~# 
    
  • Bulk read of entire contents.
    root@mitysom-am57x:~# dd if=/sys/bus/i2c/devices/4-0050/eeprom of=eeprom_contents bs=4096 count=8
    8+0 records in
    8+0 records out
    
    # verify contents
    root@mitysom-am57x:~# od -cx eeprom_contents
    0000000    H   e   l   l   o       W   o   r   l   d  \n 377 377 377 377
                6548    6c6c    206f    6f57    6c72    0a64    ffff    ffff
    0000020  377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
                ffff    ffff    ffff    ffff    ffff    ffff    ffff    ffff
    *
    0100000
    root@mitysom-am57x:~#
    
    
  • Writing 0's to entire contents
    root@mitysom-am57x:~# dd if=/dev/zero of=/sys/bus/i2c/devices/4-0050/eeprom bs=4096 count=8
    8+0 records in
    8+0 records out
    root@mitysom-am57x:~# od -cx /sys/bus/i2c/devices/4-0050/eeprom
    0000000   \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
                0000    0000    0000    0000    0000    0000    0000    0000
    *
    0100000
    root@mitysom-am57x:~#
    
  • Writing 0xff to entire contents
    # use tr to translate the 0's to 0xff
    root@mitysom-am57x:~# cat /dev/zero | tr "\0" "\xff" | dd  of=/sys/bus/i2c/devices/4-0050/eeprom bs=4096 count=8
    8+0 records in
    8+0 records out
    root@mitysom-am57x:~# od -cx /sys/bus/i2c/devices/4-0050/eeprom
    0000000  377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
                ffff    ffff    ffff    ffff    ffff    ffff    ffff    ffff
    *
    0100000
    root@mitysom-am57x:~#
    
    

Conclusion

Given one or more of the commands above, you should be able to read and write the EEPROM. Similar operations could be performed in a program.

Go to top
Add picture from clipboard (Maximum size: 1 GB)