EEPROM
This guide will show you how to access the 4kB EEPROM featured on the phyCORE-i.MX8X development kit carrier board.
Warning
The phyCORE-i.MX8X development kit provides access to three 4kB EEPROMs with two populated on the SOM and one on the carrier board.
The EEPROM located on the carrier board is connected to the I2C1 interface and has the device address 0x51.
Location |
Reference |
Address |
---|---|---|
Carrier Board |
U81 |
0x51 |
SOM |
U13 |
0x52 |
SOM |
U21 |
0x56 |
Verifying EEPROM Initialization
First ensure that the EEPROM is initialized correctly by checking the boot log. This confirms that kernel successfully registered the EEPROM with 4096 bytes available at address 0x51.
dmesg | grep -i "eeprom"
[ 2.213275] at24 16-0051: 4096 byte 24c32 EEPROM, writable, 32 bytes/write [ 2.231601] at24 17-0056: 4096 byte 24c32 EEPROM, writable, 32 bytes/write
Writing to EEPROM
Clear out the entirety of the EEPROM by writing zeros to it.
dd if=/dev/zero of=/sys/bus/i2c/devices/16-0051/eeprom bs=4096 count=1
1+0 records in 1+0 records out 4096 bytes (4.1 kB, 4.0 KiB) copied, 0.823113 s, 5.0 kB/s
Now generate a 4kB file with random data. This will serve as the test file:
dd if=/dev/urandom of=/tmp/test1.img bs=4096 count=1
1+0 records in 1+0 records out 4096 bytes (4.1 kB, 4.0 KiB) copied, 0.000300138 s, 13.6 MB/s
Write the test file to the EEPROM
dd if=/tmp/test1.img of=/sys/bus/i2c/devices/16-0051/eeprom bs=4096 count=1
1+0 records in 1+0 records out 4096 bytes (4.1 kB, 4.0 KiB) copied, 0.824812 s, 5.0 kB/s
Reading from EEPROM
Read the contents of the EEPROM and store it to a file.
dd if=/sys/bus/i2c/devices/16-0051/eeprom of=/tmp/test2.img bs=4096 count=1
1+0 records in 1+0 records out 4096 bytes (4.1 kB, 4.0 KiB) copied, 0.376402 s, 10.9 kB/s
Make sure the output file was not corrupted during the transfer using md5sum.
md5sum /tmp/test1.img md5sum /tmp/test2.img
a8bcb487045ce0e02b76901a51876179 /tmp/test1.img a8bcb487045ce0e02b76901a51876179 /tmp/test2.img