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 » Can only program chip using USB power? Butterfly error

August 08, 2013
by dvdsnyd
dvdsnyd's Avatar

Hi all,

I have an interesting situation..

I had prototyped a circuit for a rocket altimeter on perfboard using a very basic set up. Basically a bare bones NK. I was unable to get the chip to program a simple LED blink code.

Notable information: - Running everything at 3.7 V Lipo battery - Only communication between PC and MCU was with serial TXD and RXD lines. - I have posted and seen posts of people being able to program the chip to about 3.6 volts, anything lower than that, the crystal cuts out.

I tried and tried, and looked for wiring errors, could not find any - in my frustration I ended up destroying all my work trying to find errors.

Then, I figured, I would try a fresh MCU with a known good NK bootloader installed and wire up the SAME simple circuit on a breadboard and give it a go...same problem. I get a butterfly error when trying to program.

Then, I tried to see if I could program using USB power...Bang, works every time.

Then, I thought maybe it was because I was using lower than 5 volt supply. I hooked up a separate 5 volt supply, got everything wired up, but I cannot get the chip to program. If I switch everything to USB, it works.

Any ideas on this? What should I be checking. I have never seen this problem before. I even tried to see how my new homemade dev board would handle this issue, it seems to be working just fine, even if I have a 3.6V supply.

I have to be missing something...

Thanks for your help!

Dave

August 08, 2013
by pcbolt
pcbolt's Avatar

Dave -

You said the only wires connected between the PC and MCU were TXD and RXD. How about ground? I think xodin had a similar problem and ended up using the internal clock and not the 14 Mhz crystal with 3.3 volts.

August 09, 2013
by dvdsnyd
dvdsnyd's Avatar

pcbolt,

Thank you! I can't believe I overlooked such detail like that. I went back and checked the original NK documentation and it has you connect the ground line from the programmer. I bet that is my problem. I am at work now, I will have to give it a try this afternoon/evening. I will get back to you with the results.

In response to the 3.3 volts and 14 Mhz crystal, I think you are correct, unless you change the fuses. However, I know you can get away with the 14 Mhz crystal at 3.6 volts. The limiting factor is the MCU/crystal, not the programmer, from what I understand.

Dave

August 09, 2013
by pcbolt
pcbolt's Avatar

Actually I've used 3.3v and 14 Mhz with no trouble at all. Guess it's just hit or miss.

August 09, 2013
by dvdsnyd
dvdsnyd's Avatar

Thanks again pcbolt,

Wow do I feel silly. Plugged in the ground to the programmer, and I can program using a separate power supply...oh well...chalk it up to a learning experience! Thanks for the quick response.

I will have to try putting my supply to 3.3 volts and seeing what comes of it. I have tried before and I don't think I have ever gotten it to work.

Have you tried 3.3 volts with the 14 Mhz crystal with more than one 168?

Dave

Post a Reply

Please log in to post a reply.

Did you know that NerdKits make a great gift? Learn more...