SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By sting
#139453
I bought a pair of the AVR 28 Pin 20MHz 32K 6A/D - ATMega328 processors, not really paying attention to the fact that they were 20Mhz, more is better, right? Well, once I realized they are not supported arduino processors, I have been attempting to use them with 16MHZ crystals. I thought this should work, and I could use an arduino in Arduino as ISP. I have checked the voltage on the processor and that seems correct.

All I can get is the message: avrdude: stk500_getsync(): not in sync: resp=0x00 and no diagnostic.

I have tried with 16MHz crystal and with a 16MHz ceramic resonator and I always get the same result.

Is there a way to find out what is going wrong?

Or am I wasting my time and should just go and buy the 16MHz processor?
By trialex
#139474
Or am I wasting my time and should just go and buy the 16MHz processor?
It's the same processor - the 20MHz is just the MAX speed.

I think you need to give a bit more info on what you are doing and/or what's not working. Have you burned the (correct) arduino bootloader onto the chips that you bought?
By stevech
#139475
sting wrote:I bought a pair of the AVR 28 Pin 20MHz 32K 6A/D -

Or am I wasting my time and should just go and buy the 16MHz processor?
The Arduino bootloader code assumes a certain crystal or resonator frequency is in use. If the one on the board differs, you'll see the error.
The issue is not the speed of the microprocessor, but rather its the compatibility of the crystal frequency. The 20MHz chip can operate with any crystal/resonator up to 20MHz; likewise the 16MHz chip.

So you can either change the crystal to match what the installed bootloader expects, or vice-versa, change the bootloader. For the latter, you'll need someone with an "ISP" programmer to recompile the bootloader and "flash" it into the chip. Or perhaps you can find on line an Arduino bootloader for your combination.
By sting
#139481
stevech wrote: you can either change the crystal to match what the installed bootloader expects
the process does not have a bootloader, I am trying to upload it.

I have this exact setup on my breadboard.
Image

from http://arduino.cc/en/Tutorial/ArduinoToBreadboard

I have followed the instructions. I thought the processor should be ale to work, but it doesn't. I am looking for a way to get a feeling for what isn't working right.
By kf2qd
#139866
Try 120 Ohms from Reset to +5V on your Arduino Board.

Also - which version of the ArduinoIDE did you use to load the ArduinoISP Sketch? Use Arduino-0.22 as 1.0 has an issue at 19200.

Also - you may need to use AVRDude from the command line as as the command string to AVRDude needs a slight modification. Once they have the bootloader they can be used in the arduino board without a problem. I would hook up a 16MHZ crystal for programming and initial testing.
By Xykon
#140245
Hello,

I think I'm in the same boat as you are as I also bought some 328 without the P at the end. I changed the signature in avrdude for the 328P so now it accepts talking to the chip. I have it breadboarded as well and I'm trying with 8MHz,16MHz and 20MHz crystals.

When I try to burn the bootloaders ATmegaBOOT_168_atmega328.hex or ATmegaBOOT_168_atmega328_pro_8MHz.hex (with 20/16/8MHz crystal) I get verification erros while reading.
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x7a00 0xc0 != 0x80
avrdude: verification error; content mismatch
The optiboot bootloader seems to install OK but I can't get a serial connection to the chip after that (same error as original poster).

The strangest part is that at one point I got the ATmegaBOOT_168_atmega328.hex bootloader to program without error and I could even run the basic blink example but then I suddenly lost the serial connection and I'm back to the same behavior as before.

I tried to find out what the difference is between the 328 and the 328P but couldn't find anything. Does anyone have an idea what might be different between the two chips? Since I only bought three of them the loss isn't that big but I'd have to make another 80€+ order at mouser to get free delivery again...
By Xykon
#140272
Well I got a bit further last night... Instead of using Sparkfun's AVR pocket programmer I used the SF Buspirate and the chip programmed OK with the ATmegaBOOT_168_atmega328.hex bootloader and I got serial access to the chip.
However as soon as I upload a sketch the bootloader seems to get overwritten... it might be simply a difference of where the bootloader is placed in flash memory between the two chips. I haven't used arduino before (I've been using GHI's .net modules mostly) but I think it's "only" a matter of fuses and lockbits which have to be set differently on these two chips. Maybe the normal 328 places the bootloader at the start of the flash chip and the 328P puts it at the end and that's why it gets overwrittent once I upload something via serial cable... In that case I guess I have to "reverse" the lfuse and hfuse and maybe also the lockbit?

I'm wondering if anyone else has haver been working on this... since there doesn't seem to be any "official" support for the 328 in avrdude and also the compiler doesn't work unless I pretend it's the 328P.