# Programming a ATmega328

**URL:** <https://community.sparkfun.com/t/programming-a-atmega328/20480>\
**Category:** MicroMod\
**Tags:** avr-atmel\
**Created:** [April 27, 2011, 11:34pm UTC](https://community.sparkfun.com/t/programming-a-atmega328/20480 "2011-04-27T23:34:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![yetanothername](https://avatars.discourse-cdn.com/v4/letter/y/f4b2a3/32.png) [@yetanothername](https://community.sparkfun.com/u/yetanothername)\
**Post date:** [April 27, 2011, 11:34pm UTC](https://community.sparkfun.com/t/programming-a-atmega328/20480/1 "2011-04-27T23:34:49Z")

</div>

When I bought the components for my board, I mistakenly bought an ATmega328 instead of an ATmega328p. From what I can tell these two processors otherwise identical except the \*p version is a low power one (and the one that’s used in the Arduino). However, I can’t find support for the non \*p version in any tool I’ve come across except for a beta version of AVR Studio 5. AVR Studio 4 and avrdude only have support for the p version. AVR Studio 5’s support for the 328 seems half-baked and it doesn’t work with my programmer (The Pocket AVR Programmer).

Does anybody know the correct combination of hardware/tools/drivers/software that will enable me to program the ATmega328. At this point I don’t really care what language it’s in, I just want to get this thing to work ☹

Thanks.

PS: I’m on Windows 7 x64.

PPS: I also ordered a 5V blue-on-white LED screen from SparkFun, and the bottom row’s backlight is a cooler white than the top row. Is it supposed to be like this or did I get defective unit?

---

<div class="post-metadata">

**Author:** ![leon\_heller](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/leon_heller/32/7602_2.png) [@leon\_heller](https://community.sparkfun.com/u/leon_heller)\
**Post date:** [April 28, 2011, 2:05am UTC](https://community.sparkfun.com/t/programming-a-atmega328/20480/2 "2011-04-28T02:05:50Z")

</div>

Both the 328 and the 328P are supported by AVR Studio 4!

---

<div class="post-metadata">

**Author:** ![yetanothername](https://avatars.discourse-cdn.com/v4/letter/y/f4b2a3/32.png) [@yetanothername](https://community.sparkfun.com/u/yetanothername)\
**Post date:** [April 28, 2011, 2:22am UTC](https://community.sparkfun.com/t/programming-a-atmega328/20480/3 "2011-04-28T02:22:33Z")

</div>

I can’t seem to find the 328 in this list of supported devices:

![](https://canada1.discourse-cdn.com/sparkfun/original/2X/a/a8675d344704cee8cc1a9263fb39e6174ec20032.png)[http://i.imgur.com/9TtE1.png](https://community.sparkfun.com/uploads/short-url/o1LFDrW4udloPETSVW33swjNw2e.png)

Edit: I’d settle for using avrdude but it has a section for only the 328p and not the 328. I can force avrdude (using -F) to program my board pretending to be a 328p but when I upload a .hex file I made using the Arduino IDE, it’s successful in programming the device but nothing happens. So I don’t know if it’s silently failing while pretending to be OK or if my code’s wrong.

---

<div class="post-metadata">

**Author:** ![leon\_heller](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/leon_heller/32/7602_2.png) [@leon\_heller](https://community.sparkfun.com/u/leon_heller)\
**Post date:** [April 28, 2011, 2:38am UTC](https://community.sparkfun.com/t/programming-a-atmega328/20480/4 "2011-04-28T02:38:21Z")

</div>

You have the simulator selected, they are the same device as far as that is concerned. Try selecting the Dragon.

---

<div class="post-metadata">

**Author:** ![yetanothername](https://avatars.discourse-cdn.com/v4/letter/y/f4b2a3/32.png) [@yetanothername](https://community.sparkfun.com/u/yetanothername)\
**Post date:** [April 28, 2011, 3:59am UTC](https://community.sparkfun.com/t/programming-a-atmega328/20480/5 "2011-04-28T03:59:57Z")

</div>

The 328 is also missing from the Dragon’s listing, and this one:

 ![](https://canada1.discourse-cdn.com/sparkfun/original/2X/6/6dacda3522c92c3c1ca16adf5e4e65e04247c73a.png)[http://i.imgur.com/FtDDT.png](https://community.sparkfun.com/uploads/short-url/fEenu23HlgnpWjd3m4QgZSaeq8O.png)

However when I hit “Read Signature”, it reads the correct signature for a 328, “0x1E9514” I followed [[some instructions](http://arduino.cc/forum/index.php?topic=58670.0) to trick avrdude into thinking that a P is a non-P and it doesn’t error out at all.

Like I said before, I honestly don’t know if it’s the programmer or my code. Tomorrow I’m going to hock up an oscilloscope to some pins to see what’s going on.]([Arduino Forum](http://arduino.cc/forum/index.php?topic=58670.0))

---

<div class="post-metadata">

**Author:** ![leon\_heller](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/leon_heller/32/7602_2.png) [@leon\_heller](https://community.sparkfun.com/u/leon_heller)\
**Post date:** [April 28, 2011, 7:48am UTC](https://community.sparkfun.com/t/programming-a-atmega328/20480/6 "2011-04-28T07:48:38Z")

</div>

Both are present with my version of AVR Studio. You seem to be using an old version.

I’d dump that programmer and get a proper Atmel one. It might cost a bit more, but you’ll have fewer problems.

---

<div class="post-metadata">

**Author:** ![yetanothername](https://avatars.discourse-cdn.com/v4/letter/y/f4b2a3/32.png) [@yetanothername](https://community.sparkfun.com/u/yetanothername)\
**Post date:** [April 28, 2011, 6:21pm UTC](https://community.sparkfun.com/t/programming-a-atmega328/20480/7 "2011-04-28T18:21:02Z")

</div>

Thanks. I was using the RTM version of AVR Studio 4 and when I installed SP3, ATmega328 showed up. So that’s one less kludge I have to use. Now onto why my code isn’t doing anything. Onto the oscilloscope!

Edit: After soldering on some LED’s, my toolchain works! Thanks leon\_heller! Now onto why my display isn’t working.

---

<div class="post-metadata">

**Author:** ![MrPerfectionest](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@MrPerfectionest](https://community.sparkfun.com/u/MrPerfectionest)\
**Post date:** [April 29, 2011, 10:54pm UTC](https://community.sparkfun.com/t/programming-a-atmega328/20480/8 "2011-04-29T22:54:02Z")

</div>

Not to thread hijack but my question is related. Is there a platform that ISN’T arduino that I can program over usb AND be able to use the same connection as a com port to send data back over rs232 from the device? I realize this is all built right into arduino (well, via the bootloader setup) and I may end up just getting one but I already have an STK500 from many years ago and I’d rather just connect up to the ISP header or have the flexibility to program and communicate outside of the arduino platform.

I looked around but nothing jumped out at me immediately as a tool that can do both.
