Skip to content
Snippets Groups Projects
Commit 579646e4 authored by Paul Boven's avatar Paul Boven Committed by Adam Wujek
Browse files

userspace/libwr: Fixes to make shw_write_sfp() actually write SFP eeproms


The SFP documentation "INF-8047.pdf" states:
"The serial interface uses the 2-wire serial CMOS E2PROM protocol defined for
the ATMEL AT24C01A/02/04 family of components."

Upon reading that datasheet, some important details stand out:
1) The eeprom can only write in pages, with pages being 8 or 16 bytes. Assuming
   the smallest device, you can only write 8 bytes at a time. To be safe, I'm
   assuming a pagesize of 8 bytes.

   This explains why we only saw stuff change in the first 8 bytes, I guess.

2) A write needs to be preceded by the byte address which is a single byte for
   these devices, and then up to 8 (or 16) data bytes to be written at that
   location. If there are more bytes, or if the data wraps around the page
   binary, it will still only end up on the page belonging to that first
   address.

3) After writing, you need to poll the eeprom to see if it has finished writing
   the byte. At the moment, I'm not doing that yet, instead I'm doing a 10ms
   wait which seems sufficient.

Signed-off-by: default avatarPaul Boven <boven@jive.eu>
Acked-by: default avatarAdam Wujek <adam.wujek@cern.ch>
parent 3f05b29c
Branches
Tags
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment