Oh The Things I Don’t Know! – AVR ISP Edition

Some day I hope to do something with hardware worth writing about in its own right. For now though I am stuck documenting the absurdity of my learning experiences.

The only micro-controller stuff I’ve ever done is with an Arduino. I would like to change that, so I bought an Alpha Clock Five from Evil Mad Science to play with. Not only could I learn about AVR programming, I’ve had an idea since about 2001 for a product that doesn’t exist which is built around a digital clock. Got the kit and an AVR ISP programmer, built them both, very happy with the clock with its default programming, and the AVR programmer responds to “pings” from avrdude. Woot!

Soda cans not included...

But! I had no idea how to actually program the chip. Hrm. OK, found a couple of pages about building minimalist AVR programming boards (like this one, coincidentally also from EMSL), pretty much confirming what I had been thinking: A ZIF socket, some perf board, a male header, and some leads. That actually kind of sounded like a fun little thing to put together. Then I started thinking about how it would suck to have to pull the chip out of the clock for each program/test cycle, so maybe I could expand that minimalist board to include full headers for the 40-pin ZIF that could go back to the socket on the clock. Cool, I could do this!

I’ve been tossing this around in my head overnight, deciding that it was definitely something I could build, and even sounded like fun. Two things were nagging me though. First, if this is a real problem, why aren’t there more solutions. Second, why didn’t EMSL mention this in their otherwise excellent docs. Then a snippet I read last night on what an ISP actually is (In System Programmer) popped up in my head.

I suddenly became 100% sure that there would be an empty 6- or 10-pin header on the back of the clock. I happened to be in the shower right at that moment so it was a bit before I could check, but sure enough, there it was.

Why hello there you sexy beast...

I went and checked the build docs to see what they called that header. Sure enough it’s the “Six-pin DIL ISP Header”. I guess I don’t need to build the little barebones programmer I had laid out in my head (maybe some future project).

This post has two points. The first is that I’m constantly amazed at what I don’t know. These kits are put together by people who are striving very hard to make it very easy for beginners to engage with them (I assume they are at least, on the theory that a happy newb is more likely to be a repeat customer) and yet I still almost managed to wander off into the weeds.

The second is this. That header was the inspiration for this little blurb I posted on Google plus a couple of days ago:

I have made an important discovery tonight (actually I made it last night, forgot it, and re-discovered it tonight). I think this is a fundamental contribution to hobby electronics, as I haven’t seen it written down anywhere. Ready?

If you try the “tack one post, then press down on the component while re-heating to fully seat” trick with a male header, you will burn the ever-loving *&^% out of your finger. Those pins go all the way through people.

This component had actually gotten my attention enough to make me go out of my way to write about it, but it still didn’t come to mind when I was trying to figure out how to program the darn thing.

But, the upside of all of this is that I get to play with programming my clock tonight without having to order parts for a programmer board!

Updated 2012-03-12: …except that I didn’t get to play with it, because, while the ISP method of programming is technically supported, the provided source code won’t work with an ISP. The system also comes with an FTDI interface, and it’s through this interface that the default firmware is expected to be loaded. As shipped, the chip is pre-loaded with a slightly modified Arduino environment, and then the default system for the clock is coded against and run via that Arduino environment. The ISP works, but it would only do low level programming, overwriting the Arduino environment, and clock source has been written against the bare metal. The only way to load into the Arduino environment, using the default clock code, is via the FTDI interface. That’s fine, except I don’t own a FTDI (USB-TTL) cable. Reading back through all the docs, this was all stated, I just didn’t understand what was being stated. I think the only thing that would have saved me was something like “Note that there is no example source code available for programming the clock via the ISP interface” in the ISP section. I saw that the clock was programmable via the ISP and assumed the example code would work with it. I have a USB-TTL cable on order, so no big deal, just more examples of not knowing what I don’t know.

Also amusing in this last vignette is the realization that I still won’t have been working outside of the Arduino environment. Oh well, the clock’s still awesome…

2 thoughts on “Oh The Things I Don’t Know! – AVR ISP Edition

  1. What you said about only being able to program the standard source code through the FTDI interface isn’t quite correct.

    It is actually straightforward to use a standard ISP programmer (and the Alpha Clock Five’s ISP port) directly from within the Arduino environment:
    http://arduino.cc/en/Hacking/Programmer

    It is also possible to use the existing code (and the Arduino libraries) from within straight AVR-GCC, using standard makefiles, if that’s how you prefer to work:
    http://www.ashleymills.com/node/327

    You can also program the clock in AVR-GCC “bare metal,” without any additional libraries, starting from the schematic and datasheets. We can provide direct examples of this upon request, but it will not have some of the library features that we normally rely upon, including I2C and serial communication.

    • Hi Windell, thank you for taking the time to comment. I certainly wasn’t trying to turn a random blog post into a support request but I suppose it makes sense to get answers into the nooks and crannies google might turn up.

      I cycled off of the clock when I ordered the USB-TTL cable, but I look forward to getting back to it soon and learning from the links you posted.

      I hope you don’t think anything in the above is negative about EMSL or the clock itself, both of which I love.

Leave a Reply

Your email address will not be published. Required fields are marked *