Tag Archives: isp

First tryout of AVRs

I bought a few programmers some time ago. On eBay, for around 16 dollars american. They’re a copy of Thomas’ Fischl’s USBasp. Now I’m toying around with them – a part of my summer internship.

First off, I tried connecting one working programmer to the other and see how it goes. Well, FreeBSD couldn’t recognize it:

avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc

This is since I’m using a laptop. It has ppi (parallel port interface) in the kernel, but it doesn’t have a parallel port. And avrdude simulates writing to a parallel port for programming, or something like that. So, no /dev/ppi0 – no programming.

So I turned Windows back on and tried the avrdude that comes with WinAVR (version 20080610). It couldn’t locate USBasp also, but for a different reason: the libusb driver that comes with USBasp is outdated or something. The latter link leads to another one, where you can download the new driver. Also, this page with error explanations (linked in the same thread) was somewhat useful.

So, then Windows and avrdude saw the USBasp programmer I was using, but didn’t see the second identical USBasp programmer (known to work) that I used as a target (even if both of them had the green power light on):

avrdude: error: programm enable: target doesn't answer. 1

I set the “self-programming” jumper on the target, but that didn’t help right away. It did turn the target’s “power” LED off.

I additionally had to set the “slow SCK” fuse on both the programmer and the target. Otherwise there was some trouble reading the target chip signature:

avrdude: Device signature = 0x0000ff
avrdude: Expected signature for ATMEGA8 is 1E 93 07
avrdude: safemode read 1, lfuse value: ff
avrdude: safemode read 2, lfuse value: ff
avrdude: safemode read 3, lfuse value: 0
avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may
not be reliable.
avrdude: safemode: To protect your AVR the programming will be aborted

Then I got this:

avrdude: Device signature = 0x1e9307
avrdude: safemode read 1, lfuse value: ff
avrdude: safemode read 2, lfuse value: ff
avrdude: safemode read 3, lfuse value: ff
avrdude: safemode: lfuse reads as FF
avrdude: safemode read 1, hfuse value: d9
avrdude: safemode read 2, hfuse value: d9
avrdude: safemode read 3, hfuse value: d9
avrdude: safemode: hfuse reads as D9

At this point, I could basically dump the target’s memory, program it, etc.. Note that the fuse values on these programmers that I’ve bought are somewhat different from those specified in the USBasp readme.

So to sum up, the jumper positions are:

power: programmer – Vusb, target – Vtarget;
self-programming: programmer – off, target – on;
slow SCK: programmer – on, target – on.

I’ll write up what happens next.

Advertisements