Debian Codegraph @

doc/supported_hw/supported_prog/ft2232_spi.rst

raw
1 ==========
2 FT2232 SPI
3 ==========
4
5 flashrom supports the ``-p ft2232_spi`` (or ``-p ft2232spi`` in very old flashrom revisions) option
6 which allows you to use an FTDI FT2232/FT4232H/FT232H based device as external SPI programmer.
7
8 This is made possible by using `libftdi <http://www.intra2net.com/en/developer/libftdi/>`_.
9 flashrom autodetects the presence of libftdi headers and enables FT2232/FT4232H/FT232H support if they are available.
10
11 Currently known FT2232/FT4232H/FT232H based devices which can be used as SPI programmer
12 together with flashrom are described below.
13
14 DLP Design DLP-USB1232H
15 =======================
16
17 The `DLP Design DLP-USB1232H <http://www.dlpdesign.com/usb/usb1232h.shtml>`_
18 (`datasheet DLP-USB1232H <http://www.dlpdesign.com/usb1232h-ds-v13.pdf>`_) can be used with flashrom
19 for programming SPI chips.
20
21 Where to buy: `Digikey <https://www.digikey.com/>`_,
22 `Mouser <https://www.mouser.de/ProductDetail/?qs=sGAEpiMZZMt/5FJRvmqHBjWi/VTYGDW6>`_,
23 `Saelig <https://www.saelig.com/product/UB068.htm>`_
24
25 Setup
26 -----
27
28 DLP-USB1232H based SPI programmer schematics
29
30 .. image:: Dlp_usb1232h_spi_programmer.jpg
31
32 In order to use the DLP-USB1232H device as SPI programmer you have to setup a small circuit
33 (e.g. on a breadboard). See the schematics for details (you can also
34 `download the schematics as PDF <http://www.coreboot.org/images/2/26/Dlp_usb1232h_spi_programmer.pdf>`_
35 for easier printing).
36
37 What you will need
38 ------------------
39
40 =============== ======================= ============= ====== ===============================================
41 Quantity Device Footprint Value Comments
42 =============== ======================= ============= ====== ===============================================
43 1 DLP Design DLP-USB1232H — — ...
44 1 Breadboard — — ...
45 many Jumper wires — — ...
46 1 DIP-8 SPI chip — — This is the chip you want to program/read/erase
47 1 3.3V voltage regulator TO-220 3.3V E.g. **LD33V** or **LD1117xx**
48 1 Electrolytic capacitor single ended 100nF ...
49 1 Electrolytic capacitor single ended 10uF ...
50 =============== ======================= ============= ====== ===============================================
51
52 Instructions and hints
53 ----------------------
54
55 * You must connect/shorten pins 8 and 9, which configures the device to be powered by USB.
56 Without this connection it will not be powered, and thus not be detected by your OS
57 (e.g. it will not appear in the ``lsusb`` output).
58
59 * You need a 3.3V voltage regulator to convert the 5V from USB to 3.3V,
60 so you can power the 3.3V SPI BIOS chip.
61
62 * You can probably use pretty much any 3.3V voltage regulator, e.g. **LD33V** or **LD1117xx**.
63 For usage on a breadboard the TO-220 packaging is probably most useful.
64 * You have to connect two capacitors (e.g. 100nF and 10uF as per datasheets,
65 but using two 10uF capacitors, or even two 47uF capacitors also works in practice) as shown in the schematics,
66 otherwise the voltage regulator will not work correctly and reliably.
67
68 * Connect the following pins from the DLP-USB1232H to the SPI BIOS chip:
69
70 * **18 (SK)** to **SCLK**
71 * **16 (DO)** to **SI**
72 * **2 (DI)** to **SO**
73 * **5 (CS)** to **CS#**
74 * The **WP# and HOLD#** pins should be tied to **VCC**! If you leave them unconnected
75 you'll likely experience strange issues.
76 * All **GND** pins should be connected together (**pins 1i and 10** on the DLP-USB1232H,
77 **pin 8** on the SPI chip, **pin 1** on the voltage regulator).
78
79 You have to invoke flashrom with the following parameters::
80
81 $ flashrom -p ft2232_spi:type=2232H,port=A
82
83 Photos
84 ------
85
86 Module, top
87
88 .. image:: Dlp_usb1232h_side.jpg
89
90
91 Module, bottom
92
93 .. image:: Dlp_usb1232h_bottom.jpg
94
95
96 SPI header on a mainboard
97
98 .. image:: Via_epia_m700_bios.jpg
99
100
101 Module on a breadboard, connected to the mainboard's SPI header
102
103 .. image:: Via_epia_m700_programer.jpg
104
105
106 Breadboard setup
107
108 .. image:: Ft2232spi_programer.jpg
109
110
111 Another breadboard setup
112
113 .. image:: Dlp_usb1232h_spi_programmer_breadboard_1.jpg
114
115
116 Module and parts
117
118 .. image:: Dlp_usb1232h_spi_programmer_breadboard_2.jpg
119
120 FTDI FT2232H Mini-Module
121 ========================
122
123 The `FTDI FT2232H Mini-Module Evaluation Kit <http://www.ftdichip.com/Products/Modules/DevelopmentModules.htm#FT2232H%20Mini%20Module>`_
124 (`the datasheet <http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT2232H_Mini_Module.pdf>`_)
125 can be used with flashrom for programming SPI chips.
126
127 Pinout
128 ------
129
130 =============== ======= ======= =============== ===========================
131 Module Pin FTDI MPSSE SPI SPI Flash (vendor specific)
132 =============== ======= ======= =============== ===========================
133 CN2-7 AD0 TCK/SK (S)CLK (S)CLK
134 CN2-10 AD1 TDI/DO MOSI SI / DI
135 CN2-9 AD2 TDO/DI MISO SO / DO
136 CN2-12 AD3 TMS/CS /CS / /SS /CS
137 CN3-26 BD0 TCK/SK (S)CLK (S)CLK
138 CN3-25 BD1 TDI/DO MOSI SI / DI
139 CN3-24 BD2 TDO/DI MISO SO / DO
140 CN3-23 BD3 TMS/CS /CS / /SS /CS
141 =============== ======= ======= =============== ===========================
142
143 FTDI FT4232H Mini-Module
144 ========================
145
146 The `FTDI FT4232H Mini-Module Evaluation Kit <http://www.ftdichip.com/Products/Modules/DevelopmentModules.htm#FT4232H%20Mini%20Module>`_
147 (`datasheet <http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT4232H_Mini_Module.pdf>`_)
148 can be used with flashrom for programming SPI chips.
149
150 Olimex ARM-USB-TINY/-H and ARM-USB-OCD/-H
151 =========================================
152
153 The `Olimex <http://www.olimex.com/dev/index.html>`_ `ARM-USB-TINY <http://www.olimex.com/dev/arm-usb-tiny.html>`_
154 (VID:PID 15BA:0004) and `ARM-USB-OCD <http://www.olimex.com/dev/arm-usb-ocd.html>`_ (15BA:0003)
155 can be used with flashrom for programming SPI chips.
156 The `ARM-USB-TINY-H <http://www.olimex.com/dev/arm-usb-tiny-h.html>`_ (15BA:002A)
157 and `ARM-USB-OCD-H <http://www.olimex.com/dev/arm-usb-ocd-h.html>`_ (15BA:002B) should also work,
158 though the tested status is unconfirmed.
159
160 The following setup can then be used to flash a BIOS chip through SPI.
161
162 Pinout:
163
164 .. image:: ARM-USB-TINY_pinout.png
165
166 =============== =========================
167 Pin (JTAG Name) SPI/Voltage Source
168 =============== =========================
169 1 (VREF) VCC (from Voltage Source)
170 2 (VTARGET) VCC (to SPI target)
171 4 (GND) GND (from Voltage Source)
172 5 (TDI) SI
173 6 (GND) GND (to SPI target)
174 7 (TMS) CE#
175 9 (TCK) SCK
176 13 (TDO) SO
177 =============== =========================
178
179 On the ARM-USB-TINY, VREF, and VTARGET are internally connected, and all the GND lines
180 (even numbered pins, from 4 to 20) share the same line as well, so they can be used
181 to split VCC/GND between the voltage source and the target.
182
183 The voltage source should provide 3.0V to 3.3V DC but doesn't have to come from USB:
184 it can be as simple as two AA or AAA batteries placed in serial (2 x 1.5V).
185
186 Invoking flashrom
187 -----------------
188
189 You first need to add the ``-p ft2232_spi`` option, and then specify one of ``arm-usb-tiny``,
190 ``arm-usb-tiny-h``, ``arm-usb-ocd`` or ``arm-usb-ocd-f`` for the type.
191 For instance, to use an ARM-USB-TINY, you would use::
192
193 $ flashrom -p ft2232_spi:type=arm-usb-tiny
194
195 Openmoko
196 ========
197
198 The openmoko debug board (which can also do serial+jtag for the openmoko phones, or for other phones)
199 has `its shematics available here <http://people.openmoko.org/joerg/schematics/debug_board/OpenMoKo_Debug_Board_V3_MP.pdf>`_.
200
201 Informations
202 ------------
203
204 The openmoko debug board can act as an SPI programmer bitbanging the FTDI
205 (no need of an openmoko phone), you just need:
206
207 * a breadboard
208 * some wires
209 * The openmoko debug board(v2 and after,but only tested with v3)
210
211 The voltage is provided by the board itself. The connector to use is the JTAG one
212 (very similar to what's documented in the previous section(Olimex ARM-USB-TINY/-H and ARM-USB-OCD/-H )
213
214 Building
215 --------
216
217 **WARNING: This was tested with 3.3v chips only.**
218
219 Here's the pinout of the JTAG connector of the openmoko debug board
220 (copied from ARM-USB-tiny because it's the same pinout):
221
222 .. image:: ARM-USB-TINY_pinout.png
223
224 =============== =============================== ========================
225 Pin (JTAG Name) SPI/Voltage Source BIOS Chip connector name
226 =============== =============================== ========================
227 1 (VREF) VCC (from Voltage Source) VCC (3.3v only)
228 2 (VTARGET) VCC (to SPI target) Not connected
229 4 (GND) GND (from Voltage Source) Ground
230 5 (TDI) SI DIO (Data Input)
231 6 (GND) GND (to SPI target) Not connected
232 7 (TMS) CE# CS (Chip select)
233 9 (TCK) SCK CLK (Clock)
234 13 (TDO) SO DO (Data output)
235 =============== =============================== ========================
236
237 * Also connect the BIOS chip's write protect(WP) to VCC
238
239 * Also connect the BIOS chips's HOLD to VCC
240
241 Pictures
242 --------
243
244 .. image:: Openmoko_0001.jpg
245
246 .. image:: Openmoko_0002.jpg
247
248 .. image:: Openmoko_0003.jpg
249
250 Performances
251 ------------
252
253 ::
254
255 $ time ./flashrom/flashrom -p ft2232_spi:type=openmoko -r coreboot.rom
256 flashrom v0.9.5.2-r1545 on Linux 3.0.0-20-generic (x86_64)
257 flashrom is free software, get the source code at http://www.flashrom.org
258
259 Calibrating delay loop... OK.
260 Found Winbond flash chip "W25X80" (1024 kB, SPI) on ft2232_spi.
261 Reading flash... done.
262
263 real 0m19.459s
264 user 0m1.244s
265 sys 0m0.000s
266
267 ::
268
269 $ time ./flashrom/flashrom -p ft2232_spi:type=openmoko -w coreboot.rom
270 flashrom v0.9.5.2-r1545 on Linux 3.0.0-20-generic (x86_64)
271 flashrom is free software, get the source code at http://www.flashrom.org
272
273 Calibrating delay loop... OK.
274 Found Winbond flash chip "W25X80" (1024 kB, SPI) on ft2232_spi.
275 Reading old flash chip contents... done.
276 Erasing and writing flash chip... Erase/write done.
277 Verifying flash... VERIFIED.
278
279 real 1m1.366s
280 user 0m7.692s
281 sys 0m0.044s
282
283 Advantages/disadvantages
284 ------------------------
285
286 * fast(see above)
287
288 * easily available (many people in the free software world have openmoko debug board
289 and they don't know what to do with them), can still be bought
290
291 * stable
292
293 * SPI only
294
295 Generic Pinout
296 ==============
297
298 There are many more simple modules that feature the FT*232H.
299 Actual pinouts depend on each module, the FTDI names map to SPI as follows:
300
301 =============== ======= =============== ===========================
302 Pin Name MPSSE SPI SPI Flash (vendor specific)
303 =============== ======= =============== ===========================
304 DBUS0 TCK/SK (S)CLK (S)CLK
305 DBUS1 TDI/DO MOSI SI / DI
306 DBUS2 TDO/DI MISO SO / DO
307 DBUS3 TMS/CS /CS / /SS /CS
308 =============== ======= =============== ===========================