Burning the Arduino Bootloader to an ATmega328 With a MiniPRO TL866CS
As I continue working on digitizing old VHS tapes, I decided I wanted to at least partially automate the VCR control so I set about building a computer controlled universal remote with an old Arduino Duemilanove with an ATmega168. It didn’t take much to start running up against the 1k RAM limit. I purchased a ton of ATmega328s for cheap without a bootloader several years ago since I knew I could use another Arduino and a bunch of parts on a breadboard to burn the bootloader, but I wondered if there might be an easier way.
Looking at the specs for the MiniPRO EPROM burner I have, it claimed that it could handle an ATmega328. The problem is that there’s actually two versions of the TL866, the TL866A which has an ICSP port, and the TL866CS which does not. My version is the TL866CS, so I wasn’t sure if it was possible. Doing some searches on the internet actually didn’t turn up anyone claiming success with it either.
Since I have a tube full of chips, I figured I might as well find out if I can use the TL866CS. I popped an ATmega328 into the MiniPRO, selected the right chip type, and dug around inside the Arduino IDE install to find the hex file for the Optiboot bootloader†. At first I thought the hex file wasn’t loading in the MiniPRO software, but that’s because it loads way at the end of the address space. Scrolling to the end revealed the MiniPRO software had loaded the hex file fine.
After programming the chip, I popped it into the Duemilanove and powered it up. I got blinking which seemed good! But the Arduino IDE wasn’t able to upload a sketch. Doing some more research I found that I needed to set the fuses on the chip. This is where it got a little confusing. In the MiniPRO software you can switch to a panel which will allow you to change the fuse settings, and shows the hexadecimal value for the fuse register. Setting the high and low fuse bytes took a little bit of fiddling but I was able to make the numbers match. But the extended and lock bits seemed impossible. The trick was ignoring the high “unused” bits that the configuration won’t let you modify. Once I did that I was able to set those last two fuse bytes.
Putting the ATmega328 back in the Arduino I tried again to upload a sketch. Still wouldn’t work! Turns out that I had burned the Optiboot bootloader, and when the Arduino IDE is set to Duemilanove it doesn’t know how to talk to it. I switched the IDE to Arduino UNO and suddenly uploading worked!
It bothered me though that the UNO uses a slightly different processor and I wanted to make sure that when I was doing a compile it would target the 328. Looking around in the bootloader folder I found another hex file‡ which I tried. After burning that bootloader I was able to set the IDE back to Duemilanove and ATmega328 processor.
Now I’ve got double the RAM and double the flash! That was actually incredibly easy! Much less work to pop a chip into a ZIF socket than stick a bunch of things on a breadboard!
† C:\Program Files\Arduino\hardware\arduino\avr\bootloaders\atmega\ATmegaBOOT_168_atmega328.hex
‡ C:\Program Files\Arduino\hardware\arduino\avr\bootloaders\optiboot\optiboot_atmega328.hex