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.

Support Forum » What is the proper way to debug chip programming errors?

February 08, 2012
by maurin
maurin's Avatar

Along with many others on the forum, I'm having "butterfly_recv(): programmer is not responding" errors.

So far I've found at least four posts that are relevant to these types of problems.

I'm running OSX 10.5.8, using AVRMacPack from the downloads page. Most of the time I'm getting an error on the "reading on-chip data" step after the write.

pmaurin@pablo:~/nk/pab/initialload$ make
avrdude -c avr109 -p m168 -b 115200 -P /dev/cu.PL2303-0000101D -e

Connecting to programmer: .
Found programmer: Id = "FDL v02"; type = S
    Software Version = 0.2; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x35

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9406
avrdude: erasing chip

avrdude done.  Thank you.

sleep 1
avrdude -c avr109 -p m168 -b 115200 -P /dev/cu.PL2303-0000101D -D -U flash:w:initialload.hex:a

Connecting to programmer: .
Found programmer: Id = "FDL v02"; type = S
    Software Version = 0.2; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x35

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9406
avrdude: reading input file "initialload.hex"
avrdude: input file initialload.hex auto detected as Intel Hex
avrdude: writing flash (7838 bytes):

Writing | ################################################## | 100% 8.33s

avrdude: 7838 bytes of flash written
avrdude: verifying flash memory against initialload.hex:
avrdude: load data flash data from input file initialload.hex:
avrdude: input file initialload.hex auto detected as Intel Hex
avrdude: input file initialload.hex contains 7838 bytes
avrdude: reading on-chip flash data:

Reading | ########################################           | 80% 0.78s

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

After this, the chip is left in some unrecoverable state. So I just unplug the battery, and USB cable, the plug everything back in.

On average, I'm getting about 10% success. All other times I get some kind of error.

So far, I have tried:

  • adding the sleep delay to the Makefile.
  • Using USB power instead of the battery
  • connecting battery and USB serial in different order
  • removing LCD panel (now put back on)
  • using different USB ports on my machine (no hubs)

I have not had two consecutive successful writes. Tonight, I'll try booting into Windows, to see if that makes any difference with the drivers.

Mainly the frustration is not knowing how to see where the problem is coming from. I feel like I'm just randomly trying things, hoping something will work.

Do you guys have any suggestions for things that I can directly measure and check? I have a good multimeter and an old scope available, if that will help.

I'll include pictures of my board tonight.

February 08, 2012
by maurin
maurin's Avatar

Here's the image for the bread board.

breadboard

February 09, 2012
by maurin
maurin's Avatar

Alright, so I booted my computer into Windows XP. Programming the chip works perfectly. This was very telling. I'm using the same computer, the same USB port, the same USB cable, the same NerdKit breadboard. The only thing that changed was the OS on the computer.

If I boot my Mac into OSX (64-bit v10.5.8), I get the intermittent problems described earlier. If I boot the same machine into Windows XP (32bit), I can program the chip all day long.

For all these tests, I'm using the software and drivers from the download page. AVRMacPack for OSX, and WinAVR package and PL2303 drivers for Windows.

In one of the posts, there was talk of a issue with the mac prolific drivers. Seems like there is something to this.

On OSX, I observe the failure as follows. After a failed write, I unplug the battery to reset the chip. That does not work. In one of the posts, Ralphxyz mentioned there being a voltage on the power rails. I measured, and indeed found 2.36V. As mentioned in that post, it seems that keeps the Atmel chip in an indeterminate state, and it will not program.

The solution was to unplug the USB cable form the computer, and try again. But with 10% success on write, it is hit or miss on OSX. For now I'll do my programming on the windows side.

I'll try adding the switch to the yellow wire, and report.

February 11, 2012
by Ralphxyz
Ralphxyz's Avatar

Hi maurin, I "had" similar problems to what you are describing. Eventually I got everything working but never could say what actually made the correction.

You also might add a switch to ground on pin 1 with a 1k resistor to the Vcc (+) rail!

There is an ongoing thread with Humberto and Rick helping out on doing this!

This works on my Mac MINI (OS X 10.6.8)

Ralph

Post a Reply

Please log in to post a reply.

Did you know that reading a double floating point variable with scanf requires "%lf" for "long float"? Learn more...