pyftdi icon indicating copy to clipboard operation
pyftdi copied to clipboard

FtdiEeprom: missing "chip" option byte will make FT_PROG erase the EEPROM(!)

Open mikrodust-henrikp opened this issue 10 months ago • 1 comments

Hi there!

Was thinking of fixing this and pushing a PR but I'm unsure what's the correct fix and where...

The company I currently work for has a custom device with a few FT2232H chips on it which arrive from the factory with blank EEPROMs. We have used pyftdi to program them (I guess switching to FT_PROG on Windows would have been a wise choice but..it worked so..) but I noticed that if I opened FT_PROG on Windows and just did "Scan and parse.." the EEPROMs on all the FT2232H chips that had been programmed with pyftdi were erased(!) by FT_PROG.

So I spent some time debugging this and found that the "chip" property needs to be set. In our case, to 0x56 (since we have a 93LC56 attached to the 2232h). Setting that option makes the eeprom survive being scanned by FT_PROG.

The documentation maybe should also mention that erasing the EEPROM with erase byte 0xFF should only be done if you don't plan on calling initialize() because a lot of options that are not set by pyftdi will have meanings with 0xFF, so erasing with 0x00 seems to be a more sane choice.

And...it seems that bit 0x80 should always be set in "self_powered" option, now only the 0x40 mask is set when setting that option, but FT_PROG and other tools seems to always set the msb in that byte, and FT_PROG also doesn't recognize that the device is self powered when the byte is set to 0x40, but does if it's 0xC0.

mikrodust-henrikp avatar Feb 12 '25 13:02 mikrodust-henrikp

Hi,

Well to be honest I have not worked on this project for several months, as my spare free time is reduced to zero.

You can submit a patch/PR, maybe some other users can give it a try and provide some feedback. I can have a look at it as well, but I have really not time to test it at the moment unfortunately.

Thanks.

eblot avatar Feb 12 '25 13:02 eblot