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 » Programmer not responding when using ATMEGA8

June 21, 2012
by rmore
rmore's Avatar

Hello All,

I am using the set up explained in Nerdkits tutorial to display text on the LCD. When I use the ATMEGA168, everything works fine.

Now I change the chip only and use ATMEGA8. I also open the Makefile and change 168 to 8 at two places (in GCCFLAGS and AVRDUDEFLAGS). But now the chip does not get burned with the hex code - instead I get an error message:

Connecting to programmer: . avrdude: butterfly_recv(): programmer is not responding make: *** [initialload-upload] Error 1

What could be causing this? Is there anything else that I have to change besides the chip type in Makefile? Do i need to make any other changes?

Please let me know what is going wrong.

Thanks.

Rmore

June 21, 2012
by pcbolt
pcbolt's Avatar

Rmore -

Where did you get the bootloader code for your ATmega8 chip? If it came pre-programmed with the chip, there may be a different baud rate.

June 21, 2012
by rmore
rmore's Avatar

pcbolt -

I bought this ATmega8 chip from Digikey. I thought I could directly plug it into my breadboard and start working with it. All that needed to be changed is the chip description in the Makefile.

How can I check the baud rate now? What should the baud rate be for the chip to work? If it needs to be changed, how do I change it?

Thanks.

Rmore

June 22, 2012
by pcbolt
pcbolt's Avatar

@ Rmore -

I could be wrong but all the chips I've gotten from places other than Nerdkits (I bought 3 ATmega644P's), have arrived completely blank, meaning there is no bootloader code on the chip. This means you have to either load your code onto the chip directly each time or load the bootloader program onto the chip then program as usual. Both of these solutions require an external programmer like the AVR Dragon, USBASP, AVR MKII, USBTinyISP, etc... You will have to modify the Makefile for the bootloader program (called foodloader.c) and re-compile foodloader. Most likely you will have to change the fuse settings which you can do with the external programmer, then you can upload "foodloader" to your ATmega8. There is an excellent write-up on this in the NK library under the "How do I?" section by Rick_S.

I went through the whole process using an AVR Dragon and was surprised how much I learned and that the process was not that hard at all. If you are going to get more chips from Digikey or Mouser in the future, I would HIGHLY recommend going through the steps so any chip you get can have the bootloader installed. I'd be happy to help out and if Rick_S is available I'm sure he'd have some great advice for you as well.

June 22, 2012
by Rick_S
Rick_S's Avatar

pcbolt is correct in saying that a new chip has nothing on it which is why you are getting the error you are getting.

While the ATMega8 does have a bootloader section available, I've never really installed a bootloader on one. (The available program space is small enough w/o taking up 1/8th of it with a bootloader.)

The process would be the same as for any of the others though. I think that the foodloader bootloader supports mega8's without modification to the bootloader programs. Just the makefile and/or the config.mk file(s) would have to be modified. You would also have to have an ISP programmer to install the bootloader.

You have discovered one major benefit in purchasing replacement/additional mcu's from the NK team. Not only does it support their company, it also provides you with less headaches because you know what you are getting.

Rick

June 22, 2012
by HansRoaming
HansRoaming's Avatar

Something that might help is this guide to burning a bootloader http://www.nerdkits.com/library/howto_install_bootloader/.

Now you might not want to port the bootloader to your purchased chip but instead of installing the bootloader an ISP programmer can be used to just dump your program onto the chip and it will run just fine.

Following the guide above I bought a very cheap USBASP and have used both the Nerdkit loaded chips and bare ones equally well, having both is nice as using the bootloader means you don't loose all the SPI pins if you need them.

June 23, 2012
by rmore
rmore's Avatar

pcbolt, Rick_S and HansRoaming:

Thanks a ton for all your advice. I got a AVRISP mkII. I had to struggle a lot with it to get it working! But finally I was able to figure out how it works and I am able to flash my code on the ATmega8 chip!

Thank you :)

Rmore

Post a Reply

Please log in to post a reply.

Did you know that a flyback diode is important when driving a motor or any inductive load? Learn more...