hardware

openbiosprog-spi, a DIY Open Hardware and Free Software USB-based SPI BIOS chip flasher using flashrom

openbiosprog-spi device

If you're following me on identi.ca you probably already know that I've been designing a small PCB for a USB-based SPI chip programmer named openbiosprog-spi.

The main use-case of the device is to help you recover easily from a failed BIOS upgrade (either due to using an incorrect BIOS image, due to power outages during the flashing progress, or whatever). The device only supports SPI chips, as used in recent mainboards (in DIP-8 form factor, or via manual wiring possibly also soldered-in SO-8 variants). It can identify, read, erase, or write the chips.

Of course the whole "toolchain" of software tools I used for creating the hardware is open-source, and the hardware itself (schematics and PCB layouts) are freely released under a Creative Commons license (i.e., it's an "Open Hardware" device). 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).

openbiosprog-spi schematics
openbiosprog-spi Kicad PCB layout

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

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

You can also download the final Gerber files (ZIP) for viewing them, or sending them to a PCB manufacturer.

Some more design notes:

  • The device 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 PCB board dimensions are 44mm x 20mm, and it's a 2-layer board using mostly 0603 SMD components.

Basic usage example of the device on Linux (or other OSes supported by flashrom):

  $ flashrom -p ft2232_spi:type=2232H,port=A -r backup.bin (reads the current chip contents into a file)

openbiosprog-spi PCBs
openbiosprog-spi parts list

Over at the main projects page of openbiosprog-spi at

  http://randomprojects.org/wiki/Openbiosprog-spi

I have put up a lot more photos and information such as the bill of materials, the Kicad settings I used for creating the PCBs, the Gerber files and the Excellon drill files and so on.

The first few prototype boards I ordered at PCB-POOL.COM (but you can use any other PCB manufacturer of course), the bill of materials (BOM) lists the Mouser and CSD electronics part numbers and prices, but you can also buy the stuff elsewhere, of course (Digikey, Farnell, whatever).

I already hand-soldered one or two prototypes and tested the device. Both hardware and software worked fine basically, you just need a small one-liner patch to fix an issue in flashrom, but that should be merged upstream soonish.

In order to make it easy for interested users to get the PCBs I'll probably make them available in the BatchPCB Market Place soonish, so you can easily order them from there (you do still need to solder the components though). Note: I'm not making any money off of this, this is a pure hobby project.

All in all I have to say that this was a really fun little project, and a useful one too. This was my first hardware project using Kicad (I used gEDA/PCB, also an open-source EDA toolsuite, for another small project) and I must say it worked very nicely. I didn't even have to read any manual really, it was all pretty intuitive. Please consider not using Eagle (or other closed-source PCB software) for your next Open Hardware project, there are at least two viable open-source options (Kicad, gEDA/PCB) which both work just fine.

Using the HP Pavilion dv7-3127eg laptop with Debian GNU/Linux

HP Pavilion dv7-3127eg

Yep, so I bought a new laptop recently, my IBM/Lenovo Thinkpad T40p was slowly getting really unbearably sloooow (Celeron 1.5 GHz, 2 GB RAM max). After comparing some models I set out to buy a certain laptop in a local store, which they didn't have in stock, so I spontaneously got another model, the HP Pavilion dv7-3127eg (HP product number VY554EA).

Why this one? Well, the killer feature for me was that it has two SATA disks, hence allows me to run a RAID-1 in my laptop. This allows me to sleep better at night, knowing that the next dying disk will not necessarily lead to data loss (yes, I do still perform regular backups, of course).

Other pros: Much faster than the old notebook, this one is an AMD Turion II Dual-Core Mobile M520 at 2.3 GHz per core, it has 4 GB RAM (8 GB max), and uses an AMD RS780 / SB700 chipset which is supported by the Free-Software / Open-Source BIOS / firmware project coreboot, so this might make the laptop a good coreboot-target on the long run. I'll probably start working on that when I'm willing to open / dissect it or when the warranty expires, whichever happens first.

Anyway, I set up a page at randomprojects.org which contains lots more details about using Linux on this laptop:

http://randomprojects.org/wiki/HP_Pavilion_dv7-3127eg

Most of the hardware is supported out of the box, though I haven't yet tested everything. There may be issues with suspend-to-disk / suspend-to-RAM, sometimes it seems to hang (may be just a simple config change is needed in /etc/hibernate/disk.cfg).

Cons: Pretty big and heavy (but that's OK, I use it mostly as "semi-mobile desktop replacement"), glossy screen, loud fans (probably due to the two disks).

For reference, here's an lspci of the box:

  $ lspci -tvnn
  -[0000:00]-+-00.0  Advanced Micro Devices [AMD] RS780 Host Bridge Alternate [1022:9601]
           +-02.0-[01]--+-00.0  ATI Technologies Inc M96 [Mobility Radeon HD 4650] [1002:9480]
           |            \-00.1  ATI Technologies Inc RV710/730 [1002:aa38]
           +-04.0-[02-07]--
           +-05.0-[08]----00.0  Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) [168c:002b]
           +-06.0-[09]----00.0  Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller [10ec:8168]
           +-0a.0-[0a]--
           +-11.0  ATI Technologies Inc SB700/SB800 SATA Controller [AHCI mode] [1002:4391]
           +-12.0  ATI Technologies Inc SB700/SB800 USB OHCI0 Controller [1002:4397]
           +-12.1  ATI Technologies Inc SB700 USB OHCI1 Controller [1002:4398]
           +-12.2  ATI Technologies Inc SB700/SB800 USB EHCI Controller [1002:4396]
           +-13.0  ATI Technologies Inc SB700/SB800 USB OHCI0 Controller [1002:4397]
           +-13.1  ATI Technologies Inc SB700 USB OHCI1 Controller [1002:4398]
           +-13.2  ATI Technologies Inc SB700/SB800 USB EHCI Controller [1002:4396]
           +-14.0  ATI Technologies Inc SBx00 SMBus Controller [1002:4385]
           +-14.2  ATI Technologies Inc SBx00 Azalia (Intel HDA) [1002:4383]
           +-14.3  ATI Technologies Inc SB700/SB800 LPC host controller [1002:439d]
           +-14.4-[0b]--
           +-18.0  Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] HyperTransport Configuration [1022:1200]
           +-18.1  Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] Address Map [1022:1201]
           +-18.2  Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] DRAM Controller [1022:1202]
           +-18.3  Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] Miscellaneous Control [1022:1203]
           \-18.4  Advanced Micro Devices [AMD] K10 [Opteron, Athlon64, Sempron] Link Control [1022:1204]

Full lspci -vvvxxxxnnn, lsusb -vvv, and a much more detailed list of tested hardware components is available in the wiki.

Qi Hardware: Freedom Redefined - New Open Hardware company to ship Ben NanoNote device in fall 2009

Qi Hardware Ben NanoNote

I recently stumbled over a neat new Open Hardware and Free Software friendly company — Qi Hardware — founded by former OpenMoko developers.

To quote from the website:

Qi Hardware, founded on the belief in open hardware, produces mass market quality hardware applying free software principles to consumer electronics. The three fundamental elements in our development are copyleft hardware, upstream kernels and community driven software.

They have put up a timeline for upcoming products, where the 本 NanoNote™ (Ben NanoNote™) — a fully open multifunction ultra small form factor computing device — is the first entry product that is supposed to ship in fall 2009.

The Ben NanoNote is based on an Ingenic SoC (336 MHz XBurst Jz4720 MIPS-compatible CPU) with 3.0” color TFT (320x240), 2GB NAND flash, 32 MB SDRAM, SDHC microSD, micro-USB 2.0. The whole device, including the 850mAh Li-ion battery, weighs only 126g. Detailed specs are available.

Their currently planned setup includes a Linux kernel, u-boot, and OpenWRT as software basis. Personally, I'd like to see a stock Debian running on the hardware sooner or later, of course. The 2GB of flash and 32MB of RAM should be fine for a small Debian system (for instance, my NSLU2 runs off a 1GB thumb drive and has 32MB RAM, and is still very useful).

The code is all GPL'd and available from various git repos, hardware will be CC-BY-SA 3.0 licensed, and they try to use Free Software design and development tools also, including KiCAD for schematics and PCB layout, and probably HeeksCAD as CAD tool for mechanical stuff.

gEDA/PCB logo
I'm really tired of seeing more and more self-proclaimed "Open Hardware" projects that often don't even mention any license for their schematics and PCBs, or use crappy, self-invented "open" licenses that are not even remotely open in any way. Probably even worse, many hardware related projects use closed-source, proprietary electronic design tools such as EAGLE or OrCAD, thereby ruining the whole project from the beginning by forcing everyone who likes to contribute or adapt the hardware to use non-free software. That's why I was really happy to see the Qi people thrive to use open tools from the beginning! I hope to see more hardware projects use KiCAD or gEDA/PCB for their designs in future...

Using Debian GNU/Linux on the IBM/Lenovo Thinkpad T40p

TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones Linux On Laptops linlap.com

IBM/Lenovo Thinkpad T40p

I recently got a new (well, refurbished) laptop as a replacement for my old Toshiba A80-117 laptop which has more or less died. It's an IBM/Lenovo T40p laptop (model 2373-CG6), with an Intel Pentim M at 1.5 GHz. I chose this laptop for multiple reasons:

  • Robustness (which is supposedly one of the main advantages of Thinkpads).
  • Relatively cheap, as it's an older refurbished model (I paid less than 280 Euros).
  • Resolution of 1400x1050 (the usual 1024x768 of similar models is definately not enough for my purposes).
  • It can use up to 2 GB of DDR RAM (many similar models have a chipset-limitation of 1 GB). I swiftly replaced the shipped 512 MB of RAM with the 2 GB from my old laptop. The hardware maintainance manual has very useful instructions on opening the laptop, btw.
  • Gigabit Ethernet.
  • Non-glossy screen (very important!).
  • Pretty long battery life (even though it's refurbished), I get more that 2 hours or so.

Downsides and missing hardware features (nothing too important, though):

  • No HDAPS unfortunately, which would have been fancy.
  • No support for burning DVDs, only CDs (but that's possible through an upgrade, I think).
  • Only two USB ports, more of them would have been nice.
  • No Firewire, but that's not really critical for me.

Pretty much all of the hardware works flawlessly out of the box with a recent distro/kernel, see below for details.

Installation

Not needed, I simply popped out the 40 GB drive from the T40p and inserted my 160 GB (PATA) drive from my old laptop and that was it. Pretty much everything worked out of the box (see below), even though this is a totally different manufacturer, model, chipset, graphics card, wireless card, and so on. The only exception being (of course) my small Windows partition on that disk, which is now unusable as the drive is on different hardware and Microsoft doesn't like me to do that. Free Software: 1, Microsoft: 0.

Audio

Works out of the box using the snd_intel8x0 driver. The hardware is onboard audio in the southbridge (82801DB / ICH4) and uses the Analog Devices AD1981B codec.

Bluetooth

Works out of the box using the bluetooth and hci_usb driver. The laptop's Bluetooth device is USB-attached internally and shows up in lsusb as:

  $ lsusb
  Bus 003 Device 004: ID 1668:0441 Actiontec Electronics, Inc. [hex] IBM Integrated Bluetooth II

The device is not enabled per default though (which is a good thing), you can enable it like this:

  $ echo enable > /proc/acpi/ibm/bluetooth

Disabling is equally simple:

  $ echo disable > /proc/acpi/ibm/bluetooth

After that, you can use hcitool / hciconfig etc. as usual, and/or enable more related stuff with /etc/init.d/bluetooth restart.

Modem

Untested, I don't need it.

IrDA

Untested so far.

Sensors

Works out of the box.

  $ sensors
  acpitz-virtual-0
  Adapter: Virtual device
  temp1:       +51.0°C  (crit = +93.0°C)                  

  thinkpad-isa-0000
  Adapter: ISA adapter
  fan1:       3698 RPM
  temp1:       +51.0°C                                    
  temp2:       +42.0°C                                    
  temp3:       +32.0°C                                    
  temp4:       +49.0°C                                    
  temp5:       +33.0°C                                    
  ERROR: Can't get value of subfeature temp6_input: Can't read
  temp6:        +0.0°C                                    
  temp7:       +28.0°C                                    
  ERROR: Can't get value of subfeature temp8_input: Can't read
  temp8:        +0.0°C                                    

HPET

The Intel ICH4-M southbridge in this laptop supports High Performance Event Timers (HPET) which allows for more power savings and thus improved battery life.

  $ dmesg | grep -i hpet
  pci 0000:00:1f.0: Force enabled HPET at 0xfed00000
  hpet clockevent registered
  HPET: 3 timers in total, 0 timers will be used for per-cpu timer
  hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
  hpet0: 3 comparators, 64-bit 14.318180 MHz counter

You can check with powertop that the number of wakeups-from-idle is drastically reduced (from 70 to less than 10) when adding hpet=force to the kernel command line.

Network card

Works out of the box using the e1000 driver.

  $ modprobe e1000
  Intel(R) PRO/1000 Network Driver - version 7.3.20-k2-NAPI
  Copyright (c) 1999-2006 Intel Corporation.
  ACPI: PCI Interrupt 0000:02:01.0[A] -> Link [LNKA] -> GSI 11 (level, low) -> IRQ 11
  e1000: 0000:02:01.0: e1000_probe: (PCI:33MHz:32-bit) 00:11:22:33:44:55
  e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection

Touchpad

Works out of the box, both in X as well as in the console using gpm.

TrackPoint

Works out of the box, both in X as well as in the console using gpm.

Suspend-to-disk and suspend-to-RAM

Both work out of the box (on 2.6.26 or 2.6.29 kernels), or at least it used to; I think I'm seeing some hangs upon resume nowadays (Capslock LED is blinking, schreen is blank. I'll investigate.). I'm using the hibernate Debian package. You can explicitly force the usage of either method in /etc/hibernate/hibernate.conf by uncommenting the respective lines.

# TryMethod suspend2.conf
TryMethod disk.conf
# TryMethod ram.conf

Wireless

Works out of the box using the ath5k driver. I tested WEP as well as WPA.

CPU frequency scaling

Works out of the box using the acpi_cpufreq driver.

$ cpufreq-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which need to switch frequency at the same time: 0
  hardware limits: 600 MHz - 1.50 GHz
  available frequency steps: 1.50 GHz, 1.40 GHz, 1.20 GHz, 1000 MHz, 800 MHz, 600 MHz
  available cpufreq governors: userspace, powersave, ondemand, conservative, performance
  current policy: frequency should be within 800 MHz and 1.50 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz (asserted by call to hardware).
  cpufreq stats: 1.50 GHz:69.76%, 1.40 GHz:0.11%, 1.20 GHz:0.13%, 1000 MHz:0.16%, 800 MHz:29.83%, 600 MHz:0.00%  (4010)

Use cpufreq-set -g performance if you need full CPU power, cpufreq-set -g powersave otherwise.

PC Speaker

Works fine out of the box, tested with beep.

CDRW/DVD

Works out of the box. You can play DVDs or CD-ROMs, and burn CDs (but not DVDs):

  $ wodim foo.iso
  [...]
  Device type    : Removable CD-ROM
  Version        : 0
  Response Format: 2
  Capabilities   :
  Vendor_info    : 'MATSHITA'
  Identification : 'UJDA745 DVD/CDRW'
  Revision       : '1.02'
  Device seems to be: Generic mmc2 DVD-ROM.
  Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).
  Driver flags   : MMC-3 SWABAUDIO BURNFREE
  Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R96R

Ejecting a CD-ROM/DVD using the eject command line tool also works fine.

Graphics card

Works out of the box using the radeon driver.

  $ xrandr
  Screen 0: minimum 320 x 200, current 1400 x 1050, maximum 1400 x 2048
  VGA-0 disconnected (normal left inverted right x axis y axis)
  DVI-0 disconnected (normal left inverted right x axis y axis)
  LVDS connected 1400x1050+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
     1400x1050      50.0*+
     1280x800       60.0  
     1280x768       60.0  
     1024x768       60.0  
     800x600        60.3  
     640x480        59.9  
  S-video disconnected (normal left inverted right x axis y axis)

DRI works out of the box with the (mainline, open-source) driver:

  $ glxinfo | grep direct
  direct rendering: Yes

If you attach an external monitor or projector, you can enable it using xrandr as usual:

  $ xrandr --output VGA-0 --auto

You can also use a dual-head setup by adding this to your "Screen" section in /etc/X11/xorg.conf:

  SubSection "Display"
    # Virtual 2048 2048
    Virtual 1400 2048
  EndSubSection

After restarting the X server, you can play with xrandr and move the external screen (VGA-0) "below" the laptop's LCD screen (LVDS) for a simple dual-head setup. The GUI tools arandr or grandr are probably a bit simpler to use than plain command line xrandr.

The maximum size for the "Virtual" line is 2048x2048 if you want to keep DRI enabled (you can use higher values if you don't care about DRI).

S-Video

Untested so far.

Parallel port

Yes, this model still has an actual parallel port, which is nice as I can use it for random JTAG stuff (e.g. OpenOCD) with several cheapo parallel port JTAG adapters I own.

JTAG adapter for parallel port

PCMCIA

This laptop has a type II/III PCMCIA slot which works out of the box using the pcmcia and yenta_socket drivers. You can probe/handle PCMCIA cards using the pccardctl tool:

  $ pccardctl status
  Socket 0:
    no card
  Socket 1:
    no card

USB

Works fine, of course. Luckily it's USB 2.0 (not USB 1.1) so I can successfully do high-speed stuff, e.g. watching DVB-T using kaffeine. The only small problem is that there are only two USB ports, more would have been better.

Disk drive

Works fine, of course, it's just a normal PATA drive. You can check if DMA gets properly enabled with hdparm /dev/hda | grep dma.

ThinkLight

Works out of the box (Fn + PgUp). This is a tiny, but useful light embedded in the screen, which is helpful if you're working in dark rooms or in trains during the night etc.

Special keys

What works out of the box: brightness control buttons, audio volume control + mute buttons, thinklight button.

TODO: Access IBM, F3, F4, F5, F7, F12, left/right special keys, Fn+Space.

LEDs

All of them seem to work fine, including the Bluetooth on/off and Wireless on/off LEDs, as well as the suspend LED.

Detailed system information

lspci -tvnn

-[0000:00]-+-00.0  Intel Corporation 82855PM Processor to I/O Controller [8086:3340]
           +-01.0-[0000:01]----00.0  ATI Technologies Inc Radeon RV250 [Mobility FireGL 9000] [1002:4c66]
           +-1d.0  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 [8086:24c2]
           +-1d.1  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 [8086:24c4]
           +-1d.2  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 [8086:24c7]
           +-1d.7  Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller [8086:24cd]
           +-1e.0-[0000:02-08]--+-00.0  Texas Instruments PCI1520 PC card Cardbus Controller [104c:ac55]
           |                    +-00.1  Texas Instruments PCI1520 PC card Cardbus Controller [104c:ac55]
           |                    +-01.0  Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) [8086:101e]
           |                    \-02.0  Atheros Communications Inc. AR5212 802.11abg NIC [168c:1014]
           +-1f.0  Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge [8086:24cc]
           +-1f.1  Intel Corporation 82801DBM (ICH4-M) IDE Controller [8086:24ca]
           +-1f.3  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller [8086:24c3]
           +-1f.5  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller [8086:24c5]
           \-1f.6  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller [8086:24c6]

cat /proc/cpuinfo

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 9
model name      : Intel(R) Pentium(R) M processor 1500MHz
stepping        : 5
cpu MHz         : 1500.000
cache size      : 1024 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr mce cx8 sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 tm pbe up bts est tm2
bogomips        : 2997.72
clflush size    : 64
power management:

All in all it's a really nice piece of hardware, and it works without much hassle with recent distros/kernels.

OpenOCD, a Free Software JTAG utility with ARM and MIPS support

JTAG adapter for parallel port

Just FYI, I've recently updated the OpenOCD Debian package in unstable. OpenOCD is a Free Software JTAG utility which currently supports quite a large number of JTAG adapters and various CPUs/targets (many ARM and now also some MIPS ones). It's being used by a number of Free Software related projects such as OpenMoko and many others.

Here's an example of how you usually use the (new) OpenOCD with a cheapo parallel port JTAG device. First, start the OpenOCD server, providing it an interface config file and a target config file (you can copy/adapt them from /usr/lib/openocd/{interface,target}/*.cfg, or use those files directly if they work for your target, of course).

  $ openocd -f parport.cfg -f lpc2148.cfg

Then, in another xterm for example, connect to the now-running OpenOCD telnet server. Here you can now run various commands to probe, control and program the JTAG device(s). Try help for a list of commands. As an example, for flashing a binary onto some LPC2148 eval board you would do something like this:

  $ telnet localhost 4444
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.
  Open On-Chip Debugger
  > reset init
  JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f0, Version: 0x4)
  srst pulls trst - can not reset into halted mode. Issuing halt after reset.
  target state: halted
  target halted in Thumb state due to debug-request, current mode: Supervisor
  cpsr: 0x800000f3 pc: 0x7fffd2a2
  requesting target halt and executing a soft reset
  target state: halted
  target halted in ARM state due to debug-request, current mode: Supervisor
  cpsr: 0x800000d3 pc: 0x00000000
  > flash write_image /home/foo/program.bin 0
  wrote 1236 byte from file /home/foo/program.bin in 0.533683s (2.261701 kb/s)
  > resume 0

The final resume 0 will start to execute your program on the ARM LPC2148 microcontroller.

Check out the openocd info page (info openocd on the command line) for lots more documentation.

Syndicate content