comparison doc/FTDI-chip-ID @ 67:742c41f44658

doc/FTDI-chip-ID: new article
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 13 Sep 2023 00:43:14 +0000
parents
children
comparison
equal deleted inserted replaced
66:85256d5aa559 67:742c41f44658
1 Q: How do various standard software components (ftdi_sio driver in the Linux
2 kernel, libftdi etc) identify what kind of FTDI chip they are talking to?
3 For example, how do they tell apart between FT2232C/D and FT2232H with their
4 respective differences in features and capabilities?
5
6 A: They look primarily at the bcdDevice word in the USB device descriptor. One
7 can also look at bNumInterfaces in the configuration descriptor (more
8 reliable, as will be seen momentarily) to distinguish between single-channel
9 vs dual-channel vs 4-channel devices, but bcdDevice is still the only way to
10 tell apart between FT232BM and FT232R, or between FT2232C/D and FT2232H.
11
12 However, this all-important bcdDevice word exhibits a very noteworthy quirk: it
13 is included in FTDI's EEPROM configuration structure, thus it can be overridden
14 through EEPROM programming. The result is that at least on some FTDI chips (so
15 far I've only tested this quirk on FT2232D) one can make the chip report a
16 different bcdDevice code than its true chip version, and thus fool standard
17 host software! Needless to say, doing so is a very bad idea: the actual
18 behavior of the chip, the way it acts upon various bits in the EEPROM config
19 structure and the way it reacts to various USB commands, does not change just
20 because you changed the "device release number" code, thus various host control
21 functions will start misbehaving and failing in mysterious ways.
22
23 Our FTDI EEPROM tools (see FTDI-EEPROM-tools article) often need to know what
24 kind of FTDI chip you are working with as in reading, programming or preparing
25 an EEPROM image for. Most competitor tools (for example, the ones integrated
26 into libftdi) do the same thing as all other standard host software components:
27 they look at the reported bcdDevice and use this code to decide what kind of
28 FTDI chip they are working with - hence they will be misled and broken if this
29 word is misprogrammed in an EEPROM. To avoid this issue, our FTDI EEPROM tools
30 follow a different design: with our tools you as the operator are responsible
31 for knowing what kind of FTDI chip you are working with - our tools do NOT
32 attempt to autodetect the chip, as it is impossible to do so in an environment
33 that may include badly corrupted or misprogrammed EEPROMs. Specifically, you
34 are responsible for manually selecting the correct generator tool (for example,
35 ftee-gen2232c vs ftee-gen2232h in the case FT2232x) and manually specifying
36 your EEPROM size with -b or -B options if you are working with a board design
37 that uses a 93C56 or 93C66 EEPROM.
38
39 This largely-manual design of our FTDI EEPROM tools makes them less friendly to
40 casual users, but in return they should be able to recover from any possible
41 EEPROM corruption or misprogramming, accidental or malicious.