How I Fixed My MicroView's Bootloader

2.8K133

Intro: How I Fixed My MicroView's Bootloader

If you backed the MicroView project on Kickstarter this spring, like I did, then you've been eagerly looking forward to the day you'll receive yours in the mail. And you probably also know by now that the manufacturer, SparkFun, made a mistake in the manufacturing process and shipped a bunch of Microviews without bootloaders. SparkFun is going to do the right thing, and ship fixed MicroViews to anyone who receives one of the broken ones (due to their bookkeeping during manufacturing, they know exactly who will receive a broken one).

When I received my MicroView this morning, I quickly checked it and found out that it's one of the broken ones. So I'll be receiving a new one in a few weeks. But wouldn't it be cool if I could fix this one? Then I'd end up with two MicroViews instead of one (SparkFun isn't asking anybody to ship back the broken ones).

That's exactly what I did. With the help of my USBTinyISP and some helpful comments from SparkFun customer Ben Kearns, I was able to open up my MicroView, attach some wires, and upload a bootloader. Here's how I did it, step by step.

STEP 1: Open the MicroView

Opening the MicroView is simple: slide a knife blade or tip of a small screwdriver between the right edge of the clear plastic lens and the black body, apply some gentle outward pressure, and the lens should pop right out.

Optional: Remove the circuit board from the black plastic body of the Microview. To make soldering to the top of the circuit board easier, I removed it from the Microview body. Set the assembly upright on a tabletop and apply gentle downward pressure to the top and bottom edges of the body. At the same time, slip the tip of a small screwdriver between the right side of the circuit board and the plastic body. While pressing downward, twist the screwdriver just a bit, and the circuit board should pop loose and begin to slide down on the pins. Repeat on the other side of the circuit board, and it should pop completely free of the body.

STEP 2: Solder Wires to the Circuit Board

On top of the MicroView circuit board are three solder pads ("vias") labeled 11, 12, and 13. These are three of the ISP (In-System Programmer) pins: MOSI, MISO, and SCK respectively. To program the bootloader, it's necessary to send signals to these three pins; I soldered three short pieces of 22 gauge hook-up wire to them, with the help of my steady-handed wife to hold the wires in place.

Take care when soldering to these, because you can damage the board if you apply heat to them for too long. For this kind of thing, I like to use a very hot (750 degrees on my Weller WES51) iron. This may seem counterintuitive, but it means that I only have to touch the iron to the board for a second or two.

(If you have three of Adafruit's Pogo Pin Probe Clips, this is an ideal opportunity to use them instead of soldering.)

STEP 3: Connect the ISP Programmer

I used my USBtinyISP to program the bootloader, but you could also use any other dedicated ISP programmer or even an Arduino Uno to program your bootloader. SparkFun has a great guide to programming bootloaders, which includes instructions on how to connect the programmer and the commands to use to effect the upload.

Here's what you need to know to program the MicroView's bootloader:

The pins labeled 11, 12, and 13, connect to the programmer's MOSI, MISO, and SCK pins respectively. The MicroView's external pins Vcc, GND, and RST connect to corresponding pins on the programmer.

Header pin 1/Reset <--> RST [ISP header pin 5]
Header pin 8/GND <--> GND [ISP header pin 6]
Header pin 16/Vin <--> 5V [ISP header pin 2]
Circuit board pin 11 <--> MOSI [ISP header pin 4]
Circuit board pin 12 <--> MISO [ISP header pin 1]
Circuit board pin 13 <--> SCK [ISP header pin 3]

I stripped about 1/4" of insulation from the three pieces of 22 gauge hookup wire soldered to the top of the MicroView circuit board, and prepared 3 additional short pieces of hookup wire to plug into a wireless breadboard. I connected each of the six pieces of hook-up wire to the corresponding location in the 6-position female header on the ribbon cable from the USBtinyISP.

From SparkFun I downloaded the file MicroView_combined_8-19-14.hex. This is the file that should have been loaded onto the MicroView in the first place; it contains both the MicroView demo and the bootloader.

I copied the HEX file to /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr on my Mac, and then from a Terminal window in that same directory, used the command

bin/avrdude -C etc/avrdude.conf -v -c usbtiny -p atmega328p -e -U flash:w:MicroView_combined_8-19-14.hex -U lock:w:0x0f:m

to effect the upload.

STEP 4: Test the Upload

Just as a sanity check, I disconnected my ISP programmer and connected the MicroView to a 5V power supply. I verified that the demo code ran through its sequence. Everything worked as expected.

STEP 5: Test the Bootloader

Getting a bootloader onto the MicroView is the whole point of all this work; it's a good idea to test the bootloader before putting everything back together.

I didn't buy a USB dongle to program my MicroView; I didn't really see the point in spending $15 for the dongle when I already have the ability to program the MicroView using the FTDI Friend that I already own. Here's how I hook up the FTDI Friend for programming the MicroView:

Header pin 1/Reset <--> 0.1 µF capacitor <--> FTDI Friend RTS
Header pin 8/GND <--> FTDI Friend GND
Header pin 9/Rx <--> FTDI Friend Tx
Header pin 10/Tx <--> FTDI Friend Rx
Header pin 16/Vin <--> FTDI Friend Vcc

The capacitor on the Reset line allows the FTDI Friend RTS line to briefly pull the MicroView Reset pin low to initiate a sketch upload.

STEP 6: Put It All Back Together

If you haven't already, desolder the wires you soldered to the top of the MicroView circuit board or clip them close with a pair of diagonal cutters. Put the circuit board back into the base, if you removed it, and apply some gentle pressure to snap it into place. Return the lens to the top of the assembly and again a little pressure will snap it back into place.

You now have a complete MicroView ready for programming.

3 Comments

Thanks for publishing this instructable. I'm just about ready to flash my MicroView, but I'm a bit unclear on the command line needed to load the hex file as the text shown on the Make: site is somewhat different that what you have:


./avrdude -C ../etc/avrdude.conf -P /dev/tty.usbmodem1411 -b 19200 -c avrisp -p m328p -v -e -U flash:w:/Users/aa/Downloads/MicroView_combined_8-19-14.hex -U lock:w:0x0F:m

I understand I need to change the COM port and path to the hex file, but there are some other fundamental differences. I would like to get it right the first time. Could you clarify?

I think the differences can be attributed to the fact that the Make instructions were written on a Windows system whereas mine are for a Mac. Use whichever is most similar to your system.
Thanks Jim,

After a little more reading, it seems it might also be attributable to the type of programmer being used. At any rate, even though I didn't completely understand the parameters being used, I was able to successfully complete the operation with a little bit of tweaking.

I ended up using a no-solder method, poking AWG 26 solid wires into the via holes. I used an Arduino Uno and a YAPS shield for the programming interface.