It’s a long and winding road, that path to finding an easy way to program the JeeNode Micro v3, as mentioned two days ago. With emphasis on the “easy” adjective…
Let me at least describe the process details of what I’ve been using so far:
- A custom cable to connect the JNµ to an ISP programmer
- Installed copy of the “arduino-tiny” project from Google Code
- A trick to get the Arduino IDE compile the sketch into a HEX file
- Setting up the JeeNode + Flash Board as an ISP programmer
- Using avrdude directly, to set the fuses and upload the sketch into the JNµ
It works, in fact it works fine once you’ve set it all up – but easy? Hm…
Let’s go through each of these in turn.
1. Custom cable
This was described a few days ago. Let me just add that it’s very easy to take apart the connectors on the Extension Cable, once you know the trick:
It’s all a matter of gently lifting the plastic tabs, then the wires come sliding out. Note that this is the wrong end of the cable for our case – but the other end works the same.
2. Arduino-tiny
These files on Google Code contain all the necessary code to trick the Arduino IDE into compiling for ATtiny processors, including the ATtiny84 used in the JNµ.
It works with IDE 1.0.x as is, if you follow the instructions, but I’ve been reorganising it to meet the requirements of the new multi-architecture IDE 1.5.x series, which would support this as a straight drop-in. I’m still working on it, but it means you can then just press the “Upload” button – a lot simpler than the process being described in this post!
3. Hex files
Normally, the Arduino IDE takes care of everything: compilation as well as uploading. However, for this setup, we need to get hold of the raw HEX file that gets generated before uploading. There’s a preference in the IDE for that:
Now the nasty bit: you have to compile (“run” in Arduino IDE terms, go figure!) the sketch to see the output that gets generated, and then copy the full path from the output window:
In this case, it’s that “/var/folders/…/radioBlip2.cpp.hex” thing.
4. ISP programmer
To turn the JeeNode + Flash Board combo into an ISP programmer, upload the isp_flash.ino to it. Make sure you get the very latest version, which uses 9600 Baud for communication, as that makes it compatible with the “Arduino as ISP” programmer:
As mentioned before, you don’t really need the Flash Board at this stage – a couple of wires will also work fine (see these posts about all the ways this can be done).
5. Avrdude
The last step is to call the “avrdude” uploader from the command line, specifying all the arguments needed, and pasting in that full file name. In my case, it was something like:
avrdude -v -v -pattiny84 -cstk500v1 -P/dev/tty.usbserial-A600K04C \
-b9600 -D -Uflash:w:/var/folders/.../radioBlip2.cpp.hex:i
Oh, and if this is the first time you’re programming this ATtiny84 chip, then you also have to first set the fuses properly, as follows:
avrdude -v -v -pattiny84 -cstk500v1 -P/dev/tty.usbserial-A600K04C \
-b9600 -e -U lfuse:w:0xC2:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:m
That’s the internal RC oscillator with fastest startup, and the brown-out level set to 1.8V.
As I said, this is the messy way to do things. I’ll try to have something simpler soon!
Er, why can’t you upload using the Arduino as ISP programmer straight from the Arduino application? (Tools->Programmer->Arduino as ISP) That’s how I use my USBasp programmers. Once that’s set, you should be able to choose the appropriate “ATtiny84” in the boards menu, then Tools->Burn Bootloader to set the fuses, then File->Upload Using Programmer to compile the script and flash it using the ArduinoISP. That gets rid of steps 3 and 5 at least. The tiny core is still sort of a problem, but I hear it’s better in 1.5.
Mind you, at least once a month I forget to change the programmer and board and accidentally upload a script to my desk’s clock and then sigh and put the proper .hex back onto it. But generally that should work at least as of the 1.0.x releases and is how I update my t85 based blinkenlights.
(And per #1: I long for someone to just standardize on a small footprint SMD friendly AVR ISP header. 6 pins in a row at 12.7mm spacing? Board edge footprints to wedge a standard 6 pin ISP onto? Unfortunately I think everybody it just making it up as they go along.)
Aha, the “Upload using programmer” bit is what I was missing – I’ll look into it, thank you!
As for small ISP header. Indeed, it’s quite a mess (I’m working on it…).
Are you sure it’s not the “/var/folders/…/radioBlip2.cpp.hex”-thing?
Ah yes, thank you – eagle eyes!