BBB Reading/Writing EEPROM

1107 views
Skip to first unread message

Bryan Wilcutt

unread,
Jul 15, 2016, 11:47:54 AM7/15/16
to BeagleBoard
I've been playing with the BBB 32k eeprom by reading and writing data to it.  I use fseek(), fopen(), fread() and fwrite().  The device I am reading/writing/opening is:
/sys/bus/i2c/devices/0-0050/at24-0/nvmem

This does seem to work however not well.   I noticed that the same data is repeated every 0x1000 bytes.  Why is that?  Am I not addressing the part correctly?  Since I'm ultimately using the at24.c driver, I inspected it and it does seem to attempt to translate addresses for the part.  Are there specific limitations with at24 that I should be aware of, nothing seems to be documented that I've seen.

    #define e2FILE    "/sys/bus/i2c/devices/0-0050/at24-0/nvmem"

    int readEEPROMAt(unsigned char *p, unsigned int startAddr, unsigned int len)
    {
        int retVal = 0;
        FILE *fp = NULL;

        if ((fp = fopen(e2FILE, "r")) != NULL)
        {
                if (fseek(fp, startAddr, 0) == 0)
               {
                    if (fread(p, 1, len, fp) != len)
                         printf("Error: Cannot read EEPROM\n");
               else
                   retVal = 1;
       } else {
              printf("Error: Could not index EEPROM, no data read.");
        }
    } else {
        printf("Error: Cannot open EEPROM\n");
    }

    if (fp)
       fclose(fp);

    return retVal;
}

Bryan

Graham

unread,
Jul 15, 2016, 12:45:02 PM7/15/16
to BeagleBoard
Brian: 

You need to learn to speak "marketing" and "binary".

A 32 k EEPROM (named by marketing) is a 32k BIT EEPROM.

32k BITs divided by 8 bits-per-byte is 4k BYTES.

4k BYTES is 0x1000 BYTES.

So, your address space wraps around every 0x1000 BYTES.

The data is not repeated every 0x1000 bytes, it is the SAME data.

Sounds like your EEPROM is working just fine.

--- Graham

==

Bryan Wilcutt

unread,
Jul 15, 2016, 1:37:20 PM7/15/16
to BeagleBoard
Graham,
The part number is AT24c256 and a quick jot over to Atmel's trusty website and I found the spec sheet... "256K Serial Eeprom... organized as 512 pages of 64 bytes each."

So, that should mean 512x64 = 32,768 bytes... .32K. 
256k bits = 262,144 / 8 = 32,768 bytes... 32k. 

It's most certainly a 32k-byte part.

Thanks,
Bryan

Graham

unread,
Jul 15, 2016, 2:08:27 PM7/15/16
to BeagleBoard
OK. In that case it is a 32k Byte part.
--- Graham

==

Graham

unread,
Jul 15, 2016, 2:16:50 PM7/15/16
to BeagleBoard
Are the docs you are using up to date?

Reading the current SRM, (Version C.1) section 5.3.2 says that there is a single 4K Byte EEPROM on board the Beaglebone.

They mumble something about there having been a cost reduction.  :-)

--- Graham

==

William Hermans

unread,
Jul 15, 2016, 2:42:18 PM7/15/16
to beagl...@googlegroups.com
Graham,

I do not think he's talking about the on board eeprom.


Graham,
The part number is AT24c256 and a quick jot over to Atmel's trusty website and I found the spec sheet... "256K Serial Eeprom... organized as 512 pages of 64 bytes each."

But even if he is, the SRM says:

32k right on page 30:

5.3.2 32KB EEPROM

It also says 2G eMMC so it has to be in relationto a Rev A, or Rev B. However . . .since no ones asked, or mentioned the board revision number . . .

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/38c05665-c281-4cb2-a438-c133a39e2d5a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Bryan Wilcutt

unread,
Jul 15, 2016, 3:02:50 PM7/15/16
to BeagleBoard
I looked at the BOM... U7 is the part.  Lo and behold, Graham, you're right.   It's a 32k-BIT part.  The internet said it was a 24c256 part and dammit, we know the internet is NEVER EVER wrong on these things, therefore reality is wrong!   :-)

Explains the mirroring I'm seeing every 0x1000 bytes (4k) because the at24.c driver isn't smart enough to know it's limited, I think.  I knew something was up when I saw that in the memory dump.

Okay, mystery solved.  Thanks for your help!

Bryan

Graham

unread,
Jul 15, 2016, 4:00:50 PM7/15/16
to BeagleBoard
William: 
He is talking about the on board BBB EEPROM, because he overwrote the I.D. information, and it no longer boots.

Bryan:
Best I can tell, Rev B. and earlier did have a 32K Byte EEPROM, but they cost reduced it to 4K Byte with the Rev. C.

--- Graham

==

Mike

unread,
Jul 15, 2016, 4:57:39 PM7/15/16
to beagl...@googlegroups.com
I have an A6A, the BOM files lists a 32K Bit chip.

IC EEPROM 32KBIT 400KHZ SOT23-5, 24LC32AT-I/OT

Rev C. lists the same I believe...

Mike

William Hermans

unread,
Jul 15, 2016, 5:00:18 PM7/15/16
to beagl...@googlegroups.com
I guess whoever wrote the SRM doesn't realize that "KB" is an abbreviation for kilobytes. Kilobits is Kb or Kbit.

Anyhow I don't see anywhere where the OP says he rendered his BBB unbootable. However if this is the case, Download the *blank* flasher image, and it should rewrite the eeprom to factory specs.

--
For more options, visit http://beagleboard.org/discuss
--- You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

Mike

unread,
Jul 15, 2016, 5:20:40 PM7/15/16
to beagl...@googlegroups.com
On 07/15/2016 05:00 PM, William Hermans wrote:
> I guess whoever wrote the SRM doesn't realize that "KB" is an
> abbreviation for kilobytes. Kilobits is Kb or Kbit.
>
> Anyhow I don't see anywhere where the OP says he rendered his BBB
> unbootable. However if this is the case, Download the *blank* flasher
> image, and it should rewrite the eeprom to factory specs.
That was in another thread, same poster...

Mike
Reply all
Reply to author
Forward
0 new messages