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 » Can't load programs onto chip.

February 11, 2011
by meton_magis
meton_magis's Avatar

I'm unable to load programs onto my chip. I tried the initial load makefile, and am repeatedly getting:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

[meton@paul initialload]$ make
avrdude -c avr109 -p m168 -b 115200 -P /dev/ttyUSB0 -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 (7890 bytes):

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

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Running on Fedora 14. I've had it complete the transfer a couple times, but I'm not sure why they succeeded, and then it fails the next time I run it. I've only had it run twice good, and about 15 - 20 times stopping at the same spot. I've checked all connections several times, I can't see anything wrong.

I appreciate any help. Paul

February 11, 2011
by meton_magis
meton_magis's Avatar

I forgot to mention ( and can't edit my post), I had it come up with the "your nerdkit hardware is working" or whatever the message is that comes on the chip, and after the 2 times it did transfer, It displayed my message (I change the initialload.c code.)

February 11, 2011
by 6ofhalfdozen
6ofhalfdozen's Avatar

I don't know if this might be the problem but loose wires have gotten me several times. The red and black wires coming out of the thick black cord on the upper right of your photos(serial to USB cable??) look like they could be loose. The red going to + really looks to be loose, unless it has a really long stripped length and sticks out. The black wire going to - also looks loose but not as bad. The rest of your wires all look like they are fitted to the breadboard all the way to the insulation. anyhow, just what pops up to me.

February 11, 2011
by meton_magis
meton_magis's Avatar

the angle of the pictures makes it look really bad, but those 2 specific wires are good. I checked the voltage with my multimeter on the opposite rail, and was getting about +5v. Also had an LED plugged into the rails directly.

1 odd thing I noticed is that the LED runs dim when the usb red wire is disconnected. I checked, and there is around 3.3v on the rails when my usb cable is plugged in, and the red wire is disconnected. I figured out it's coming from the yellow USB wire. Is it supposed to be going through the MCU into the rail?

February 11, 2011
by 6ofhalfdozen
6ofhalfdozen's Avatar

Where are you powering your circuit from?? If you are only using USB to power your circuit, it might not be providing enough current to power everything, especially the LCD display. Most USB ports are meant for low mA power only(~<50mA). The yellow USB wire should NOT be bleeding power to the power rail, I belive it is a low power data signal wire. you might want to check your paperwork for the USB cable, to make sure the wiring is matched up ok. I don't see any wires going from the yellow to the power stripes, so perhaps there is a short in your breadboard..

February 11, 2011
by meton_magis
meton_magis's Avatar

I tried wiring up the battery again (I used USB because it was less wires, I'm lazy, I thought it was OK, the guide talks about using USB power.)

Still no go. I'm still not sure why there is still 3.3v on the rails with no battery. I start pulling the wires from the MCU to the rails (I used red), and voltage drops, but never reaches 0 (gets down to 0.35 when I pull all red wires and the capacitor.) . Only when I pull out the yellow wire from the USB does voltage ever hit 0 on the red rail.

February 11, 2011
by Ralphxyz
Ralphxyz's Avatar

I have been fighting the voltage on the yellow USB wire using my MAC mini, at the suggestion of Humberto I put a switch on the yellow wire.

Actually I have a double pole switch on the red and yellow wire. The voltage from the yellow wire holds the mcu in a zombie state not allowing programs to run (two black bars in run mode) and other stupid behavior.

My suggestion is to put a double poll switch on the red and yellow USB wires or at the least pull the yellow wire.

Sometimes the USB port gets throughly confused requiring a reboot to restore order.

Ralph

February 11, 2011
by meton_magis
meton_magis's Avatar

You lost me man. How would I wire a switch like that? I thought the yellow wire was needed to send data to the chip. How would I install programs?

I'm new to all this, so I don't yet get all the terms. What's a double poll switch? What parts are electrically connected? (I understand the breadboard, so you don't have to point out line numbers, I just need to know what's connected to what.)

Thanks for your help.

February 11, 2011
by BobaMosfet
BobaMosfet's Avatar

meton-magis-

In USB (not mini), normally the 4 wires are pinned as follows:

PIN    COLOR          PURPOSE
---------------------------------------------------
1      RED            Power (5VDC @ up to 500mV)
2      WHITE/YELLOW   Receive Data (0 to 5VDC pulse)
3      GREEN          Transmit Data (0 to 5VDC pulse)
4      BLACK          Ground

If you're seeing 3.3V on pin 2 (yellow), it is probably because data is being transmitted on that wire (from the cpu to the chip). Since your meter is not an oscilloscope and cannot track those changes and display them fast enough- you see a rough average (with 3.3V being enough to register a positive digital edge) between 0 and 5VDC equaling aprox. 3.3VDC.

If you want to see what is actually happening on pins 2 & 3, so you can eyeball that the computer and chip are talking to one another, I recommend you do this:

Get 2 LEDs (any color), and one 160 Ohm Resistor. Put the Anode of the first LED in the same row that Pin2 (RX) is connected to, and put the Cathode in a row not connected to anything. Put a 160 Ohm resistor from that same row (where the LED cathode is) to the Ground rail. Next put the Anode of the 2nd LED in the same row as Pin3 (TX), and put its cathode also in the same row as the 160 Ohm resistor.

Now, when power is on Pin 2 (transmit to the ATMEGA168), you will see that LED light. When the ATMEGA168 is transmitting back to the computer, you will see the LED on Pin 3 light.

Next whenever you check voltage with your voltage meter, ONLY put the black probe in the ground rail, and the red probe anywhere else. Insert the black probe first, so the meter has a reference, and then the red probe-- always. The connections can be made differently once you are advanced, for different reasons. But for awhile, that's the only way you need ever connect your meter.

Secondly, and this is IMPORTANT- always make sure that you eyeball your meter before you connect it to anything- make this a habit- so that you don't tie into something and fry your meter because you 'thought' it was set up a specific way. Additionally, if it has been several years since you got your meter (or it's a new meter), check the replace the battery in the meter. Lastly, if you are uncertain your meter is correct, have someone else with a known good meter test your meter against there's. I've found even new meters can be bad.

Hope this helps.

BM

February 11, 2011
by BobaMosfet
BobaMosfet's Avatar

meton magis-

My apologies, a slight correction as I noticed after I submitted: mA, not mV:

PIN    COLOR          PURPOSE
---------------------------------------------------
1      RED            Power (5VDC @ up to 500mA)
2      WHITE/YELLOW   Receive Data (0 to 5VDC pulse)
3      GREEN          Transmit Data (0 to 5VDC pulse)
4      BLACK          Ground

BM

February 11, 2011
by mongo
mongo's Avatar

A suggestion: Disconnect the red wire between the USB adapter and the kit. If the adapter is powered from the USB port, let that be the only thing it powers. Use the battery for the rest of the kit and make sure it is only connected to the ground and the input of the 7805.

Once done, double check your voltage on the +5 rails and make sure you have 5 volts. Then turn off the kit, set the program switch and turn it back on. If you get two black bars on the display, you are in program mode.

From there, initiate the programming and see what happens.

February 11, 2011
by Ralphxyz
Ralphxyz's Avatar

eton_magis, re: a double pole switch here.

A double pole switch turns two different wires on and off at the same time, so when I turn my DP switch on I am completing the circuit on the red wire and on the yellow wire. Likewise when I turn it off both wires are disconnected. This is done with just a single switch throw. So you program as if it was wired up directly.

Normally most double pole switches are DPDT (double pole double throw) sometimes ON-OFF-ON but there are ON-ON switches as well. I think if you look at the pictures you will understand how they work or Google DPDT switch.. The second set of poles do not have to connect to anything. You might be able to twist the wires onto the poles but they definitely should be soldered.

The red USB could go to the center pole on the left of the switch the red wire to the + rail on the breadboard would go to the pole at the end on the left. The yellow wire would be wired the same on the right hand side of the switch (left and right is of course relative it does not matter which side or end you use but both wires have to wired the same. You can not have the red wire on the top poles and the yellow wire on the bottom poles.

As far as BobbaMosfet's reply, I love it, I just have to set that up with the LEDs. I just measured my yellow wire and it no longer is putting out voltage. It used to pull the rails high even when not loading programs. So this situation comes and goes which I have reported in the past and Humberto suggested using a switch.

When things have worked once or twice and then stop the first thing is usually a loose wire. Next a weak battery then unplug and replug the USB cable and then reboot. Then if all else fails strip everything off the breadboard and start over.

Also go back to the original initialload program and see if you get the "Welcome" message, you did save it didn't you? If not you can download it again.

Ralph

February 11, 2011
by meton_magis
meton_magis's Avatar

First off, thank you too all you who posted. I got bits from everyone that was helpful.

I removed everything, and only connected what was necessary to load code (removed LCD, extra diodes for diagnostics, everything,) ran everything off a brand new battery, and rebooted my PC. I plugged into my PC, and the battery. The code installed fine (according to my computer, no LCD to test ... yet.) I tried to unplug, let it sit while I got a drink, and plugged it back up. It failed with the same error message. I rebooted my PC, hooked everything back up, and it transferred the program good again.

I think I've isolated the problem to be computer side, not my chips (it COULD still be the usb cable, since it has circuitry in it according to somewhere I read.) I'm going to hook up my LCD now to try running the code, see if it runs good. Next week (I work next 4 days,) I'll try running it from Windows to see if it is a driver issue.

Thanks again to all who helped me,

Paul

February 11, 2011
by meton_magis
meton_magis's Avatar

oh man, I feel like a forum dork now.

http://www.nerdkits.com/forum/thread/68/#post8616

just found and read that thread (got to it in a round about way.)

The error was my PC was trying to send write data too soon after the erase stage (maybe?), and timing out. I split the processes, and added a sleep 1 between, and it loaded 4 times in a row w/o error.

At least now I know it wasn't anything stupid on my part, so I feed OK about it not working. I was about to throw my keyboard across the room too.

Thank you again though for all your help guys.

Just a side note, this kit is great. I was a little hesitant to shell out the 80$ for it, but the documentation, tutorial videos, and forums make it worth it.

February 12, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi meton_magis,

That is very interesting that that solved your issue. We had so far only seen this problem on certain models of Macs, which had led me to believe it was an entirely hardware related issue. Thanks for letting us know adding the delay fixed your issue.

Humberto

February 12, 2011
by meton_magis
meton_magis's Avatar

If it helps, I'm running a core i5 2500k on an intel P67 chipset motherboard (don't remember specific board model, but usb controllers are the same I'd think.)

Fedora 14 64bit, Linux kernel 2.6.35.11-83.fc14.x86_64

I can get specific versions of any applications / libraries you want, but I don't know enough to know which would be useful.

I almost overlooked the fix since it seemed to be solely reported on macs. I figured it wouldn't do any harm to try though, and it ended up working, so lucky me I guess.

February 12, 2011
by Rick_S
Rick_S's Avatar

QUOTE

 In USB (not mini), normally the 4 wires are pinned as follows:

 PIN      COLOR        PURPOSE
 ---------------------------------------------------
 1      RED            Power (5VDC @ up to 500mA)
 2      WHITE/YELLOW   Receive Data (0 to 5VDC pulse)
 3      GREEN          Transmit Data (0 to 5VDC pulse)
 4      BLACK          Ground

Boba,

That isn't 100% accurate. I doubt the USB-Serial adapter supplied with the nerdkit would be considered a high power USB device. Based on the spec, all devices enumerate as a low power device. As such, it would only be supplied 100mA from the USB host, some of which would be used by the device itself and the remainder available for the kit.

This is a quote from the USB 2.0 Spec sheet under section 7.2.1 Classes of Devices

The power source and sink requirements of different device classes can be simplified with the introduction of the concept of a unit load. A unit load is defined to be 100 mA. The number of unit loads a device can draw is an absolute maximum, not an average over time. A device may be either low-power at one unit load or highpower, consuming up to five unit loads. All devices default to low-power. The transition to high-power is under software control. It is the responsibility of software to ensure adequate power is available before allowing devices to consume high-power.

So the USB power is supplied in 100mA steps with all devices defaulting to 100mA unless software kicks the power available up. This can be done in 100mA step up to the max per port of 500mA.

One other thing to keep in mind to those having trouble, plug your cable directly into your computer. If you MUST use a hub, make sure it is a quality powered hub. A non-powered hub takes whatever power is supplied by the USB host (100mA - 500mA), uses some for itself, then distributes the rest across all devices attached. Cheap powered USB hubs are often un-reliable... (I can personally attest to this :D )

Also, I believe the data lines swing to 3.6V. I built a little prank device called a capslocker. It was an attiny45 on a board that plugged directly into the USB port. After I built it, I read where people were having trouble because it was designed with 5v data when the spec calls for 3.6v. The cure was to add a couple of zeners at the data lines to keep the voltage down. I found that without them, the device only worked on maybe 40% of the computers I tried it on. Which was ok for me because it worked on my inteded 'victims' computer.

Rick

Post a Reply

Please log in to post a reply.

Did you know that you can aim and fire a servo-controlled water gun from your computer? Learn more...