libftdi Archives

Subject: Re: EEPROM: calculate user_data_addr

From: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx, Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date: Tue, 1 Aug 2023 11:44:55 +0200
On Mon, Jul 31, 2023 at 1:53 PM Yegor Yefremov
<yegorslists@xxxxxxxxxxxxxx> wrote:
>
> I want to write ca. 25 bytes as user data (my FTDI chips are FT2232,
> FT4232 and FTX). What is my strategy to calculate the user_data_addr?
>
> If I set EEPROM defaults via ftdi_eeprom_initdefaults() providing only
> the product string. Then I perform ftdi_eeprom_build() and use its
> return value to calculate the user_data_addr like: eeprom->size -
> user_area_size
>
> But this doesn't work as with 128 byte EEPROM (FT2232/4232), the
> free_end is 26 and thus I get:
>
> "Warning, user data overlaps the strings area!"
>
> How should EEWriteUserArea() look like in libftdi1?
>
> And what about returning an error instead of printing a warning when
> the user data overlaps with the strings or generated data?

After adding debug output, I can see that free_start for the
TYPE_2232C chip is at 0x15 and free_end at 0x16. And this doesn't make
much sense as it is much smaller than user_area_size value.

According to the Application Note AN_121 [1], the user area starts
after the SerialNumber string (at least for the 128 bytes EEPROMs,
256 and 512 bytes EEPROM have another approach). Unfortunately, I
still cannot find the user area description for the FT-X series.

FT_000071 for the D2XX.dll describes the following routines handling
the user area:

FT_EE_UASize()
FT_EE_UARead()
FT_EE_UAWrite()

This would be useful to have them in libftdi.

[1] 
https://www.ftdichip.com/Documents/AppNotes/AN_121_FTDI_Device_EEPROM_User_Area_Usage.pdf
[2] 
https://ftdichip.com/wp-content/uploads/2020/08/D2XX_Programmers_GuideFT_000071.pdf

Yegor

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

Current Thread