Cheap Chinese USB ISP Programmers

August 1st, 2015

The assembled unit, ready for use

The assembled unit, ready for use (click to zoom)

I bought one of these convenient little USB ISP programmers from a Chinese mail-order supplier while stocking up on Arduino parts and tools. I didn’t have a particular use in mind at the time, it was just an impulse purchase and I tossed it in my tool box without trying it out. Yesterday I suddenly wanted to examine the embedded AVR chip in a production device (not my own project) and dug out this programmer and tried to use it.

It turns out that most of these cheap Chinese USB ISP programmers (there are many variations and sellers) are shipped with firmware that doesn’t work with avrdude (the standard open-source AVR programming software). Fortunately, they are built out of an Atmel MEGA8 microcontroller, and it is usually possible to install the excellent, open-source USBasp firmware on them. Doing this can be tricky, however; the various designs use various different MEGA8 pin assignments for some of their functions.

The guts of the programmer showing the temporary tiny wire modification

The guts of the programmer showing the temporary tiny wire modification (click to zoom)

The one I have is a bit unusual in its use of GPIO pins so I had to make some changes to the code. But more annoying was the fact that it didn’t have a provision for (self) programming – no jumper or pad for connecting the reset signal for in-circuit programming. So to re-program it I had to solder a wire from one of the AVR pins to one of the ISP connector pins. And of course, after all that, to program it I needed – what else – a programmer. Luckily, I had an Atmel STK-500, which is a bit awkward to use, but worked well enough.

My modified USBasp code is here: source patch binary image
The site I bought it from is here: USB 2.0 ISP ASP Programmer Download Adapter
(But I don’t particularly recommend this seller because they take months to deliver to the US.)

Thank you to CE’s & PP’s Tech Blog for a good description of a similar hack to a similar cheap Chinese USB programmer.

The original firmware looked like this when connected:

usb 2-1.3: new low-speed USB device number 14 using ehci-pci
usb 2-1.3: New USB device found, idVendor=03eb, idProduct=c8b4
usb 2-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1.3: Product: USBHID
usb 2-1.3: Manufacturer: zhifengsoft
hid-generic 0003:03EB:C8B4.0007: hiddev0,hidraw2: USB HID v1.01 Device [zhifengsoft USBHID] on usb-0000:00:1d.0-1.3/input0

Super-easy Teensy 3.1 Development Tools on Ubuntu

June 17th, 2015

I’ve been playing with Arduino and other small embedded controller prototyping systems in anticipation of a few cool projects I’m considering. The Arduino tool chain is very easy to set up on Ubuntu; basically one apt-get command will do it, installing the IDE, compiler, download tools, example programs, and everything. I’ve built and run several Arduino example sketches on a Duemillanove and a Bare Bones Board that I had lying around.

Another appealing controller family is the Teensy series, which has both AVR and ARM variants. I had picked up a couple of the ARM boards (Teensy 3.1 and Teensy LC) at Maker Faire and wanted to try them out. They can be used within the Arduino IDE but only if you have certain combinations of Arduino and Teensy software versions, and the Arduino version provided in the Ubuntu repo is not compatible. I could have built the Arduino tools from source but I really didn’t want to mess with the perfectly functional version that Ubuntu installed. So I started looking into setting up a pure ARM cross tool chain and writing code directly for the Freescale processor on the Teensy boards.

I couldn’t find anyone who had done this on Ubuntu using the stock Ubuntu packages for GCC and friends, but I found a good description by Karl Lunt of how he set up the tool chain on Windows: Bare-metal Teensy 3.x Development. Karl also had gathered the essential header files from Freescale, added the necessary C run time start code and linker script, and created a few useful library functions and demo programs, and of course, a Makefile. It only took a few tweaks to combine Karl’s files, standard Ubuntu packages, and the Teensy download tool into a working cross-developement tool set.

Here’s how you can do it:

# Install the ARM compiler from Ubuntu:
sudo apt-get install binutils-arm-none-eabi gcc-arm-none-eabi

# Install the Teensy download/reboot utility
case `uname -i` in
*_64) f=teensy.64bit.gz;;
*) f=teensy.gz;;
esac
wget http://pjrc.com/teensy/$f
mkdir -p $HOME/bin
gunzip <$f >$HOME/bin/teensy
chmod a+rx $HOME/bin/teensy
rm $f
wget http://www.pjrc.com/teensy/49-teensy.rules
sudo mv 49-teensy.rules /etc/udev/rules.d

# Download Karl Lunt's archive of Teensy headers and support code:
wget http://www.seanet.com/~karllunt/Teensy3xlib.zip
mkdir teensy
unzip -d teensy Teensy3xlib.zip
rm Teensy3xlib.zip
sed -i s/mk20d7/MK20D7/ teensy/include/common.h

# Download Karl Lunt's "blinky" demo program:
wget http://www.seanet.com/~karllunt/Teensy3x.zip
unzip Teensy3x.zip blinky.c
rm Teensy3x.zip

# Download my tuned-for-Linux Makefile:
wget http://www.omnicron.com/~ford/teensy/Makefile

# That's it!
echo 'Now run "make"'

You can find the above steps in a ready-to-run script here.

Of course, you can copy and modify the Makefile to build your own projects.

My next step will be to try to add Teensy LC support.

How Time Flies…

September 4th, 2009

It was a good 2 years and 10 months for me at ConSentry Networks. It seems like the time just flew by.

My kids liked to visit me at work and they would always first make a beeline for the whiteboard. I started keeping a height chart and added Max once he was standing on his own.

These photos show the changes…

2006-11-21 (Sarah and Eddie)


2009-08-20 (Sarah, Eddie and Max)


Pay no attention to the ConSentry Networks proprietary/confidential information on the whiteboard. :-)

I Guess I Need a New Blog

August 26th, 2009

I had a blog at blogs.sun.com. It still exists, but it appears that they no longer allow ex-employees to edit their blogs.

So I’m setting up this new one. I have a few items that I had posted in other places that I might retroblog here. Maybe I should migrate all the Sun blog entries… I don’t know.

Postfix smf(5) manifest

July 8th, 2008

I have installed OpenSolaris (specifically, Solaris Express Community Edition build 91) on my new home server which will consolidate three existing (rather old, noisy, and underpowered) machines.

I am installing Postfix as my mail server software. I created an smf(5) service manifest for postfix so that I can have smf start it. Contrary to the (IMHO misguided) common practice, I install manifests in /lib/svc/manifest/. So I installed the above file as /lib/svc/manifest/network/postfix.xml and used svccfg import to create the svc:/network/smtp:postfix service instance.

[Update: Normally I would have offered this file to the smf community and/or the Postfix author/maintainer, but before I posted this others had already beat me to it.]

The myfamily.com DNS Poisoning Problem Understood

February 9th, 2005

Several people have observed a problem on their networks where various web sites, apparently at random, would be replaced by www.myfamily.com. The problem comes and goes without obvious cause, and affects different web sites at different times. I started encountering this problem a few days ago and tracked down the cause.

Something funny started happening with my web browser…

I clicked on a link to, say, www.imdb.com, and found myself looking at the home page for www.myfamily.com. My browser’s URL bar indicated http://www.imdb.com/ but the contents of the page were obviously not from that site. Read the rest of this entry »