Installing a Bootloader on the MicroView
Burning the Bootloader
This section will cover two readily available software tools that can be used to interact with your AVR ISP to burn a bootloader onto your MicroView. Pick one that best suits your comfort level:
- Arduino IDE – If you have the Arduino IDE installed, this is an easy GUI-based way to program your bootloader.
- AVRDUDE (Command Line Utility – AVRDUDE is a command line utility which can be invoked to program AVR’s. This method is recommended only for advanced users. Unknown factors, like file locations and environment variables, come into play here, so you may have to slightly alter our example commands to get them to work on your computer.
The Arduino method won’t give you instant gratification after burning the bootloader. The MicroView Demo code isn’t included with the bootloader, so you’ll have to upload it separately, after burning the bootloader. With AVRDUDE you can pinpoint the HEX file you want to upload, so you can upload the combined bootloader/MicroView Demo file and instantly discover if your MicroView is back to 100%.
Open up Arduino, then go up to Tools > Programmer. Select the programmer that matches what you’re planning on using. For the programmers we’ve discussed in this tutorial, that will either be USBTinyISP or Arduino as ISP.
If you’re using an Arduino as the ISP, make sure the Serial Port is set to that Arduino’s port number. If you’ve recently uploaded the ArduinoISP sketch to your Arduino, it’s probably set correctly, but check!
Finally, make sure the board is correctly set. This will determine which bootloader gets programmed onto your MicroView. It should be set to Arduino Uno.
That’s all for the settings. Now, make sure your programmer is correctly connected to your MicroView, and go to Tools > Burn Bootloader, and enjoy the light show.
The bootloader burn process usually takes around 30 seconds. If your holding the jumper wires in place, hold steady! After the bootloader has been programmed, you should see a surprisingly brief “Done burning bootloader” message above the console.
If you get an error, like
avrdude: initialization failed, rc=-1, there’s either an incorrect or missing connection. Double-check to make sure everything is connected correctly.
If you’ve gotten good news, continue on to the Testing and Closing section. The MicroView screen will be blank; during bootloader upload, the program that was on the MicroView was erased, so, for now, the MicroView doesn’t have any sketches on it.
Behind the scenes, Arduino uses AVRDUDE to communicate with and command your programmer. Instead of using Arduino as a front end, you can invoke AVRDUDE from the command line. You’ll need to have AVRDUDE installed or existing on your computer somewhere (download AVRDUDE here).
You’ll also need the (working) MicroView HEX file, click here to download the MicroView bootloader hex file, “MicroView_combined_8-19-14.hex”. To make the example commands easier, we’ll assume the hex file is in the same location as AVRDUDE.
If you have an AVR Pocket Programmer or Tiny AVR Programmer, a command like this will upload the bootloader to your Arduino.
avrdude -c usbtiny -p atmega328p -U flash:w:MicroView_combined_8-19-14.hex -U lock:w:0x0F:m
If you’re using an Arduino as an ISP, use a command like below. You’ll need to put your Arduino’s COM port # in place of our placeholders (
COMN for Windows or
/dev/tty.usbmodemNNNN for Mac/Unix):
Windows: avrdude -p atmega328p -c avrisp -P COMN -b 19200 -v -e -U flash:w:MicroView_combined_8-19-14.hex -U lock:w:0x0F:m Mac: avrdude -p atmega328p -c avrisp -P /dev/tty.usbmodemNNNN -b 19200 -v -e -U flash:w:MicroView_combined_8-19-14.hex -U lock:w:0x0F:m
After sending the command, your terminal will be swamped with writes, reads, and other messages until the entire bootloader has been programmed.
After AVRDUDE says it’s done, the bootloader should be programmed. As an added bonus, this HEX file includes the MicroView demo – once it’s been programmed the display should light up and start cycling through patterns.