Loading a sketch with the pocket AVR programmer

Has anyone been able to load a sketch with the pocket AVR programmer? I am running the Arduino IDE version 1.0.5. I can load the .hex from the Arduino IDE output using avrdude without any problem so I know the .hex is getting created correctly, but whenever I try to load with the Arduino IDE the output window indicates a verification error during the verification phase and the sketch does not load correctly. I created a new board type in the boards.txt file to facilitate using the external programmer. I am programming an ATMEGA328P and I know the hardware and the .hex are correct since they load with avrdude without issue. I would like to use the Arduino IDE instead of WinAVR. Any suggestions would be appreciated.

This is what I currently have loaded in the boards.txt file to try get the Pocket Programmer to work:

usbtiny328.name=[usbtinyisp]ATmega328

usbtiny328.upload.using=usbtinyisp

usbtiny328.upload.maximum_size=32768

usbtiny328.upload.speed=57600

usbtiny328.build.mcu=atmega328p

usbtiny328.build.f_cpu=16000000L

usbtiny328.build.core=arduino

usbtiny328.build.variant=standard

I have tried several different upload speed settings and they made no difference. I also created a “blank” bootloader application and tried putting that in, but that made no difference either. Any input as to why the sketch will not load correctly from the Arduino IDE would be appreciated.

Have you programmed your chip with the arduino bootloader using the avrdude before programming a sketch using the IDE ?

I have programmed the chip with the Arduino Boot loader using the burn boot loader function in the Arduino IDE and had the same issues after attempting to burn a sketch. The chip resides on a basic board that does not use the serial interface so while I can burn the Arduino boot loader from the IDE (it loads without error by the way) I can’t really do anything with that boot loader. While working with the board and the IDE today, at one point I was able to successfully burn 15 sketches in a row. I had made no changes to the configuration, it just started working. And then it stopped working again. I think there is some initialization of the programmer that does not always occur with the IDE, but I cannot figure out where it would be. I have successfully loaded with avrdude everytime I have tried, so I really don’t think there is a bad connection anywhere.

Dont know why Im thinking of this, but im weird like that…

seems to me based on the symptoms described, the periodic ability to load a string of sketches, then the inability, points to something in the serial communication path…whittled down to a weakest link, it would seem to maybe involve a slight environment variable causing this to work a little then not… and if your prototypes physical structure IS NOT a wad of wires barely making contact, or sloppy physical build of circuit, then we can discount those figures and look at something like resistance or capacitance fluctuations of the serial circuit path (ie: solder beads touching materials the unit is laying on or your skin if holding in hand, etc…)

Sometimes, just the static charges in a tabletop or workbench can be enough to swing the functionality of a circuit from good to bad, or vice versa.

So, what im getting to is - - - try pulling up or down very slightly on the serial comms path with a resistor to simulate this hypothesis. May work! Me gut thinks so…and I dont know why…but gut many times knows. :ugeek:

CircuitBurner, I would have tended to agree with you, but I think I have eliminated that possible issue by performing the following test. Without moving anything (and without touching anything other than the keyboard) when the sketch fails to load, I immediately attempt to reload with avrdude from command line using the exact same file and it ALWAYS works. I did some more experimentations last night and I think that you are right in that it is the serial communications, but I think it is a software initialization problem with the Arduino IDE and it’s call to avrdude. When the IDE fails to load the sketch with the programmer, I try to load the same .hex with the avrdude from command line and it works. Next I have disconnected and reconnected the Pocket Programmer to sometimes the same and sometimes different USB ports. Once I get the IDE to load the sketch correctly, it will continue to load sketches correctly as long as I don’t shutdown all of the IDE windows (each sketch is in a different window) or power down the computer. Once I shutdown all the Arduino IDE sketch windows or restart the computer, I essentially have to start all over again until I can get it to work. I think that maybe for some reason the IDE is trying to write before the programmer is initialized and this is causing the problem, but I don’t see any type of parameter that indicates a pause for initialization of the programmer before writing. Of course I could be completely off base. Thanks for the ideas, keep them coming!

in that column of troubleshooting, then figure out a method to delay the IDE for an undetermined interval (5 sec?) (experimental control) to allow any timing conflict of IDE/programmer to cease, and determine any changes in this performance characteristic.

(looks serious, wrinkles forehead)

wait, I reread and caught something here.

1st have you tried this with different setup?

I know that can sometimes be a tall order, but if stuff is available, it would help at least cut our problem in half, just comparing peformances, and looking the right way depending on what half we can toss out.

I’m not sure of a good means to put the delay in, that’s what I’m looking for now. I will try burning the sketch to the Arduino board tonight (as opposed to my developed circuit board) using the PocketAVR to see if that works or if I have the same problem (I suspect I will), but that should at least let me know if it is consistent with the hardware or the IDE.

Okay, so I finally got around to trying to burn the same sketch to the 328P chip on the Arduino board. Same results as when I try to burn it to my own board with the Pocket AVR programmer. If I use avrdude directly, it works every time, but if I try to use the Arduino IDE, it fails pretty much everytime. I am still leaning towards an initialization issue with the programmer from the Arduino IDE, but as of yet I can’t figure out where. If anyone has had success with this please let me know if you had to make any changes to get it to work. Thanks!

There has been quite a time between posts, but I am also seeing something very similar.

I will post my observations in case it proves useful to others.

These observations are made while programming Atmega 328PU chips on the Arduino Uno (R3) board itself.

I also have failures to load programs to the Arduino Uno (R3) board when using the Arduino IDE.

When this happens I am ALWAYS successful if I use the pocket programmer to load programs with Avrdude directly or through the Atmel Studio IDE.

I have also noticed that if I re-load the bootloader on a chip that the Arduino IDE is having trouble with, I can then re-program that chip with the Arduino IDE.

Recently, I have also seen that when the pocket programmer is used to load a program, the Arduino IDE will then fail to write anything to that chip.

Using Avrdude on the command line I do not see any of the fuses being messed with. I never change the fuse settings from the default anyway.

Avrdude queries show no differences in a chip that works with the Arduino IDE and one that does not work.

I also use the Atmel Studio IDE. It also has 100% success in writing to the chips (via a Pocket programmer).

Since they all use Avrdude under the covers, I would expect the same success across all of them. :frowning:

Is it possible that something happens to the chip when using the Pocket programmer that the Arduino IDE is somehow sensitive to?

Summary of some experiments:

I can take one of the “fail to load via Arduino IDE chips” out of the Uno board and immediately install one that “works”. The Arduino IDE will be happy with the new chip.

If I put that same “fail to load via Arduino IDE chip” back into the Uno board, the Arduino IDE will fail to load a program.

I have never observed any “fail to load via Arduino IDE chip” spontaneously start working with the Arduino IDE once they stop working.

I can always load programs to these chips directly with Avrdude or the Atmel Studio IDE.

If I re-burn the boot loader to the"fail to load chip", the Arduino IDE will now load programs to that chip.