Code and Life

Programming, electronics and other cool tech stuff

Supported by

Supported by Picotech

Tips and Tricks: Flashing already soldered MCUs

I have been wanting to try this one out ever since I soldered together my USB password generator six months ago, just to realize that I would’ve actually liked to make a few changes to the firmware. The problem with my design was, that I had managed to pack everything so tightly, that there was no hope of reaching the ATtiny85 pins via normal methods to reprogram it.

I initially tried to use a 8-pin DIP socket and press it against the MCU, but it soon became apparent, that I could not keep it stable for all the pins to keep contact long enough. Lacking proper microhooks, I had to postpone the idea shown in the above photo until I just recently put my hand on this set of IC hooks from SparkFun.

The five IC hooks came one hook short of the six needed by the ISP header, but fortunately/unfortunately one of the pins was impossible to access even with these tiny hooks, so I manually held a yellow jumper wire against the MISO pin while running avrdude. Did it work? Look for yourself:

Definitely not rocket science, but for $4.95, I’d say it’s a pretty good deal!

5 comments

Xiangrui:

Why don’t you put something like bootloaderHID into the flash bootloader? Then you can update firmware from USB itself.

jokkebk:

The device used here was just an example – some can easily take a bootloader, others may have memory constraints (e.g. fitting USB functionality to 2 kB can be barely done, no bootloader will fit).

Also, with the specific project here, there’s a chicken and egg problem, because the only way to add a bootloader to the device to avoid programming it the hard way would be to somehow reprogram the device… :D

Xiangrui:

I don’t understand the chicken and egg problem very well. Yes, you will need to reprogram it for the bootloader. This needs to be done for once, preferably at the very beginning if the flash space is not an issue. For OS-claimed device, such as a keypad, you will also need a jumper, since you won’t have access top the device unless you use the un-filtered version of driver, which is not recommended to end users.

jokkebk:

OK, I’ll try to paraphrase: The point of this post was “If you have an MCU you need to reprogram but can’t, here’s a tip that may help you” – the exact reason why you would need to do ISP programming is largely irrelevant (in this case it was because I had soldered it to a tiny footprint board without programming header and DIDN’T have the foresight to add a bootloader), as the point of the post was to show a way how it can be done, if needed.

Now the bootloader tip you suggested is very useful, but of course if one has a working bootloader, this IC hook tip is completely useless.

To use a car analogy, my post was “if you twist your car key, here’s what you can do to get in”, and your tip to “if you install central locking system, you can open the door remotely without a key”. And the point of my reply was “that’s an excellent idea, but my tip was for those who for some reason don’t have central locking”. :)

With the chicken and egg problem I meant that this particular case I used as an example for this tip, the MCU was already programmed without a bootloader and soldered in, so to apply your idea, I would still need to first use my tip first. Perhaps “circular logic” would’ve been a more appropriate term “to avoid using method X and use method Y instead, I need to use method X”.

Xiangrui:

Thanks Jonas. Your tip is definitely useful.