libftdi Archives

Subject: FT232H: Issues flashing empty EEPROM with ftdi_eeprom (libftdi-HEAD-3eca515)

From: Matthias Szusdziara <matthias.szusdziara@xxxxxxxxx>
To: <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 30 Sep 2019 08:45:24 +0200 (CEST)
Hi all,

I recently came across an issue with the FT232H when trying to flash an
empty EEPROM (Chip used: 93LC56BT).

When flashing an empty EEPROM the size of the chip is not determined
properly. Hence the correct values get flashed to the wrong location.
Specificly, everything anything that's supposed to be sent off to 7-bit
eeprom address 0x70 onward actually gets sent to 0x30 onwards. (That is
the most significant address bit is not set properly.)

Repeating flashing procedure (without erasing first) works as the size
gets determined properly then.

The other way of getting the size determined properly is calling
ftdi_erase_eeprom() first which has a size determination algorithm.

The way I went with was changing line 570 of ftdi_eeprom/main.c from
    if (command == COMMAND_ERASE)
to
    if ((command == COMMAND_ERASE) || (command == COMMAND_FLASH))

After all, (re-)flashing the chip requires deleting any existing data, so
this did the trick for me.
I am not sure if there are any edge cases where erasing the whole chip is
undesirable.


As a side note: It would be nice to have chip size refactored in
src/ftdi.c so the size of the various chips isn't hardcoded in more than
one spot.
(I suggest a function that takes chip type id as parameter and returns
size or values <0 in case of error.)

Kind regards,
Matthias



--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread