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