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 » initialload not writing

August 23, 2011
by Jon
Jon's Avatar

Hi -- I'm running Snow Leopard and using AVRMacPack. I edited the Makefile with the port address from /dev, and make appears to see everything, but doesn't seem to be able to write to the chip. I'm using a 9v AC adapter, so it's not the battery. I've unplugged, re-plugged, rebooted, and connected/disconnected the NK as well. Double-checked the port and the wiring. I've read a few other threads to see if I'm missing something obvious.

Here is the progress output from Terminal:

Jon$ make
    make -C ../libnerdkits
    make[1]: Nothing to be done for `all'.
    avr-gcc -g -Os -Wall -mmcu=atmega168  -Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm -o initialload.o initialload.c ../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o
    avr-objcopy -j .text -O ihex initialload.o initialload.hex
    avrdude -c avr109 -p m168 -b 115200 -P /dev/cu.PL2303-000014FA -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: NOTE: FLASH memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
    avrdude: erasing chip
    avrdude: reading input file "initialload.hex"
    avrdude: input file initialload.hex auto detected as Intel Hex
    avrdude: writing flash (7838 bytes):

    Writing |                                                    | 0% 0.00savrdude: butterfly_recv(): programmer is not responding
    make: *** [initialload-upload] Error 1

Any ideas for what to check/do next?

Thanks,

--Jon

August 24, 2011
by Ralphxyz
Ralphxyz's Avatar

Unplug your USB cable plug it back in, try again.

Pretend you are on a Windows machine and Reboot.

To see some of the discussions on this common problem for OS X search the forum for "yellow wire".

The problem is the yellow USB wire is constantly energised after the first programming attempt.

The voltage on the yellow wire holds the mcu in a zombie state.

Ralph

August 24, 2011
by Jon
Jon's Avatar

Thanks Ralph. I did the unplug/re-plug/unplug/re-boot/re-plug sequence a couple times, but it didn't seem to help.

I did not see the "yellow wire" posts though, so I'll go back through those and try any hints.

--Jon

August 24, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Jon,

This issue seems to be the same as the one experienced by other Mac users on 64 bit machines. http://www.nerdkits.com/forum/thread/68/. Basically the solution comes down to modifying your makefile slightly and breaking up this line

avrdude ${AVRDUDEFLAGS} -U flash:w:initialload.hex:a

to these lines

avrdude ${AVRDUDEFLAGS} -e
sleep 0.1
avrdude ${AVRDUDEFLAGS} -D -U flash:w:initialload.hex:a

Give that a try and let us know what happens.

Humberto

August 24, 2011
by Jon
Jon's Avatar

Thanks Humberto,

After Ralph's comment this morning, and going back through the dozens of (convoluted) threads that I've found now regarding the yellow wire, Macs, Makefile timing, and reset switches, I tried to break these down into three distinct steps to try and isolate into a repeatable working scenario.

1) I found a few references to people who said a specific sequence of connecting/disconnecting, powering/un-powering, plugging/un-plugging USB, etc. would work. In some combination or another often with re-booting the Mac. I found the various sequences produced mostly random results. Eventually I determined that the following sequence did provide consistent results with my Mac:

      * unplug the USB
      * disconnect power from NerdKit
      * set switch to program mode (up)
      * power up NerdKit
      * plug in the USB (cancel the nag about network i/f from MacOSX)
      * 'make' from terminal
      * unplug USB
      * disconnect power from NerdKit
      * switch to run mode (down)
      * power up NerdKit

So this sequence, which is obviously resetting everything, but not requiring the often mentioned re-boot, worked consistently for my setup (because the USB is disconnected by the time I'm ready to run, hence the MCU has been reset).

2) The next most frequently mentioned possible solution/suggestion was to add a delay in the makefile, as you suggested here, and numerous other places too (now that I knew what to search for). In my case that does work, but still requires that I disconnect the power to the NerdKits each time as I move the switch from program to run mode. Which suggests that I still need to add a reset switch...

3) Reset switch -- The third most commonly mentioned thing, which I haven't done yet, is to add a reset switch to the USB yellow (and?) red wires. I've been looking for a thread that succinctly explains how Ralph and others have wired their reset switches, since it seems like that solves the 'needing to disconnect power' issue for each download. Noter's double MOSFET solution here and here is elegant, but I'm not groking it. Ralph mentions in many posts using a DPDT switch connected to his yellow and red wires, but I'm not finding where he's connecting them to when he flips/resets his switch.

So, bottom line I've got it working, but I really need a simple photo or explanation of how best to add a reset switch, and where it needs to be connected. (I'm new at this, so is 'reset' connecting pin 1 to +5 or GND, or what?)

Based on my experience it seems like the combination of makefile timing and a reset switch is the complete solution to this problem for anyone with this "yellow wire" problem on a Mac.

Thanks for the help and pointers so far,

--Jon

August 24, 2011
by Jon
Jon's Avatar

A little more digging and I found this thread which gives me more info on what Ralph was specifically doing with his switch, and, more importantly, BobaMosfet's two LED suggestion. I hooked up two LEDs, a yellow and green, on the yellow and green wires of the USB->serial wires and it is very obvious now when something is happening, or if power is still on one of the lines.

Now I just need to dig around in the junk pile for a switch to use for the reset.

--Jon

Post a Reply

Please log in to post a reply.

Did you know that NerdKits has a TV commercial, seen on MythBusters and the Science Channel? Learn more...