ATmega328

8-bit microcontroller


title: "ATmega328" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["atmel-microcontrollers"] description: "8-bit microcontroller" topic_path: "general/atmel-microcontrollers" source: "https://en.wikipedia.org/wiki/ATmega328" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary 8-bit microcontroller ::

::figure[src="https://upload.wikimedia.org/wikipedia/commons/0/0c/ATMEGA328P-PU.jpg" caption="DIP]]-28N)"] ::

::figure[src="https://upload.wikimedia.org/wikipedia/commons/b/ba/ICIC-TQ32-X-K328-01_(16421989932).jpg" caption="ATmega328P in 32-pin thin quad flat pack ([[TQFP]]-32)"] ::

::figure[src="https://upload.wikimedia.org/wikipedia/commons/3/31/ATMEL_MEGA328P_AU_1328.jpg" caption="Die of ATmega328P"] ::

The ATmega328 is a single-chip microcontroller created by Atmel in the megaAVR family (later Microchip Technology acquired Atmel in 2016). It has a modified Harvard architecture 8-bit RISC processor core.

Specifications

The Atmel 8-bit AVR RISC-based microcontroller combines 32 KB ISP flash memory with read-while-write capabilities, 1 KB EEPROM, 2 KB SRAM, 23 general-purpose I/O lines, 32 general-purpose working registers, 3 flexible timer/counters with compare modes, internal and external interrupts, serial programmable USART, a byte-oriented 2-wire serial interface, SPI serial port, 6-channel 10-bit A/D converter (8 channels in TQFP and QFN/MLF packages), programmable watchdog timer with internal oscillator, and 5 software-selectable power-saving modes. The device operates between 1.8 and 5.5 volts. The device achieves throughput approaching 1 MIPS/MHz.

Features

::data[format=table]

ParameterValue
CPU type8-bit AVR
Maximum CPU speed20 MHz
Performance20 MIPS at 20 MHz
Flash memory32 KB
SRAM2 KB
EEPROM1 KB
Package pin count28 or 32
Capacitive touch sensing channels16
Maximum I/O pins23
External interrupts3
USB interfaceNo
::

Family

A common alternative to the ATmega328 is the "picoPower" ATmega328P. A comprehensive list of all other members of the megaAVR series can be found on the Atmel website.

  • ATmega328
  • ATmega328P and ATmega328P-AUTOMOTIVE
  • ATmega328PB and ATmega328PB-AUTOMOTIVE (superset of ATmega328P) - has more UART, I2C, and SPI peripherals than ATmega328P

Applications

ATmega328 is commonly used in many projects and autonomous systems where a simple, low-powered, low-cost micro-controller is needed.

Perhaps the most common implementation of this chip is on the popular Arduino development platform, namely the Arduino Uno, Arduino Pro Mini and Arduino Nano models.

Programming

::figure[src="https://upload.wikimedia.org/wikipedia/commons/f/f0/ATmega328P_28-PDIP_fixed.svg" caption="date=October 2025}} )"] ::

Reliability qualification shows that the projected data retention failure rate is much less than 1 PPM over 20 years at 85 °C or 100 years at 25 °C.{{cite web |title=Atmel 8-bit AVR Microcontrollers ATmega328/P Datasheet Summary |date=June 2016 |accessdate=2016-07-14 |url=http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Summary.pdf |archive-date=2016-07-17 |archive-url=https://web.archive.org/web/20160717044033/http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Summary.pdf |url-status=live

::data[format=table title="Parallel program mode{{cite web |url=https://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061A.pdf |title=Atmel 8-bit AVR Microcontrollers ATmega328/P Datasheet Complete |accessdate=2016-07-14 |archive-date=2018-12-10 |archive-url=https://web.archive.org/web/20181210151102/https://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061A.pdf |url-status=live }}"]

Programming signalPin NameI/OFunction
RDY/BSYPD1OHigh means the MCU is ready for a new command, otherwise busy.
OEPD2IOutput enable (active low)
WRPD3IWrite pulse (active low)
BS1PD4IByte select 1 ("0" = Low byte, "1" = High byte)
XA0PD5IXTAL action bit 0
XA1PD6IXTAL action bit 1
PAGELPD7IProgram memory and EEPROM data page load
BS2PC2IByte select 2 ("0" = low byte, "1" = 2nd high byte)
DATAPC[1:0]:PB[5:0]I/OBi-directional data bus (output when OE is low)
::

Programming mode is entered when PAGEL (PD7), XA1 (PD6), XA0 (PD5), BS1 (PD4) is set to zero. RESET pin to 0 V and VCC to 0 V. VCC is set to 4.5–5.5 V. Wait 60 μs, and RESET is set to 11.5–12.5 V. Wait more than 310 μs. Set XA1:XA0:BS1:DATA = , pulse XTAL1 for at least 150 ns, pulse WR to zero. This starts the chip erase. Wait until RDY/BSY (PD1) goes high. XA1:XA0:BS1:DATA = , XTAL1 pulse, pulse WR to zero. This is the flash write command. And so on.

::data[format=table title="Serial programming"]

SymbolPinsI/ODescription
MOSIPB3ISerial data in
MISOPB4OSerial Data out
SCKPB5ISerial Clock
::

Serial data to the MCU is clocked on the rising edge and data from the MCU is clocked on the falling edge. Power is applied to VCC while RESET and SCK are set to zero. Wait for at least 20 ms and then the programming enable serial instruction 0xAC, 0x53, 0x00, 0x00 is sent to the MOSI pin. The second byte (0x53) will be echoed back by the MCU.

References

References

  1. "ATmega328P".
  2. "megaAVR Microcontrollers". Atmel.
  3. (July 2025). "Arduino - ArduinoBoardProMini".
  4. "Atmel 8-bit AVR Microcontrollers ATmega328/P Datasheet Complete".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

atmel-microcontrollers