EEPROM
This guide will show you how to access the 2Kbit EEPROM featured on the phyCORE-AM62Ax development kit carrier board. To learn more information about the phyCORE-AM62Ax EEPROM system memory, please see section 6.1.2 in the Hardware Manual.
Note
The phyCORE-AM62Ax development kit provides access to two EEPROMs, 1x 32Kbit EEPROM on the SOM and a 2Kbit EEPROM on the carrier board.
Location |
Reference |
I2C Bus |
Address |
---|---|---|---|
SOM |
U20 |
i2c0 |
0x50 |
Carrier Board |
U38 |
i2c1 |
1x51 |
Verifying EEPROM Initialization
First ensure that the EEPROM is initialized correctly by checking the boot log.
dmesg | grep -i "eeprom"
root@phyboard-lyra-am62axx-2:~# dmesg | grep -i "eeprom" [ 6.049192] at24 0-0050: 4096 byte 24c32 EEPROM, writable, 32 bytes/write [ 6.090717] at24 1-0051: 256 byte 24c02 EEPROM, writable, 16 bytes/write
Writing to the EEPROM
Clear out the entirety of the EEPROM by writing zeros to it.
dd if=/dev/zero of=/sys/bus/i2c/devices/1-0051/eeprom bs=256 count=1
root@phyboard-lyra-am62axx-2:~# dd if=/dev/zero of=/sys/bus/i2c/devices/1-0051/eeprom bs=256 count=1 1+0 records in 1+0 records out 256 bytes copied, 0.0903406 s, 2.8 kB/s
Now generate a 2Kbit file with random data. This will serve as the test file:
dd if=/dev/urandom of=/tmp/test.img bs=256 count=1
root@phyboard-lyra-am62axx-2:~# dd if=/dev/urandom of=/tmp/test.img bs=256 count=1 1+0 records in 1+0 records out 256 bytes copied, 0.000203318 s, 1.3 MB/s
Write the test file to the EEPROM
dd if=/tmp/test.img of=/sys/bus/i2c/devices/1-0051/eeprom bs=512 count=1
root@phyboard-lyra-am62axx-2:~# dd if=/tmp/test.img of=/sys/bus/i2c/devices/1-0051/eeprom bs=256 count=1 0+1 records in 0+1 records out 256 bytes copied, 0.076665 s, 3.3 kB/s
Reading from EEPROM
Read the contents of the EEPROM and store it to a file.
dd if=/sys/bus/i2c/devices/1-0051/eeprom of=/tmp/test_read.img bs=256 count=1
root@phyboard-lyra-am62axx-2:~# dd if=/sys/bus/i2c/devices/1-0051/eeprom of=/tmp/test_read.img bs=256 count=1 1+0 records in 1+0 records out 256 bytes copied, 0.00792198 s, 32.3 kB/s
Make sure the output file was not corrupted during the transfer using md5sum.
md5sum /tmp/test.img /tmp/test_read.img
root@phyboard-lyra-am62axx-2:~# md5sum /tmp/test.img /tmp/test_read.img 192e08b78bc0100bcff74d324d1ccbde /tmp/test.img 192e08b78bc0100bcff74d324d1ccbde /tmp/test_read.img
Reading/Writing to the SOM EEPROM
The SOM EEPROM is used for PHYTEC’s Hardware Introspection, which allows to automatically load the correct software for the underlaying SOM configuration.
Do not modify the content, except the BSP doesn’t use the Hardware Introspection.