The phyCORE-AM65x 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.
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.
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"
echo "Hello World" > hello.imgCODE
Write the file (hello.img) to the EEPROM
dd if=hello.img of=/sys/class/i2c-dev/i2c-2/device/2-0050/eeprom bs=1 count=4096CODE
Read from the EEPROM
Dump the contents of the entire 4kB EEPROM
dd if=/sys/class/i2c-dev/i2c-2/device/2-0050/eeprom bs=1 count=4096 | hexdump -CCODE
If hello.img was written to the EEPROM in the previous step you should see the following output:
00000000 48 65 6c 6c 6f 20 57 6f 72 6c 64 0a 00 00 00 00 |Hello World.....| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00001000 4096+0 records in 4096+0 records outCODE
Erase the EEPROM
Write all zeros to the entire density of the EEPROM to erase the contents
dd if=/dev/zero of=/sys/bus/i2c/devices/2-0050/eeprom bs=4096 count=1CODE