annotate doc/FT232R-notes @ 105:b1bf0ec6fff5

fc-simtool: pb-dump: first round of bugfixes
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 25 Jan 2021 05:59:33 +0000
parents 026dd69e4ebb
children df4bf4e06221
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48
af70c59654ed EEPROM dumps moved into eeproms/dumps and properly annotated
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 Unlike FT2232x devices with external EEPROMs, an FT232R device is not expected
af70c59654ed EEPROM dumps moved into eeproms/dumps and properly annotated
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 to ever have a blank EEPROM in normal usage: these chips have their EEPROM
76
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
3 built in, and FTDI probably ships them with this internal EEPROM already
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
4 programmed. I said "probably" because I have not yet had an occasion to build
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
5 my own FT232R-containing board where I would be getting completely pristine
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
6 "bare" chips from Digi-Key, thus I have no first-hand verified knowledge.
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
7
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
8 As an experiment, I have programmed "blank" (0xFFFF in every word) images into
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
9 the two FT232R devices I have available for play at the moment (specifically
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
10 devices which I could afford to brick if things went badly), and FT232R behaves
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
11 the same way as FTDI's earlier chips with external EEPROMs: it runs with a fixed
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
12 default config when the EEPROM is invalid. But this configuration is NOT
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
13 recommended for production use - you should always have a valid EEPROM config
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
14 in your FT232R chip.
48
af70c59654ed EEPROM dumps moved into eeproms/dumps and properly annotated
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
76
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
16 When our FreeCalypso fteeprom tools were first put together in 2019-04, I was
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
17 getting erratic behaviour: when I tried to program my own EEPROM config
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
18 generated with ftee-gen232r, the resulting EEPROM content became a bitwise AND
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
19 between the previous image and the new one, as if the "EEPROM" is not really an
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
20 erasable memory, but one of OTP kind where ones can be turned into zeros, but
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
21 not the other way around. I was doing this experiment on a no-name FT232RL
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
22 adapter from ebay, thus my first thought was that the FT232RL chip was bad, a
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
23 less-than-perfect clone rather than genuine FTDI. But then I bought a UB232R
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
24 module from Digi-Key (presumably containing a genuine FT232RQ chip), and it
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
25 behaved the same way.
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
26
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
27 Further investigation revealed that FT232R EEPROM write operations work
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
28 correctly only if they are preceded by this magic sequence:
48
af70c59654ed EEPROM dumps moved into eeproms/dumps and properly annotated
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
76
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
30 ftdi_usb_reset(&ftdi);
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
31 ftdi_poll_modem_status(&ftdi, &modem_status);
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
32 ftdi_set_latency_timer(&ftdi, 0x77);
48
af70c59654ed EEPROM dumps moved into eeproms/dumps and properly annotated
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
76
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
34 I can see how FTDI could have reasonably implemented a sort of safety lock on
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
35 their EEPROM write operations, allowing them only if a special unlock sequence
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
36 has been given - but it completely baffles me why they are doing some sort of
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
37 OTP emulation in the absence of the right magic sequence, as opposed to
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
38 disabling EEPROM writes altogether. It is worth noting that this magic sequence
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
39 is NOT needed for programming external EEPROMs behind FT2232x chips - were FTDI
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
40 folks being deliberately malicious in designing their FT232R chip to simulate
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
41 appearance of being bricked when it is programmed with older (or third-party)
4e13c90c1405 eeproms/dumps/FT232R-notes: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents: 48
diff changeset
42 software tools that don't know the new magic sequence? Who knows...