The phyCORE-i.MX7 SOM comes equipped with an onboard 4kB EEPROM and the phyBOARD-i.MX7 development kit also features an additional EEPROM on the PEB-D-RPI Expansion Board. The devices are connected to the I2C0 interface at address 0x50 and 0x56 respectively. This guide provides instructions on how to interact with the EEPROM on board the SOM in Linux.
First ensure that the EEPROM was initialized correctly by checking the boot log.
dmesg | grep -i "eeprom"CODE
root@imx7d-phyboard-zeta-004:~# dmesg | grep -i "eeprom" [ 1.318477] at24 0-0050: 4096 byte 24c32 EEPROM, writable, 32 bytes/writeCODE
This confirms that the EEPROM has 4096 bytes available at address 0x50.
Clear out the EEPROM:
dd if=/dev/zero of=/sys/bus/i2c/devices/0-0050/eeprom bs=4096 count=1CODE
Now generate a random 4kB file:
dd if=/dev/urandom of=/tmp/test1.img bs=4096 count=1CODE
Now write this file to the EEPROM:
dd if=/tmp/test1.img of=/sys/bus/i2c/devices/0-0050/eeprom bs=4096 count=1CODE
Read the file back:
dd if=/sys/bus/i2c/devices/0-0050/eeprom of=/tmp/test2.img bs=4096 count=1CODE
Now ensure that both the original file and the file that was copied back match:
md5sum /tmp/test1.img && md5sum /tmp/test2.imgCODE
root@imx7d-phyboard-zeta-004:~# md5sum /tmp/test1.img && md5sum /tmp/test2.img 81ad66df7f773128aef1ec7966180ebf /tmp/test1.img 81ad66df7f773128aef1ec7966180ebf /tmp/test2.imgCODE
Repeating the above steps with the address 0-0056 will similarly utilize the EEPROM on the Expansion Board.