Saturday, September 08, 2012

Gerbmerge errors

Continuing from my previous post, Installing gerbmerge on recent installation of Ubuntu Linux (12.04-LTS) causes installation to fail with error

Traceback (most recent call last):
  File "", line 41, in
    DestDir = os.path.join(DestLib, 'gerbmerge')
  File "/usr/lib/python2.7/", line 68, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

This is caused by variable DestLib not being set properly by following line in

DestLib = distutils.sysconfig.get_config_var('LIBPYTHON')

Maybe with new version of python distutils.sysconfig.get_config_var('LIBPYTHON') returns nothing.

In order to fix this, change the above line to

DestLib = '/usr/local/lib/python2.7/'

If your python local library path  is different, substitute your own path in the line above.

I'm not too good at python but maybe "sys.path" can be used to set the library path.

Please comment if this works or doesn't work for you.

Friday, August 03, 2012

WD Passport :-(

Some time ago I bought a Western Digital Passport 750GB drive from Costco. I used the drive for offloading my laptop SSD. Recently while I was moving some files off of my SSD I encountered a few delayed write errors (Windows XP). I connected the drive to my ubuntu machine and ran a drive test. Figured out that it had 15 bad sectors that were ready to be remapped. But in any case the drive won't mount at all on any of the OS.

I decided to open the drive and connect directly to a serial ATA port to get direct IO access. I opened the cover and found out that the drive had no SATA port! Instead it had a USB soldered on the drive logic-board. Bummer!

Since then, I have decided not to use WD passport and switched over to Seagate GoFlex that has exposed SATA connector at the bottom. I took some pictures of the connector and will post soon.

PIC Development on Linux

I tinker code and hardware on various platforms and therefore I like to keep boundaries between development tools. I also would like to keep design re-usability among some common tools. To keep isolation between platforms, I use VMware workstation. To keep versions, I use git. Git can be used standalone (without a server) if you need. As you can see from the screenshot that I'm using code development and hardware development for PIC micro-controllers on one OS platform.

With release of MPLAB-X on Linux, PIC development is in "free" boundary. I don't have to dedicate a windows license for my PIC development. I have verified my ICD2 and PICKIT2 working under VMware workstation with MPLAB X. I saw some issues with MPLABX and C30 v3.30c but now fixed by MPLABX 1.30. The C30 issues were fixed by fixing the header files. I opened a ticket with Microchip so that they can fix those in newer versions.

Tuesday, September 20, 2011

Programming Arduino Bootloader on Mega8 using an Arduino

While building a couple of arduinos, I found out that I had a few Mega8 chips left. I thought I might use them as Arduino and wanted to program them with arduino firmware. Tried researching about arduino as ISP and burning the boot-loader using arduino GUI but it was for Mega328. The process miserably failed because the device signatures didn't match. Anyways, came up with a combination of arduino isp and avrdude for rescue. First convert a working arduino into AVRISP programmer and then use it to program a blank AVR.

For this I used


  1. Ubuntu 10.04LTS machine or VM
  2. Install arduino gui from I downloaded arduino v22 so I installed it in ~/arduino-0022
  3. Download and unzip Mega-ISP sketch from I downloaded version .04 (latest at the time of writing)
  4. A fully functional arduino board setup will be required. This will act as the ISP programmer.
  5. Target arduino board with blank ATMega8 chip.

Here is the procedure:

  1.  Wire up the arduino boards using the instructions at: If you have a non standard pinout arduino clone, connect following pins of source to target
    Source Arduino PinTarget Arduino Pin
  2.  Install avrdude on the operating system:
sudo apt-get install avrdude

3. Load your Programmer Arduino baord with Mega-ISP sketch. Make sure that sketch is written properly to the board.

4. copy ATMegaboot from arduino installation (in my case ~/arduino-0022)
cp ~/arduino-0022/hardware/arduino/bootloaders/atmega8/ATmegaBOOT.hex ./

5. Copy and paste the following code on your linux shell prompt. This will create a file and will make it executable:
echo '#!/bin/bash
cmd="`which avrdude`"
options="avrdude -p $chip -c avrisp -P /dev/ttyUSB0 -b 19200"

# Erase chip write lock and fuses
$cmd $options -e -U lock:w:0x3f:m -U lfuse:w:0xdf:m -U hfuse:w:0xca:m

# Upload bootloader code
$cmd $options -D -U flash:w:ATmegaBOOT.hex:i

# Lock boot section
$cmd $options -U lock:w:0x0f:m
' >; chmod u+x

6. Check your wiring again and execute

7. If things go well you will see successful avrdude messages and your Mega8 will be programmed with arduino boot. This procedure can be used to flash other hex files as well.

I have built a small ISP pcb that I plug my arduino into if I need ISP capabilities to program other AVRs, just use the right AVR device with avrdude options.