Writing EEPROM Using I2C Commands over U-Boot

Hi folks,

We have custom Am335x board with eeprom.We want to shape our eeprom like BeagleBone (I mean name,version,serial etc…).

I tried with U-Boot using I2C commands.You can see my logs below. Firstly i read my eeprom, then i tried to write byte by btye.Then i read again but nth happened.Then i tried to fill with 0xAA again it didnt succeed. How do you do it? By the way,I ported and used U-Boot 2011.09 for this purpose.I used i2c-tool over Linux but it says UU which means driver is used by Linux and it doesnt let me dump or anything else.

What do you suggest to move on?

Regards,
Buğra

U-Boot# i2c probe
Valid chip addresses: 24 48 4F 50 51
U-Boot# i2c dev 1
Setting bus to 1
U-Boot# i2c dev 0
Setting bus to 0
U-Boot# i2c md 0x50 0 0x10
0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff …
U-Boot# i2c mm 0x50 0
00000000: ff ? AA
00000001: ff ? BB
00000002: ff ? CC
00000003: ff ? DD
00000004: ff ? U-Boot#
U-Boot#
U-Boot#
U-Boot#
U-Boot# i2c md 0x50 0 0x10
0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff …
U-Boot#

U-Boot# i2c mw 0x50 0 0x10 0xAA
U-Boot# i2c md 0x50 0 0x10
0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff …

U-Boot# i2c md 0x50 0 0x10
0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff …

Is your EEPROM write protected?

Gerald

Hi Gerald,

No, it is not write protected.

I wrote my EEPROM over Linux using Sysfs last night.
I dont remember exactly (I dont have my development board right now) but it did sth like that

cd sys/bus/i2c/devices/1-0050/
echo 12345678 >eeprom

In case, the value which you wrote above is ASCII so you will see 31:32:33:34:35:36:37:38 in your EEPROM. Here is converter .(http://www.dolcevie.com/js/converter.html)

I think U-Boot I2C commands have some problems.It also doesnt always read BeagleBone’s EEPROM correctly.(%50 sucessfully show BeagleBone’s header and magic number.) . Maybe it is about U-Boot version. I also looked with scope, it really sent data to EEPROM but I dont know exactly.

As a result my problem is solved but it is more logicial to write EEPROM over U-Boot.

Regards,
Buğra

Have seen similar problems. Sometimes U-Boot has problems reading I2C EEPROM, on Robert Nelson version it even gives exception when changing to I2C 2 bus :slight_smile:

BTW it seems matter how you read the I2C, bytes, words, etc. I2C “Beagle” standard is 16 bits words and 16 bits addressing.

Does your I2C lines have sufficient pullups on them? Should be around 4.7K.

Gerald

Note that on mainline U-Boot (which I assume Robert’s build is based on), there’s also the eeprom command that will batch write from DRAM to the EEPROM. So you could use ‘mw’ to setup an area of memory with the right contents or even hexedit a file on your host and then load the file to memory, write the memory to EEPROM.

hi every body

valid command in uboot is i2c mw 0x50.0 AA 1 —>times of reading

0x50.0 write b
0x50.1 write w
0x50.2 write long

Hi

I don’t understand the what you mean by “write b” or “write long”. Could you please give the exact statements to execute? I believe the header the bootloader is looking for is “0xEE3355AA”. Is that correct?

Thanks and Regards,
Abhijeet

Hi Buğra AYDOĞAR,
you said “In case, the value which you wrote above is ASCII so you will see 31:32:33:34:35:36:37:38 in your EEPROM.”,but how I can see it

在 2012年10月31日星期三UTC+8下午2时39分12秒,Buğra AYDOĞAR写道:

Yes the eeprom write in U-boot wont work as they might be 16 bit adressses or 16 bit data
Modify the i2c driver to make it work in U-boot or write a new Uboot command to access the eeprom

Thanks
Kavitha