FT2232SPI Programmer: Difference between revisions

From flashrom
Jump to navigation Jump to search
(Replaced content with "{{#externalredirect: https://www.flashrom.org/supported_hw/supported_prog/ft2232_spi.html }}")
Tag: Replaced
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Recent versions of flashrom support the '''-p ft2232_spi''' (or '''-p ft2232spi''' in older flashrom revisions) option which allows you to use an '''FTDI FT2232/FT4232H''' based device as external SPI programmer.
{{#externalredirect: https://www.flashrom.org/supported_hw/supported_prog/ft2232_spi.html }}
 
This is made possible by using [http://www.intra2net.com/en/developer/libftdi/ libftdi]. flashrom autodetects the presence of libftdi headers and enables FT2232/FT4232H support if they are available.
 
We currently know of the following FT2232/FT4232H based devices which can be used as SPI programmer together with flashrom:
 
= DLP Design DLP-USB1232H =
 
The [http://www.dlpdesign.com/usb/usb1232h.shtml DLP Design DLP-USB1232H] ([http://www.dlpdesign.com/usb1232h-ds-v13.pdf datasheet]) can be used with flashrom for programming SPI chips.
 
Sidenote: The module can also be used as [http://www.randomprojects.org/wiki/DLP-USB1232H_and_OpenOCD_based_JTAG_adapter JTAG programmer with OpenOCD support].
 
Where to buy: [http://digikey.com/scripts/dksus.dll?Detail&name=813-1026-ND Digikey], [http://de.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMt/5FJRvmqHBjWi/VTYGDW6 Mouser], [http://www.saelig.com/product/UB068.htm Saelig]
 
'''Setup:'''
 
[[File:Dlp usb1232h spi programmer.jpg|300px|right|thumb|DLP-USB1232H based SPI programmer schematics]]
 
In order to use the DLP-USB1232H device as SPI programmer you have to setup a small circuit (e.g. on a breadboard). See the schematics for details (you can also [http://www.coreboot.org/images/2/26/Dlp_usb1232h_spi_programmer.pdf download the schematics as PDF] for easier printing).
 
'''What you will need:'''
 
{| border="0" style="background-color: #eeeeee; font-size: smaller"
|- bgcolor="#6699ff"
! align="left" | Quantity
! align="left" | Device
! align="left" | Footprint
! align="left" | Value
! align="left" | Comments
 
|- valign="top"
|- bgcolor="#eeeeee"
|| 1 || [http://www.dlpdesign.com/usb/usb1232h.shtml DLP Design DLP-USB1232H] || — || — || ...
 
|- valign="top"
|- bgcolor="#dddddd"
|| 1 || Breadboard || — || — || ...
 
|- valign="top"
|- bgcolor="#eeeeee"
|| many || Jumper wires || — || — || ...
 
|- valign="top"
|- bgcolor="#dddddd"
|| 1 || DIP-8 SPI chip || — || — || This is the chip you want to program/read/erase.
 
|- valign="top"
|- bgcolor="#eeeeee"
|| 1 || 3.3V voltage regulator || TO-220 || 3.3V || E.g. '''LD33V''' or '''LD1117xx'''.
 
|- valign="top"
|- bgcolor="#dddddd"
|| 1 || Electrolytic capacitor || single ended || 100nF || ...
 
|- valign="top"
|- bgcolor="#eeeeee"
|| 1 || Electrolytic capacitor || single ended || 10uF || ...
 
|}
 
'''Instructions and hints:'''
 
* You must connect/shorten '''pins 8 and 9''', which configures the device to be powered by USB. Without this connection it will not be powered, and thus not be detected by your OS (e.g. it will not appear in the '''lsusb''' output).
* You need a 3.3V voltage regulator to convert the 5V from USB to 3.3V, so you can power the 3.3V SPI BIOS chip.
** You can probably use pretty much any 3.3V voltage regulator, e.g. '''LD33V''' or '''LD1117xx'''. For usage on a breadboard the TO-220 packaging is probably most useful.
** You have to connect two capacitors (e.g. 100nF and 10uF as per datasheets, but using two 10uF capacitors, or even two 47uF capacitors also works in practice) as shown in the schematics, otherwise the voltage regulator will not work correctly and reliably.
* Connect the following pins from the DLP-USB1232H to the SPI BIOS chip:
** '''18 (SK)''' to '''SCLK'''
** '''16 (DO)''' to '''SI'''
** '''2 (DI)''' to '''SO'''
** '''5 (CS)''' to '''CS#'''
** The '''WP# and HOLD#''' pins should be tied to '''VCC'''! If you leave them unconnected you'll likely experience strange issues.
** All '''GND''' pins should be connected together ('''pins 1 and 10''' on the DLP-USB1232H, '''pin 8''' on the SPI chip, '''pin 1''' on the voltage regulator).
 
You have to invoke flashrom with the following parameters:
 
$ '''flashrom -p ft2232_spi:type=2232H,port=A'''
 
On older flashrom versions the syntax was:
 
$ '''flashrom -p ft2232_spi:ft2232_type=2232:port=A'''
 
'''Photos:'''
 
<gallery>
File:Dlp usb1232h side.jpg|<small>Module, top</small>
File:Dlp usb1232h bottom.jpg|<small>Module, bottom</small>
File:Via epia m700 bios.jpg|<small>SPI header on a mainboard</small>
File:Via epia m700 programer.jpg|<small>Module on a breadboard, connected to the mainboard's SPI header</small>
File:Ft2232spi programer.jpg|<small>Breadboard setup</small>
File:Dlp usb1232h spi programmer breadboard 1.jpg|<small>Another breadboard setup</small>
File:Dlp usb1232h spi programmer breadboard 2.jpg|<small>Module and parts</small>
</gallery>
 
= FTDI FT2232H Mini-Module =
 
The [http://www.ftdichip.com/Products/Modules/DevelopmentModules.htm#FT2232H%20Mini%20Module FTDI FT2232H Mini-Module Evaluation Kit] ([http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT2232H_Mini_Module.pdf datasheet]) can be used with flashrom for programming SPI chips.
 
Where to buy: [http://apple.clickandbuild.com/cnb/shop/ftdichip?op=catalogue-products-null&prodCategoryID=74&title=FT2232H+Modules FTDI]
 
= FTDI FT4232H Mini-Module =
 
The [http://www.ftdichip.com/Products/Modules/DevelopmentModules.htm#FT4232H%20Mini%20Module FTDI FT4232H Mini-Module Evaluation Kit] ([http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT4232H_Mini_Module.pdf datasheet]) can be used with flashrom for programming SPI chips.
 
Where to buy: [http://apple.clickandbuild.com/cnb/shop/ftdichip?op=catalogue-products-null&prodCategoryID=75&title=FT4232H+Module FTDI]
 
= openbiosprog-spi =
 
[http://randomprojects.org/wiki/Openbiosprog-spi openbiosprog-spi] is an Open Hardware USB-based programmer for SPI chips, designed by [[User:Uwe|Uwe Hermann]]. It uses an FTDI FT2232H chip and features either a DIP-8 socket or a pinheader where jumper-wires can be attached. The user-space source code is part of flashrom, the schematics and PCB layouts are licensed under the [http://creativecommons.org/licenses/by-sa/3.0/ CC-BY-SA 3.0] license and were created using the open-source [http://kicad.sourceforge.net Kicad] EDA suite (GPL, version 2).
 
For more information and downloads, including a parts list, Gerber file downloads, recommended Kicad settings, and recommended PCB manufacturer settings, see http://randomprojects.org/wiki/Openbiosprog-spi.
 
'''Usage:'''
 
$ '''flashrom -p ft2232_spi:type=2232H,port=A'''
 
'''Photos:'''
 
<gallery>
File:Openbiosprog-spi-assembled-device-0.1-powerled-chip.jpg|<small>Chip in DIP-8 socket</small>
File:Openbiosprog-spi-assembled-device-0.1-powerled-chip-pinheader.jpg|<small>Device with pin-header</small>
File:Openbiosprog-spi-finished-pcbs-front-0.1.jpg|<small>Bare PCB, front</small>
File:Openbiosprog-spi-assembled-device-0.1-parts.jpg|<small>Required parts</small>
File:Openbiosprog-spi-schematics-0.1.png|<small>Schematics</small>
File:Openbiosprog-spi-pcb-kicad-0.1.png|<small>PCB layout</small>
</gallery>
 
= Amontec JTAGkey/JTAGkey2/JTAGkey-Tiny =
 
The [http://www.amontec.com/ Amontec] [http://www.amontec.com/jtagkey2.shtml JTAGkey2] can be used with flashrom for programming SPI chips. [http://www.amontec.com/jtagkey.shtml JTAGkey] and [http://www.amontec.com/jtagkey-tiny.shtml JTAGkey-Tiny] should work, if you add them to <tt>ft2232_spi.c</tt> ('''untested''').
 
Where to buy: [http://www.amontec.com/eshop/cmd.php Amontec eShop]
 
'''Usage:'''
 
More info can be found on on [http://www.amontec.com/jtagkey.shtml the JTAGkey site].
 
* You need a 3.3V voltage source - see above for details.
* Connect the following pins from the JTAGkey2 to the SPI BIOS chip:
** '''1 (Vref)''' to '''VCC'''
** '''5 (MOSI/TDI)''' to '''SI'''
** '''7 (CS#/TMS)''' to '''CS#'''
** '''9 (CLK/TCK)''' to '''SCLK'''
** '''13 (MISO/TDO)''' to '''SO'''
** '''20 (GND)''' to '''GND'''
** The '''WP# and HOLD#''' pins should be tied to '''VCC'''.
 
The "Cable pinout" picture below shows the colors on the breakout cable.
 
'''Photos:'''
 
<gallery>
File:Jtagkey2.jpg|<small>Amontec JTAGkey2</small>
File:JTAGKey_SPI.JPG‎|<small>Cable pinout (click for larger image)</small>
File:Jtagkey-tiny.jpg|<small>Amontec JTAGkey-tiny</small>
</gallery>
 
= Olimex ARM-USB-TINY/-H and ARM-USB-OCD/-H =
 
The [http://www.olimex.com/dev/index.html Olimex] [http://www.olimex.com/dev/arm-usb-tiny.html ARM-USB-TINY] (VID:PID 15BA:0004) and [http://www.olimex.com/dev/arm-usb-ocd.html ARM-USB-OCD] (15BA:0003) can be used with flashrom for programming SPI chips. The [http://www.olimex.com/dev/arm-usb-tiny-h.html ARM-USB-TINY-H] (15BA:002A) and [http://www.olimex.com/dev/arm-usb-ocd-h.html ARM-USB-OCD-H] (15BA:002B) should also work, though they are currently '''untested'''.
 
The following setup can then be used to flash a BIOS chip through SPI.
 
{| border="1"
| style="width:250px;" align="center" rowspan="9"| [[File:ARM-USB-TINY_pinout.png|Pinout]]
|style="background:#f7f7f7;"|'''Pin (JTAG Name)''' ||style="background:#f7f7f7;"|'''SPI/Voltage Source'''
|-
|'''1''' (VREF)
|'''VCC''' (from Voltage Source)
|-
|'''2''' (VTARGET)
|'''VCC''' (to SPI target)
|-
|'''4''' (GND)
|'''GND''' (from Voltage Source)
|-
|'''5''' (TDI)
|'''SI'''
|-
|'''6''' (GND)
|'''GND''' (to SPI target)
|-
|'''7''' (TMS)
|'''CE#'''
|-
|'''9''' (TCK)
|'''SCK'''
|-
|'''13''' (TDO)
|'''SO'''
|}
 
On the ARM-USB-TINY, VREF, and VTARGET are internally connected, and all the GND lines (even numbered pins, from 4 to 20) share the same line as well, so they can be used to split VCC/GND between the voltage source and the target.
 
The voltage source should provide 3.0V to 3.3V DC but doesn't have to come from USB: it can be as simple as two AA or AAA batteries placed in serial (2 x 1.5V).
 
'''Invoking flashrom:'''
 
You first need to add the '''-p ft2232_spi''' option, and then specify one of '''arm-usb-tiny''', '''arm-usb-tiny-h''', '''arm-usb-ocd''' or '''arm-usb-ocd-f''' for the type. For instance, to use an ARM-USB-TINY, you would use:
 
$ '''flashrom -p ft2232_spi:type=arm-usb-tiny'''
 
= Openmoko =
 
== Informations ==
The openmoko debug board can act as an SPI programmer bitbanging the FTDI(no need of an openmoko phone), you just need:
* a breadboard
* some wires
* The openmoko debug board(v2 and after,but only tested with v3)
The voltage is provided by the board itself.
The connector to use is the JTAG one(very similar to what's documented in the previous section(Olimex ARM-USB-TINY/-H and ARM-USB-OCD/-H )
 
== Building ==
'''WARNING this was tested with 3.3v chips only...'''
 
Here's the pinout of the JTAG connector of the openmoko debug board(copied from ARM-USB-tiny):
{| border="1"
| style="width:250px;" align="center" rowspan="9"| [[File:ARM-USB-TINY_pinout.png|Pinout]]
| style="background:#f7f7f7;"|'''Pin (JTAG Name)''' ||style="background:#f7f7f7;"|'''SPI/Voltage Source''' || style="background:#f7f7f7;"|'''BIOS Chip connector name'''
|-
|'''1''' (VREF)
|'''VCC''' (from Voltage Source)
|'''VCC''' (3.3v only)
|-
|'''2''' (VTARGET)
|'''VCC''' (to SPI target)
|'''Not connected'''
|-
|'''4''' (GND)
|'''GND''' (from Voltage Source)
|'''Ground'''
|-
|'''5''' (TDI)
|'''SI'''
|'''DIO''' (Data Input)
|-
|'''6''' (GND)
|'''GND''' (to SPI target)
|'''Not connected'''
|-
|'''7''' (TMS)
|'''CE#'''
|'''CS''' (Chip select)
|-
|'''9''' (TCK)
|'''SCK'''
|'''CLK''' (Clock)
|-
|'''13''' (TDO)
|'''SO'''
|'''DO''' (Data output)
|}
 
== Pictures ==
<gallery caption="Pictures " widths="250px" heights="250px" perrow="4">
File:Openmoko_0001.jpeg
File:Openmoko_0002.jpeg
File:Openmoko_0003.jpeg
</gallery>
 
== Software ==
* Be sure to have libftdi and it's respective -dev package installed(aptitude install libftdi-dev libftdi1 on my system) before recompiling flashrom, else you'll get:
Error: Unknown programmer ft2232_spi:type=openmoko.
 
== Performances ==
# time ./flashrom/flashrom -p ft2232_spi:type=openmoko -r coreboot.rom
flashrom v0.9.5.2-r1545 on Linux 3.0.0-20-generic (x86_64)
flashrom is free software, get the source code at http://www.flashrom.org
Calibrating delay loop... OK.
Found Winbond flash chip "W25X80" (1024 kB, SPI) on ft2232_spi.
Reading flash... done.
real 0m19.459s
user 0m1.244s
sys 0m0.000s
 
# time ./flashrom/flashrom -p ft2232_spi:type=openmoko -w coreboot.rom
flashrom v0.9.5.2-r1545 on Linux 3.0.0-20-generic (x86_64)
flashrom is free software, get the source code at http://www.flashrom.org
Calibrating delay loop... OK.
Found Winbond flash chip "W25X80" (1024 kB, SPI) on ft2232_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.         
real 1m1.366s
user 0m7.692s
sys 0m0.044s

Latest revision as of 20:18, 25 September 2024