Unsuccessful upload of application to uno r3

I have a new uno r3. Earlier today I did a successful upload of an application to the uno r3 and it worked correctly. I have some spare atmega328s so I swapped a spare into the uno r3. I did an upload and the ide indicated a successful upload. However, the application does not work. So it is not so simple to program a new chip. Does the boot loader have to be installed before an application can be uploaded? What am I missing?

Thanks,

Roger

Yes, in order to upload using the USB (serial) port the 328 must have the bootloader installed.

db68:
I swapped a spare into the UNO r3. I did an upload and the IDE indicated a successful upload. However, the application does not work. So it is not so simple to program a new chip. Does the boot loader have to be installed before an application can be uploaded? What am I missing?

Yes, of course the boot loader has to be installed before an application can be uploaded, but if the IDE indicated a successful upload, clearly the bootloader is installed and functional.

Something else is wrong, but I cannot put my finger on it.

Show us your code?

db68:
Does the boot loader have to be installed before an application can be uploaded? What am I missing?

IMO this would be a good time to reinstall the original chip, turn on verbose logging for uploads, upload ‘blink’ (and confirm it runs OK), do the same with your other chip and compare the upload logs.

Could it be a fuse issue? The fuses would usually be set when the bootloader was installed and since you have (presumably) got a bootloader I’d expect the fuses to have been set correctly too - but if they haven’t, I wonder whether that might cause problems.

I turned on the verbose mode and tried another upload of myblinky. I now believe there is probably a communications error. Here is what I believe is an error indication.

avrdude: stk500_get sync(); not in sync: resp=0x00

So it would seem there is no boot loader on the chip. These spare chips I have are new ones from Newark electronics. I guess the factory does not install a boot loader before shipping.

The Atmel stuff is new to me and I am a bit confused about how to flash them. I have seen on youtube what appears to be two different ways to flash them and one method does not seem to require a bootloader. But maybe I don't completely understand the video. They have the chip on a breadboard and are making connections directly from the programmer to the chip. They are using something similar to this:

http://www.ebay.com/itm/USBasp-USBISP-AVR-10-Pin-USB-Programmer-3-3V-5V-ATMEGA8-ATMEGA128-w-Ribbon-Cable-/121215646853?pt=LH_DefaultDomain_0&hash=item1c3903fc85

If someone could answer this question maybe this would clear up some confusion for me.
Is there any method of flashing an application without flashing the bootloader first?

Thanks,
Roger

You can use the ICSP interface to upload the sketch, upload the bootloader, set the fuses and so on. This neads a programmer capable of uploading via ISP. There is an ArduinoISP sketch that enables you to use an Arduino as a suitable programmer - there is some work to do to get this working, but it's a well-known approach and the steps needed are well documented.

I have the programmer shown in the link above. The specs on it say it is an ICSP Atmega328 compatable programmer. It seems it would do the job with the correct connections made to the chip.

Am I correct?

Thanks,
Roger

If it's compatible with the controller you're using and you connect it correctly then yes, it would be sufficient to install the bootloader and/or set the fuses and/or upload a sketch. I'm sure you will find lots of tutorials explaining how to install the bootloader, because it's something that people would want to do routinely since blank chips are cheaper than ones with the bootloader installed.