libftdi Archives

Subject: EEPROM handling work

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 15 Sep 2010 18:26:30 +0200

appended tar file contains 78 git patches that bring libftdi EEPROM handling
to a state that lets me read and write FT2232C/FT232R and FT2232H on
different boards with different setting with no error found yet when
decoding later with FTDI tools. 

Usage pattern is like
 * (open device)
 *  ftdi_eeprom_initdefaults(ftdi, "My_MANU","MY_DESC","MY_Serial")
    with libftdi setting values according to ftdi->type
 * change ftdi->eeprom->xx items according to local needs
 * ftdi_erase_eeprom()
    where the connected EEPROM is checked for type (none, internal on
    FT232R, 93x46, 93x56 or 93x66), as EEPROM chip size influences 
    EEPROM layout
 * ftdi_write_eeprom()

As nearly all EEPROM handling needs to know ftdi->type and usage of
ftdi->error_str comes handy, I changed the API to work on struct
ftdi-context. "struct eeprom" and string buffer handling is now done inside
libftdi, so some APIs formerly needed to (intransparently) manipulate these
items are removed.

ftdi_write_eeprom_location() now checks that the requested location is above
the checksum protected area ending at 0x7f and the connected EEPROM is type
93x66, as otherwise the checksum protected area is written without update of
the checksum and the FTDI chip will not use EEPROM content on next

Some User area functions to access free EEPROM space in the checksum
protected area below 0x80, like provided by ftd2xx _UAxx functions, may come
handy but are not yet provided.

In the examples directory the eeprom.c file allows to 
* read the EEPROM ("eeprom")
* dump the EEPROM content that would be written ("eeprom -d") as the result of 
  calling ftdi_eeprom_initdefaults for the connected FTDI chip
* erase ("eeprom -e") 
* write the eeprom ("eeprom -w")
Use at your own risk, as wrong settings may result in FTDI boards no longer
able to enumerate. You need to unsolder the EEPROM and solder a clean chip
in that case.

Command line options allow to specify the value for ftdi_usb_open_desc() to
select a specific device when several FTDI devices are connected to the same

I propose also to move all EEPROM related code to a seperate file, as ftdi.c
is quite big now

Please let me know comments, issues, improvement and fixes.

Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

libftdi - see for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Attachment: out.tar.gz
Description: Binary data

Current Thread