Hi, Marius Kintel wrote: > o Corrected writing to EEPROM (only tested on FT232R)
I can verify that this works on FT232R here. I found a document that describes the FT232R programming: http://www.ftdichip.com/Documents/AppNotes/AN_105_FTDI_Device_Programming_Using_Vinculum_VNC1L(FT_000078).pdf In section 4.3.3 "Writing to the EEPROM of an FTxxxR chip" it says three things of interest: - The latency timer must be set to 77ms for programming to work (this is what you and I both determined by tracing MProg) - Erasing an internal EEPROM is not supported (as you noted) - The EEPROM is programmed in 32-bit words, so you need to write two 16-bit values before an actual write is triggered. This would affect us if we tried to write a single location, but since we write the whole thing, it's not a problem. (as they say, "Writing data to the EEPROM starting at the first location and finishing at the last location, the conditions for writing two words at a time in order are met") Some comments: > From c4d60f651ac565d2a155185a8672cca6e3a18423 Mon Sep 17 00:00:00 2001 > From: Marius Kintel <[email protected]> > Date: Mon, 2 Mar 2009 17:36:14 +0100 > Subject: [PATCH 4/6] Correct writing of EEPROM > > - unsigned short usb_val; > + unsigned short usb_val, status; > int i; > > + /* These commands were traced while running MProg */ > + ftdi_usb_reset(ftdi); > + ftdi_poll_modem_status(ftdi, &status); > + ftdi_set_latency_timer(ftdi, 0x77); ftdi_usb_reset and ftdi_poll_modem_status are unnecessary here > From b8329ee90ab2018e71322f941284965691ac3161 Mon Sep 17 00:00:00 2001 > From: Marius Kintel <[email protected]> > Date: Mon, 2 Mar 2009 18:37:36 +0100 > Subject: [PATCH 6/6] Cleanup of decode function ... > +/** > + Decode binary EEPROM image into an ftdi_eeprom structure. > + > + \param eeprom Pointer to ftdi_eeprom which will be filled in. > + \param output Buffer of \a size bytes of raw eeprom data > + \param size size size of eeprom data in bytes > + > + \retval 0: all fine > + \retval -1: something went wrong > + > + FIXME: How to pass size? How to handle size field in ftdi_eeprom? > + FIXME: Strings are malloc'ed here and should be freed somewhere > +*/ > +void ftdi_eeprom_decode(struct ftdi_eeprom *eeprom, unsigned char *buf, int > size) you return values but the function is void -jim -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
