[PATCH] FT232R and FT245R EEPROM user area size check

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] FT232R and FT245R EEPROM user area size check

Robin Haberkorn
Hello,

I'm working on the libftdi Git head.
I found that ftdi_eeprom_build's user area size check for type R chips
is too restrictive. See the patch attached and
http://www.ftdichip.com/Support/Documents/AppNotes/AN_121_FTDI_Device_EEPROM_User_Area_Usage.pdf

Best regards,
Robin


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

type_r_user_area_space_fix.patch (958 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] FT232R and FT245R EEPROM user area size check

Jim Paris
Hi Robin,

See doc/EEPROM-structure, and git commit a45ea32b4ffd.  I believe the
existing code intentionally goes against what AN_121 describes, as
written in that doc.

Either way, the _230X is decribed in its datasheet sa having an
identical EEPROM structure as the _R, so any patch that treats them
differently is probably not correct.

Jim

Robin Haberkorn wrote:

> Hello,
>
> I'm working on the libftdi Git head.
> I found that ftdi_eeprom_build's user area size check for type R
> chips is too restrictive. See the patch attached and http://www.ftdichip.com/Support/Documents/AppNotes/AN_121_FTDI_Device_EEPROM_User_Area_Usage.pdf
>
> Best regards,
> Robin
>
>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to
> [hidden email]

> commit 41cbc9f98f242e273fa48c8043f3089f298f2fd5
> Author: Robin Haberkorn <[hidden email]>
> Date:   Thu Jan 8 22:37:25 2015 +0100
>
>     fixed EEPROM user-area space checks for FT232R and FT245R chips in ftdi_eeprom_build()
>    
>     according to FTDI Application Note 121 ("Accessing the EEPROM User Area Of FTDI
>     Devices"), the FT232R and FT245R chips have a total 48 words (96 bytes) of
>     user area space available for descriptive strings.
>
> diff --git a/src/ftdi.c b/src/ftdi.c
> index 47e6959..ea487d0 100644
> --- a/src/ftdi.c
> +++ b/src/ftdi.c
> @@ -2604,6 +2604,8 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
>              user_area_size = 90;     // two extra config bytes and 4 bytes PnP stuff
>              break;
>          case TYPE_R:
> +            user_area_size = 96;
> +            break;
>          case TYPE_230X:
>              user_area_size = 88;     // four extra config bytes + 4 bytes PnP stuff
>              break;


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] FT232R and FT245R EEPROM user area size check

Robin Haberkorn
Hi Jim,

On 15.01.2015 02:35, Jim Paris wrote:
> Hi Robin,
>
> See doc/EEPROM-structure, and git commit a45ea32b4ffd.  I believe the
> existing code intentionally goes against what AN_121 describes, as
> written in that doc.
>
After some investigation, I think there's a misunderstanding.
Yes, it appears as if 4 bytes after the serial number are reserved. This
means that the statement in AN121 "Start Address = the address following
the last byte of SerialNumber string." is wrong.

However, I think there's still 96 bytes of user area since it all adds
up nicely -- the 4 extra bytes appear to be aken care of arleady in the
48 word user area as stated by AN121.
There are 128 bytes of internal EEPROM in total (AN121).
The descriptive strings begin at byte 0x1C (=28) in the EEPROMs I have
at hand (both written with FTProg and ftdi_eeprom).

28 + 48*2 + 4 = 128

Also I found out about this because I wanted to reproduce an EEPROM
written originally with FT Prog using ftdi_eeprom. The strings initially
written by FT Prog (45 characters) turned out to be 1 character (2
bytes) too long for libftdi's userarea space check (which was 88 bytes =
44 words).

With "FT Prog" I can write up to 48 characters which is exactly what
AN121 states.
If "FT Prog" (which I assume is based on FTD2XX) doesn't get it right,
who does?

> Either way, the _230X is decribed in its datasheet sa having an
> identical EEPROM structure as the _R, so any patch that treats them
> differently is probably not correct.

You mean this datasheet:
http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT230X.pdf

It does not say its EEPROM/MTP layout is identical to type-R chips.
It does say:
"The MTP memory on all FT-X devices can be programmed over USB. This
method is the same as for the EEPROM on other FTDI devices such as the
FT232R." (p.33)

It does not give any details about the EEPROM/MTP memory layout, not to
mention about the available user area space.

Perhaps the other chip's user area space checks in libftdi should also
be reviewed, based on what "FT Prog" or FT_EE_UASize() reports.

>
> Jim
>

Best regards,
Robin

--
Robin Haberkorn
Developer

metraTec GmbH
Werner-Heisenberg-Str. 1
39106 Magdeburg
Germany

[hidden email]
www.metratec.com

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] FT232R and FT245R EEPROM user area size check

Robin Haberkorn
Hi again,

On 15.01.2015 22:50, Robin Haberkorn wrote:
>
 > ...
 >
> Perhaps the other chip's user area space checks in libftdi should also
> be reviewed, based on what "FT Prog" or FT_EE_UASize() reports.
> ...
 >
I can confirm the 44 character (88 byte) limit on FT230X using "FT
Prog". So at least this number appears to be correct.

Regards,
Robin

--
Robin Haberkorn
Developer

metraTec GmbH
Werner-Heisenberg-Str. 1
39106 Magdeburg
Germany

[hidden email]
www.metratec.com

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: [PATCH] FT232R and FT245R EEPROM user area size check

Thomas Jarosch
In reply to this post by Robin Haberkorn
Hi Robin,

> > See doc/EEPROM-structure, and git commit a45ea32b4ffd.  I believe the
> > existing code intentionally goes against what AN_121 describes, as
> > written in that doc.
>
> After some investigation, I think there's a misunderstanding.
> Yes, it appears as if 4 bytes after the serial number are reserved. This
> means that the statement in AN121 "Start Address = the address following
> the last byte of SerialNumber string." is wrong.
>
> However, I think there's still 96 bytes of user area since it all adds
> up nicely -- the 4 extra bytes appear to be aken care of arleady in the
> 48 word user area as stated by AN121.
> There are 128 bytes of internal EEPROM in total (AN121).
> The descriptive strings begin at byte 0x1C (=28) in the EEPROMs I have
> at hand (both written with FTProg and ftdi_eeprom).
>
> 28 + 48*2 + 4 = 128
>
> Also I found out about this because I wanted to reproduce an EEPROM
> written originally with FT Prog using ftdi_eeprom. The strings initially
> written by FT Prog (45 characters) turned out to be 1 character (2
> bytes) too long for libftdi's userarea space check (which was 88 bytes =
> 44 words).
>
> With "FT Prog" I can write up to 48 characters which is exactly what
> AN121 states.
> If "FT Prog" (which I assume is based on FTD2XX) doesn't get it right,
> who does?

that argument sounds sane to me.

@Jim, are you ok with that, too?

> > Either way, the _230X is decribed in its datasheet sa having an
> > identical EEPROM structure as the _R, so any patch that treats them
> > differently is probably not correct.
>
> You mean this datasheet:
> http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT230X.pdf
>
> It does not say its EEPROM/MTP layout is identical to type-R chips.
> It does say:
> "The MTP memory on all FT-X devices can be programmed over USB. This
> method is the same as for the EEPROM on other FTDI devices such as the
> FT232R." (p.33)
>
> It does not give any details about the EEPROM/MTP memory layout, not to
> mention about the available user area space.
>
> Perhaps the other chip's user area space checks in libftdi should also
> be reviewed, based on what "FT Prog" or FT_EE_UASize() reports.

may be, yes. OTOH this should only be done if someone
has the hardware at hand to test the changes (like you did).

Cheers,
Thomas


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: [PATCH] FT232R and FT245R EEPROM user area size check

Jim Paris
Thomas Jarosch wrote:

> Hi Robin,
>
> > > See doc/EEPROM-structure, and git commit a45ea32b4ffd.  I believe the
> > > existing code intentionally goes against what AN_121 describes, as
> > > written in that doc.
> >
> > After some investigation, I think there's a misunderstanding.
> > Yes, it appears as if 4 bytes after the serial number are reserved. This
> > means that the statement in AN121 "Start Address = the address following
> > the last byte of SerialNumber string." is wrong.
> >
> > However, I think there's still 96 bytes of user area since it all adds
> > up nicely -- the 4 extra bytes appear to be aken care of arleady in the
> > 48 word user area as stated by AN121.
> > There are 128 bytes of internal EEPROM in total (AN121).
> > The descriptive strings begin at byte 0x1C (=28) in the EEPROMs I have
> > at hand (both written with FTProg and ftdi_eeprom).
> >
> > 28 + 48*2 + 4 = 128
> >
> > Also I found out about this because I wanted to reproduce an EEPROM
> > written originally with FT Prog using ftdi_eeprom. The strings initially
> > written by FT Prog (45 characters) turned out to be 1 character (2
> > bytes) too long for libftdi's userarea space check (which was 88 bytes =
> > 44 words).
> >
> > With "FT Prog" I can write up to 48 characters which is exactly what
> > AN121 states.
> > If "FT Prog" (which I assume is based on FTD2XX) doesn't get it right,
> > who does?
>
> that argument sounds sane to me.
>
> @Jim, are you ok with that, too?

Sounds good to me.  Thanks for looking into it, Robin.

Jim

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: [PATCH] FT232R and FT245R EEPROM user area size check

Thomas Jarosch
In reply to this post by Robin Haberkorn
Hi Robin,

On Thursday, 15. January 2015 22:59:21 Robin Haberkorn wrote:
> On 15.01.2015 22:50, Robin Haberkorn wrote:
>  > ...
> >
> > Perhaps the other chip's user area space checks in libftdi should also
> > be reviewed, based on what "FT Prog" or FT_EE_UASize() reports.
> > ...
>
> I can confirm the 44 character (88 byte) limit on FT230X using "FT
> Prog". So at least this number appears to be correct.

I've applied your patch. Thanks for double-checking.

Regarding the CBUS patch: I'll revisit that next week when I've made up my
mind about the backwards compatibility. But I guess you have a point here,
too, since the FT230X support is pretty new.

Have a nice weekend,
Thomas


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Loading...