Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: wanglalm on November 20, 2010, 09:02:59 AM

Title: entering programming mode.. FAILED! axon
Post by: wanglalm on November 20, 2010, 09:02:59 AM
Please help.  I click the program button before I turn on the axon, and now I can't program the mcu anymore. Is there anyway to reset it.
Title: Re: entering programming mode.. FAILED! axon
Post by: Admin on November 21, 2010, 10:29:10 AM
Can you describe the problem in detail, going through all the steps? I'm not sure what problem you are having.
Title: Re: entering programming mode.. FAILED! axon
Post by: wanglalm on November 21, 2010, 04:47:39 PM
I'm using a avrisp mkll programer, avr studio 4
The problem started when I try to upload a new program using isp, and forgot to turn on axon.
when I turn on axon and try to upload again, avr studio is giving me this entering programming mode failed message.

I'm getting the same message if I click on read signature, or fuses.
Title: Re: entering programming mode.. FAILED! axon
Post by: bens on November 21, 2010, 05:15:19 PM
It is definitely possible to corrupt an AVR by trying to program it while it is unpowered, but I expect the avrispmkii programmer to be smart enough not to try programming an unpowered AVR.

- Ben
Title: Re: entering programming mode.. FAILED! axon
Post by: Admin on November 21, 2010, 05:19:46 PM
Check your battery voltage just in case . . .

Unfortunately this is a bug with the ATmega's, that on very *rare* occasions, if you program it without power, it'll cause a crystal fuse corruption.

Here is how you fix a bricked Axon:
http://www.societyofrobots.com/axon/axon_FAQ.shtml#brick (http://www.societyofrobots.com/axon/axon_FAQ.shtml#brick)

Also, see the diagram on page 48 of the ATmega640 datasheet (http://www.atmel.com/dyn/products/product_card.asp?PN=ATmega640).

You will need something that creates a high frequency square wave, like a function generator or another microcontroller using PWM, applied to XTAL1. Then using your ISP programmer you can change the fuse back to the crystal:
http://www.societyofrobots.com/axon/axon_FAQ.shtml#fuses (http://www.societyofrobots.com/axon/axon_FAQ.shtml#fuses)

Think about it for a bit, and if you get stuck, feel free to ask.

It is definitely possible to corrupt an AVR by trying to program it while it is unpowered, but I expect the avrispmkii programmer to be smart enough not to try programming an unpowered AVR.
I find it's smart enough about 2/3rds of the time. Probably has to do with partially charged capacitors on the mcu board even though it's off.