The phyCORE-AM57x SOM has an onboard 4kB EEPROM. The device is connected to the I2C0 interface at address 0x50. This guide provides instructions for how to interact with the EEPROM from Linux. 

Backup the Original EEPROM Contents

Before attempting the other steps outlined in this article it is highly recommended to back up the contents of your EEPROM as it contains machine specific information used during boot. Use the following command to create a back up:

Target (Linux)

dd if=/sys/bus/i2c/devices/0-0050/eeprom of=/tmp/eeprom_backup bs=4096 count=1
CODE

Verify the EEPROM is detected

Use the following command to print the name of the EEPROM. The expected result is 24c32 which corresponds to the device driver name in Linux. 

Target (Linux)

cat /sys/class/i2c-dev/i2c-0/device/0-0050/name
CODE

Write to the EEPROM

Create data that you want to store on the EEPROM. In this example a hello.img file was created with the text "Hello World".

Target (Linux)

echo "Hello World" > hello.img
CODE

Write the file (hello.img) to the EEPROM

Target (Linux)

dd if=hello.img of=/sys/class/i2c-dev/i2c-0/device/0-0050/eeprom bs=1 count=4096
CODE

Read from the EEPROM

Dump the contents of the entire 4kB EEPROM.

Target (Linux)

dd if=/sys/class/i2c-dev/i2c-0/device/0-0050/eeprom bs=1 count=4096 | hexdump -C
CODE

If hello.img was written to the EEPROM in the previous step you should see the following output:

Expected Output

00000000  48 65 6c 6c 6f 5f 57 72  6f 6c 64 0a 68 00 00 34  |Hello World.h..4|
00000010  31 33 30 30 31 31 31 49  41 32 00 00 00 00 00 32  |1300111IA2.....2|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00001000
4096+0 records in
4096+0 records out
CODE

Erase the EEPROM

Write all zeros to the entire density of the EEPROM to erase the contents.

Target (Linux)

dd if=/dev/zero of=/sys/bus/i2c/devices/0-0050/eeprom bs=4096 count=1
CODE


Restore the Original EEPROM Contents

Once evalution of the EEPROM is complete, it is recommended to restore the original contents of the EEPROM as it contains machine specific information used during boot.

Target (Linux)

dd if=/tmp/eeprom_backup of=/sys/bus/i2c/devices/0-0050/eeprom bs=4096 count=1
CODE

Lose the Original Contents Of the EEPROM?

If something went wrong and the EEPROM is empty, we got you covered. Head over to this How-To Guide: Using the PHYTEC EEPROM Flashtool