Beginner's question about using the ATmega328

Many of you have probably read my recent posts about using an Uno as ISP to program the ATtiny85. I'm just starting out here and am trying to understand various capabilities from a high level.

If I have written working code on my Arduino Uno R3 can I upload that code to an ATmega328 on my breadboard and have a basic duplication of the program without a rewrite? Hook up the correct pins to components and there's my project (I know I'm over-simplifying, but just going for the concept here).

Thanks, Jake

There are only tiny differences between the '328P and the '328.

The main differences I have found have been around the ADC and BOD voltage reference - nothing to worry about unless you're specifically doing things with the 1.1v reference voltage.

As long as the IDE is set to expect a '328 based board, and not a '328P based board, then all should be fine.

majenko:
As long as the IDE is set to expect a '328 based board, and not a '328P based board, then all should be fine.

Is there some way I can verify which 328 based board my IDE is “set to expect?” I have the Arduino Uno R3.

Thanks.

Hmm

Looking at all the 328 entries in the boards.txt file, they are all set up to use the 328p. Given the tiny differences, you're probably safe enough just using any 328p based board entry - like the uno.

Maybe drop back to the "Arduino Duemilanove w/ ATmega328" which is set up to use the older version of the bootloader at a lower speed.

Thanks. I launched the IDE and looked at all of the boards too. It wasn't clear to me which to use.

I think I need to find a simple tutorial of programming the ATmega328 with an Arduino Uno and work through the process at least once. I did a Google search, but most of what I found was dated and one blog said the Uno couldn't be used as ISP for the ATmega328. I think that is out of date?

Could you (or anyone) recommend a beginner level tutorial on programming an ATmega328 with the Uno?

Thanks for your help, it's very much appreciated.

Jake

I have successfully programmed 328P chips using an UNO R2. I haven't tried the 328 chips.

I was going to try this tutorial but it says the Uno cannot be used.

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

not the Arduino Uno (or older Arduino boards w/ an ATmega168).

The tutorial is somewhat out of date.

The original UNO used a 168 chip. From the R2 onwards it has been a 328P. You can do it with any board that has enough resources, so anything that's a 328 or better.

Excellent. Thanks. I’m going to give that tutorial a try.

Regards,
Jake

You can find a workaround regarding 328 vs 328P here:

http://arduino.cc/forum/index.php/topic,98956.0.html

Thank you Erni!

Good stuff here:

http://www.gammon.com.au/forum/?id=11637

I also recently worked through the ATtiny 85 programming and moved on to messing with bare 328's. I assumed that the process would be about the same but I found that programming the 328's was a little more of a PITA.

Since you've worked through the 85 stuff (Congrats! Pretty cool, huh?) you know that once the chip is set up on the breadboard and the IDE is configured you can burn the bootloader AND upload sketches without changing anything. You can't do that with a 328 :~

If you look at the tutorials you'll see 2 boards used for loading sketches. One with a chip and one without. I set my bare chip up on the breadboard as shown and used "Ardinuo as ISP" with "Arduino Duemilanove w/ ATmega328" (I'm using an UNO R3 and bare 328P's from Sparkfun, plus IDE 1.0) to burn the bootloader. No weird errors like the 85's XD and I had a chip with the bootloader installed.

Unfortunately that seems to be as far as you can get without either pulling the chip out of your Arduino or getting a programmer. I don't have a programmer or an FTDI cable so I pulled the chip out of my UNO, hooked it up to the bare chip (Not as many wires as burning the bootloader, just power, reset and TX/RX plus IDE set to "Arduino Duemilanove w/ ATmega328" and programmer "AVR ISP" ) and uploaded some sketches normally.

Having fumbled around pulling IC's out of my Arduino and a breadboard I'd have to recommend a programmer of some sort, or at the very least one of those IC puller tools.

Some programmer options were discussed here:

http://arduino.cc/forum/index.php/topic,112908.0.html

It looks like the Teensy would be the best option but I have no experience with them.

Sorry for the long post and sorry if you already knew this stuff. I'm a noob and some of it wasn't obvious to me.

Hoff,

Thanks for the detailed post! This will be very useful to me.

I ordered the ATmega328 that already has the bootloader burned on it for $1 more, from SparkFun. I figured this time I would skip over the burning the bootloader step.

I'll post back here with my results.

Jake

The Sparkfun text says "ATmega328 with Arduino Optiboot (Uno)", but the pictures of the chips are all 328Ps.

So the discussion re: 328 vs 328P may be a moot point.