how to read the BBB EEPROM using the "i2c" u-boot command?

2,694 views
Skip to first unread message

Robert P. J. Day

unread,
Apr 8, 2015, 10:14:23 AM4/8/15
to BeagleBoard list

seeing differing opinions online ... if you read this:

https://e2e.ti.com/support/arm/sitara_arm/f/791/t/233139

i should be able to display the first few bytes of the BBB's EEPROM
from u-boot using:

i2c md 0x50 0 16

but, for me, that just displays "ff" throughout, which is what *other*
people claim to see when they try it.

should this command work? do i need to initialize something first?
am i (theoretically) using the correct arguments?

rday

--

========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================

Robert Nelson

unread,
Apr 8, 2015, 10:23:15 AM4/8/15
to Beagle Board
On Wed, Apr 8, 2015 at 9:14 AM, Robert P. J. Day <rpj...@crashcourse.ca> wrote:
>
> seeing differing opinions online ... if you read this:
>
> https://e2e.ti.com/support/arm/sitara_arm/f/791/t/233139
>
> i should be able to display the first few bytes of the BBB's EEPROM
> from u-boot using:
>
> i2c md 0x50 0 16
>
> but, for me, that just displays "ff" throughout, which is what *other*
> people claim to see when they try it.
>
> should this command work? do i need to initialize something first?
> am i (theoretically) using the correct arguments?

U-Boot# i2c probe
Valid chip addresses: 24 34 50
U-Boot# i2c md 0x24 0 16
0000: e2 3f 00 01 b1 80 b2 01 00 00 08 00 7f 0c 18 11 .?..............
0010: 09 06 09 38 26 3f ...8&?
U-Boot# i2c md 0x34 0 16
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0010: 00 00 00 00 00 00 ......
U-Boot# i2c md 0x50 0 16
0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
0010: ff ff ff ff ff ff ......

Regards,

--
Robert Nelson
https://rcn-ee.com/

Robert P. J. Day

unread,
Apr 8, 2015, 10:33:43 AM4/8/15
to Beagle Board
ok, you're seeing what i'm seeing but shouldn't that last command
print the first 16 bytes of the EEPROM (header, board name, version)?
if i boot into linux, and:

# cd /sys/devices/ocp.3/44e0b000.i2c/i2c-0/0-0050

then i can certainly dump what corresponds to the EEPROM:

# hexdump -C eeprom | less
00000000 aa 55 33 ee 41 33 33 35 42 4e 4c 54 30 41 35 43 |.U3.A335BNLT0A5C|
00000010 32 37 31 33 42 42 42 4b 37 35 37 31 ff ff ff ff |2713BBBK7571....|
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
... snip ...

so can i not do that from within u-boot?

Robert P. J. Day

unread,
Apr 8, 2015, 10:57:55 AM4/8/15
to Beagle Board
On Wed, 8 Apr 2015, Robert Nelson wrote:

> U-Boot# i2c md 0x50 0x0c.2
> 000c: 30 30 30 43 32 34 31 34 42 42 42 4b 30 31 30 33 000C2414BBBK0103

ah, i overlooked the need for the ".2" suffix, to specify that
the chip uses 2 bytes for addresses. my bad. movin' on ...

Robert P. J. Day

unread,
Apr 8, 2015, 11:44:15 AM4/8/15
to Beagle Board
On Wed, 8 Apr 2015, Robert Nelson wrote:

> U-Boot# i2c md 0x50 0x0c.2
> 000c: 30 30 30 43 32 34 31 34 42 42 42 4b 30 31 30 33 000C2414BBBK0103

and just to clarify an earlier curiosity of mine, is it true that
u-boot's "eeprom" command has no relevance here? i've never used that
command but it seems that BBB EEPROM access must be done exclusively
via i2c, correct?

Robert Nelson

unread,
Apr 8, 2015, 11:54:15 AM4/8/15
to Beagle Board
On Wed, Apr 8, 2015 at 10:44 AM, Robert P. J. Day <rpj...@crashcourse.ca> wrote:
> On Wed, 8 Apr 2015, Robert Nelson wrote:
>
>> U-Boot# i2c md 0x50 0x0c.2
>> 000c: 30 30 30 43 32 34 31 34 42 42 42 4b 30 31 30 33 000C2414BBBK0103
>
> and just to clarify an earlier curiosity of mine, is it true that
> u-boot's "eeprom" command has no relevance here? i've never used that
> command but it seems that BBB EEPROM access must be done exclusively
> via i2c, correct?

Well, it is wired up:

204 #define CONFIG_CMD_EEPROM
205 #define CONFIG_ENV_EEPROM_IS_ON_I2C
206 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
207 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
208 #define CONFIG_SYS_I2C_MULTI_EEPROMS

and looking at:

http://lists.denx.de/pipermail/u-boot/2007-September/025043.html

The i2c md command is just more useful....

Robert Nelson

unread,
Apr 8, 2015, 11:56:07 AM4/8/15
to Beagle Board
Great way to reset the board. ;)

U-Boot# eeprom read 0x50 0 0 10

EEPROM @0x50 read: addr 00000000 off 0000 count 16 ... I2C read:
NULL pointer passed
done
U-Boot# md 0
00000000:data abort
pc : [<9ff8ac3c>] lr : [<9ff8ac10>]
reloc pc : [<8083ec3c>] lr : [<8083ec10>]
sp : 9ef2bce0 ip : 00000000 fp : 00000000
r10: 00000000 r9 : 9ef2bed8 r8 : 00000000
r7 : 00000004 r6 : 00000004 r5 : 00000004 r4 : 00000040
r3 : 44e09000 r2 : 44e09000 r1 : 9ef2bcf4 r0 : 00000009
Flags: nZCv IRQs off FIQs on Mode SVC_32
Resetting CPU ...

resetting ...

U-Boot SPL 2015.04-rc5-00002-g252073b (Apr 07 2015 - 10:00:16)

Robert P. J. Day

unread,
Apr 8, 2015, 12:00:24 PM4/8/15
to Beagle Board
On Wed, 8 Apr 2015, Robert Nelson wrote:

> On Wed, Apr 8, 2015 at 10:44 AM, Robert P. J. Day <rpj...@crashcourse.ca> wrote:
> > On Wed, 8 Apr 2015, Robert Nelson wrote:
> >
> >> U-Boot# i2c md 0x50 0x0c.2
> >> 000c: 30 30 30 43 32 34 31 34 42 42 42 4b 30 31 30 33 000C2414BBBK0103
> >
> > and just to clarify an earlier curiosity of mine, is it true that
> > u-boot's "eeprom" command has no relevance here? i've never used that
> > command but it seems that BBB EEPROM access must be done exclusively
> > via i2c, correct?
>
> Well, it is wired up:
>
> 204 #define CONFIG_CMD_EEPROM
> 205 #define CONFIG_ENV_EEPROM_IS_ON_I2C
> 206 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
> 207 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
> 208 #define CONFIG_SYS_I2C_MULTI_EEPROMS
>
> and looking at:
>
> http://lists.denx.de/pipermail/u-boot/2007-September/025043.html
>
> The i2c md command is just more useful....

ah, i never noticed that, good to know, thanks. i suspect i really
need to review all of my u-boot ...

smith.wi...@gmail.com

unread,
Apr 8, 2015, 11:06:57 PM4/8/15
to beagl...@googlegroups.com
On Wednesday, April 8, 2015 at 10:14:23 AM UTC-4, Robert P. J. Day wrote:

  seeing differing opinions online ... if you read this:

https://e2e.ti.com/support/arm/sitara_arm/f/791/t/233139

i should be able to display the first few bytes of the BBB's EEPROM
from u-boot using:

 i2c md 0x50 0 16

but, for me, that just displays "ff" throughout, which is what *other*
people claim to see when they try it.

  should this command work? do i need to initialize something first?
am i (theoretically) using the correct arguments?


I wrote this C utility a while ago to read the BBB eeprom for the model & serial #s:


It works on both Debian (Jessie) and FreeBSD!  It uses ioctl()'s to read 28 bytes from slave addr 0x50 on i2c-0.


-W


Robert P. J. Day

unread,
Apr 9, 2015, 7:46:49 AM4/9/15
to beagl...@googlegroups.com
ah, very nice, thanks.

smith.wi...@gmail.com

unread,
Apr 11, 2015, 12:45:06 PM4/11/15
to beagl...@googlegroups.com
On Thursday, April 9, 2015 at 7:46:49 AM UTC-4, Robert P. J. Day wrote:

> It works on both Debian (Jessie) and FreeBSD!  It uses ioctl()'s to
> read 28 bytes from slave addr 0x50 on i2c-0.

  ah, very nice, thanks.

The nice thing is that you don't have to be root to use it -- just a member of the i2c group.  Reading from /sys/bus/i2c/devices/0-0050 can only be done by root. 

Robert Nelson

unread,
Apr 8, 2015, 10:41:03 AM4/8/15
to Beagle Board
U-Boot# i2c md 0x50 0x0c.2
000c: 30 30 30 43 32 34 31 34 42 42 42 4b 30 31 30 33 000C2414BBBK0103

Reply all
Reply to author
Forward
0 new messages