Openbiosprog-spi

From Random Projects
Jump to: navigation, search
openbiosprog-spi 0.1
openbiosprog-spi 0.1 with pin-header
Schematics
Kicad PCB layout

openbiosprog-spi is a fully Open Hardware and Free Software USB-based programmer for SPI chips, e.g. those used as BIOS chip in recent mainboards.

The user-space source code is part of flashrom (GPL, version 2), the schematics and PCB layouts are licensed under the CC-BY-SA 3.0 license and were created using the open-source Kicad EDA suite (GPL, version 2).


See openbiosprog for a (planned, unfinished) programmer hardware for other type of BIOS chips, e.g. LPC, FWH, or parallel (NOR) flash chips.

Syndication: my blogpost, identi.ca, del.icio.us, flickr

Press and announcements: Makezine, electronics-lab.com, mikrocontroller.net, EEvblog forums, harkopen, lostscrews.com

Downloads

The schematics, PCB layouts, and other material is available from gitorious:

$ git clone git://gitorious.org/openbiosprog/openbiosprog-spi.git

The flashrom source code is available from:

$ svn co svn://flashrom.org/flashrom/trunk flashrom

The openbiosprog-spi 0.1 Gerber files and drill file are also available for download here (for convenience):

http://randomprojects.org/wiki/images/a/a8/Openbiosprog-spi-0.1-gerber.zip

Design

This is intended to be a simple, fast, USB-based SPI chip programmer.

  • It uses the FTDI FT2232H chip as basis for USB as well as for handling the actual SPI protocol in hardware (MPSSE engine of the FT2232H).
  • Attaching the SPI chip:
    • There's a DIP-8 socket on the device so you can easily insert the SPI chip you want to read/erase/program.
    • Optionally, if you don't want a DIP-8 socket, you can solder in a pin-header with 8 pins, which allows you to connect the individual pins to the SPI chip via jumper wires or grippers/probes.
  • The hardware is designed using the open-source Kicad EDA suite (GPL, version 2), and is released under the CC-BY-SA 3.0 license.
  • The software on the host side is flashrom (GPL, version 2).
  • The PCB board dimensions are 44mm x 20mm.

Usage

(flashrom output partly shortened for better readability)

Identify the SPI chip:

$ flashrom -p ft2232_spi:type=2232H,port=A
Found chip "Winbond W25x80" (1024 KB, SPI) at physical address 0xfff00000.

Read chip contents:

$ time flashrom -p ft2232_spi:type=2232H,port=A -r backup.bin
Found chip "Winbond W25x80" (1024 KB, SPI) at physical address 0xfff00000.
Reading flash... done.

real    0m9.758s
user    0m0.640s
sys     0m0.432s

Erase chip:

$ time flashrom -p ft2232_spi:type=2232H,port=A -E
Found chip "Winbond W25x80" (1024 KB, SPI) at physical address 0xfff00000.
Erasing flash chip... SUCCESS.

real    0m41.785s
user    0m26.518s
sys     0m0.812s

Write chip (includes an automatic erase step and another read step for write success verification):

$ time flashrom -p ft2232_spi:type=2232H,port=A -w newimage.bin
Found chip "Winbond W25x80" (1024 KB, SPI) at physical address 0xfff00000.
Writing flash chip... Erasing flash before programming... Erasing flash chip... SUCCESS.
done.
Programming flash... done.
COMPLETE.
Verifying flash... VERIFIED.          

real    1m9.150s
user    0m26.946s
sys     0m1.788s

See the respective flashrom page (or consult the flashrom manpage) for details.

Schematics and PCB layout images

Bill of materials

Qty Device Footprint Value Refdes Mouser CSD Comments
1 FTDI FT2232HL LQFP-64 IC1 6.11€ 8.95€ (302255) USB 2.0 Hi-Speed (480Mb/s) to UART/FIFO IC. Datasheet.
1 DIP-8 socket DIP-8, 300 IC2 0.149€] 0.10€ (15-DIP08PZ) Socket for SPI chip. 2.54mm pitch, 10.03mm x 10.16mm, row distance 7.62mm
1 3.3V LDO SOT-223 3.3V U1 0.528€ 1.25€ (223-1705) TLV1117-33 info. TLV1117-33 datasheet. LM1117IMP-3.3 datasheet.
1 Mini-USB B
connector
custom U2 1.59€, 0.44€ (15761) Female Mini-USB connector, Type B, 10mm x 3,95mm x 9,2mm. Mouser: Molex part no. 0548190572, Drawing. The CSD one has a slightly different footprint, but made the Kicad footprint generic enough to work for both.
1 Crystal HC49/US 12MHz X1 0.338€ 0.15€ (14-4S12,000MHZ) SMD part, +/- 30 ppm, 4.8mm x 11.5mm x 4.2mm (W x L x H). Sometimes the footprint/package is called HC49/US, HC49/U, HC49S, or HC49-S4. If in doubt, check the datasheet and make sure the land pattern / footprint matches. Mouser's ABLS-12.000MHZ-B4-T has 18pF load capacitance, CSD part no. 14-4S12,000MHZ has 30pF. Ideally you should use the matching capacitors, but the 27pF ones should be fine in most cases.
2 Ceramic capacitor 0603 27pF C7, C9 0.07€ (115-06N027)
9 Ceramic capacitor 0603 100nF C4, C6, C10,
C11, C12, C13,
C14, C15, C16
0.04€ (115-06N100)
1 Tantal capacitor 3216/A (3216-18) 3.3uF / 10V C8 0.124€ 0.36€ (121-A10R003,3)
2 Tantal capacitor 3216/A (3216-18) 4.7uF / 10V C2, C3 0.149€ 0.17€ (121-A10R004,7)
1 Tantal capacitor 3216/A (3216-18) 10uF / 10V C17 0.173€ N/A
1 Tantal capacitor 7343-31/D (2917 metric) 100uF / 10V C18 0.38€ 0.85€ (121-D10R100) If you don't have 100uF/10V, some 100uF/16V or 100uF/6.3V should also be fine.
2 Resistor 0603 4k7 R3, R4
2 Resistor 0603 1k R1, R11
1 Resistor 0603 12k R2 Should be 1% precision ideally.
1 Resistor 0603 R5 Optional. You can put a 0Ω resistor, a capacitor, or just a ball of solder here, I think. Anything should be fine.
2 Chip ferrite bead 0603 600Ω, 500mA L1, L2 0.14€
1 LED 0603 D1 Power LED. Choose any color you like. Play with the value of R11 to make the LED more/less brighter.

Note 1: All prices are for 1 piece. If you buy more, it gets a lot cheaper usually.

Note 2: Prices from Mouser do not include German VAT ("Umsatzsteuer"). Mouser offers free shipping for orders above 75€, otherwise it's 20€ shipping. Mouser handles customs fees for you, which means less hassle.

Note 3: CSD prices do include German VAT already. Shipping is 3.59€ usually, you get free shipping on orders above 100€. No customs fees involved if you're in Germany, of course.

PCB manufacturing

Kicad DRC settings

I used the following Design Rule Check (DRC) settings in the Kicad software (Design Rules -> Design Rules menu):

Setting inches/mil mm
Clearance 0.0080in / 8.0mil 0.203mm
Track width 0.0080in / 8.0mil 0.203mm
Via Dia 0.0394in / 39.4mil 1.0mm
Via Drill 0.0157in / 15.7mil 0.4mm

In Preferences -> Dimensions -> Pads Mask Clearance select:

Setting inches/mil mm
Solder Mask Clearance 0.0059in / 5.9mil 0.15mm

(this setting affects the Gerber output)

Creating Gerber files

Kicad Gerber output settings

In File -> Plot select:

Setting Value
Copper Layers Front and Back
Technical Layers SilkS_Front, SilkS_Back, Mask_Front, Mask_Back, and PCB_Edges
Plot Origin Absolute
Plot Format Gerber
Other Use Proper Gerber Extensions, Print module value, Print module reference, Print other module texts (last one is probably optional, at least for this project)

The rest of the settings should be OK per default, and/or optional. Press Plot to generate the Gerber files in the current directory.

Creating Excellon drill files

Kicad drill file settings

Press Generate drill file to create an Excellon drill file. It is very important to use the following settings (the defaults in Kicad don't seem to work very well). The settings may depend a bit on what your PCB manufacturer expects, check their guidelines/FAQs if in doubt.

Setting Value
Drill Units Inches
Zeros Format suppress leading zeroes
Precision 2:4
Drill Origin absolute
Drill Sheet Drill sheet (Gerber)
Drill Report None (I guess this report is optional)
Options Do not select mirror y axis! This is very important! However, do select minimal header. This is also very important, otherwise some Gerber viewers will not be able to load the drill file correctly or at all.

Finally, press OK to create the drill file(s), then press Quit in the Plot window.

PCB-POOL.COM order settings

PCB-POOL.COM settings

I chose PCB-POOL.COM as PCB manufacturer for the first prototypes (v0.1) of this project. They are not exactly cheap when compared to, e.g., pcbcart.com, but for a few prototypes small price differences don't matter that much. However, this probably saved me a lot of hassle due to customs fees, customs paperwork and long production/shipping times (PCB-POOL.COM is in Germany where I live, pcbcart.com is in China).

I used the following settings for ordering the first batch of prototypes via the PCB-POOL.COM online price calculator:

Setting Value
Lagenzahl (#layers) 2
Liefermenge (#PCBs) 11 (this was the sweet spot wrt price I was willing to pay)
Abmessungen (PCB size) 44mm x 20mm
Nutzen (use) Mindestfläche optimal ausnutzen (use available area optimally)
Basismaterial (material) FR4, 35µmCu, 1.6mm
Stopplack (solderstop) ja, beide Seiten verschieden (yes, different layout on both PCB sides). This adds quite a bit to the cost, so you could do without solderstop to save some money, but it also makes soldering a bit more messy, among other things.
Bestückungsdruck (silkscreen) Nein (no). I didn't select silkscreen as it increased the price drastically, but is of relatively little use (for the prototypes at least).
Oberfläche (surface) Ormecon® - partielle chem. Verzinnung für superflache Pads (Ormecon, partial chemical tinning, super-flat pads)
Layoutvorgaben (layout restrictions) Min. Leiterbahnstärke/-abstand: >= 0.150mm (6mil) (min. track width: 0.15mm/6mil; note: I actually used 8mil in the layout), Min. Bohrenddurchmesser: >= 0.3mm (12mil) (min drill size: 0.3mm/12mil; note: I actually used 0.4mm in the layout)
Überlieferung (extra PCBs) nein (no). Saying yes might give you some more PCBs (if they happen to produce more than you specified) at lower cost.
E-Test (electrical test) nein (no). Usually a really bad idea, but this would have also increased cost quit a bit, so I'll just keep my fingers crossed that there won't be hidden bugs/shorts in the finished boards.
Lieferzeit in AT (lead time) 8 AT (8 working days). Lower numbers result in increased price, of course.
Dateiformat (file format) EXT. GERBER
Dateiname (file name) openbiosprog-spi-0.1-gerber.zip (you'll need to upload the ZIP file with the Gerber files plus drill files later in the process).
Free Stencil ja (yes). PCB-POOL.COM currently ships a free solderpaste stencil with each order (neat!).

PCB-POOL.COM order status updates

A nice feature at PCB-POOL.COM is that you can login on their website and keep track of the current status of your order, including who is working on what step, including a photo of that employee (!), and PDFs/photos/ZIPs of the result of that step.

Finished PCBs

After pretty much exactly 8 working days the finished PCBs from PCB-POOL.COM arrived, and they look pretty nice. Also included was a free "solder sucker" pump and free stencils (for easily applying solder paste) for this board. PCB-POOL.COM currently produces a free stencil for every order!

Assembly

Lessons learned, tips and tricks

  • TODO