NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Loading A Bootloader

April 09, 2009
by Starwarslegokid
Starwarslegokid's Avatar

Hello Everyone,

I just bought my Nerdkit over a month ago and I'm loving it, and I'm ready to expand to multiple projects at once to experiment. I bought a serial programmer from Sparkfun to be able to put the bootloader onto blank chips.

Serial Programer: http://www.sparkfun.com/commerce/product_info.php?products_id=14

I tested the programmer and it works great, I followed this tutorial: http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=93

Now I'm ready to put the Nerdkits bootloader back on my chip, and I'm not quite sure what I need to do. I took a look in the bootloader folder and theres allot of files in there. I tried using the command prompt to make the make file, but it gives me this error:

avrdude -c dapa -pm168 -U lock:w:0x2f:m avrdude: can't open device "giveio" avrdude: failed to open parallel port "lpt1" make: *** [fuses] Error 1

Iv looked in the make file and I cannot figure out how to get the programmer to use COM4. Any help would be great!

Scott B-)

April 10, 2009
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Scott,

I have never used that programmer before, but doing a little bit of reading about it, it looks like you want to use the -c ponyser argument instead of dapa. You also want to use -P COMX, where X is the COM port your serial port is assigned to. So the AVRDUDEFLAGS in the Makefile should look something like this.

-c ponyser -p m168 -P COM4

There also appears to be a software package that works with this programmer http://www.lancos.com/prog.html. It looks like you can just load the .hex file onto that program, set the device type and the COM port and press go.

Hope this helps.

Humberto

April 10, 2009
by Starwarslegokid
Starwarslegokid's Avatar

Hi Humberto!

Thank you for the help, I changed that line of code and the bootloader started programing

I started programming the chip and it took to my surprise two and a half hours to program, and then at the very end I got this error:


avrdude: verifying ...

avrdude: verification error, first mismatch at byte 0x0000 0xff != 0x00

avrdude: verification error; content mismatch

avrdude: safemode: lfuse changed! Was f7, and is now 0

Would you like this fuse to be changed back? [y/n]


Do you have any idea what might be going wrong? Thanks for all the help! B-)

Scott B-)

April 10, 2009
by hevans
(NerdKits Staff)

hevans's Avatar

Scott,

Sorry I'm just not familiar enough with that programmer to be able to help you there. Did you try giving PonyProg a whirl? It seems like a program specifically designed with your cable in mind would be your best.

Humberto

April 12, 2009
by Starwarslegokid
Starwarslegokid's Avatar

Hi Humberto,

I spend some time playing with PonyProg and I got it to work! B-) It is a nice little program, I found the ATmega168 and set up communication on com4, and then it was as easy as opening the hex file and clicking Write to Flash. It took me quite awhile to get there lol, the program has a tendency to freeze badly if you do a invalid operation like have the wrong microcontroller selected, and then I wrote the program to the EEPROM lol ;-).

One last question, I want to make sure the fuses are still set to your default settings. Does this screenshot look correct to you?

Thanks for all your help!

Scott B-)

alt image text

April 18, 2009
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi Scott,

Those fuses look the same as how we program them, with one exception: we additionally set BootLock11 (known in the ATmega168 datasheet as BLB11). Note that "set" means "checked" or "bit=0" in this context. This setting prevents the bootloader from overwriting itself! Since you are able to program the full chip directly, without using the bootloader, this isn't a significant concern for you.

Mike

April 29, 2009
by BobaMosfet
BobaMosfet's Avatar

Scott,

It is very worth reading the data sheet on the ATMEGA168. If you read the .PDF, downloadable here at NerdKits.com, you will find the information about the fuses. You can set them to whatever you like-- the main thing is, the data sheet tells you what each fuse is for, so you can decide how you want it set.

May 31, 2009
by luisgarciaalanis
luisgarciaalanis's Avatar

what is this boot loader fuse thing?

Post a Reply

Please log in to post a reply.

Did you know that microcontrollers have two different kinds of memory, program space (flash) and SRAM? Learn more...