EEPROM

EEPROM stands for Electrically Erasable Programmable Read-Only Memory. It is a non-volatile memory that can be programmed and erased electrically. The nonvolatile memory available on the phyCORE-AM57x SOM is a 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. To learn more information about the phyCORE-AM57x system memory, please see section 6.4 in the Hardware Manual.

Backup the Original EEPROM Contents

Note

The default phyCORE-AM57x Development Kit leverages the EEPROM during boot for hardware introspection, thus clearing or corrupting the EEPROM contents will cause boot behavior to change without employing workarounds.

See the Configuring the Bootloader guide for disabling EEPROM hardware introspection in the bootloader environment. See the Using the PHYTEC EEPROM Flashtool guide for more information about the default contents and useage of the EEPROM.

  • 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
    

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
    

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

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
    

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

    Example 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
    

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
    

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
    

Lose the Original Contents Of the EEPROM?

If something went wrong and the EEPROM is empty, we got you covered. Head over to the Using the PHYTEC EEPROM Flashtool guide.