Spark Logic

ATmega328 / ATmega328P / ATmega168 / ATmega8 pinout

Package pin assignments for ATmega328, ATmega328P, ATmega168, ATmega8, with peripheral signals, clock grades and a serial programming guide.

TQFP-32 32 contacts
QFN-28 29 contacts
QFN-32 33 contacts

PDIP-28

28 contacts Current package

Microchip Technology · 28 numbered contacts. See the individual package drawings for footprint dimensions.

16 KiB flash · 1 KiB SRAM · 512 B EEPROM · 2.7–5.5 V · 20 MHz maximum · -40 to +85 °C

PDIP-28 pinout

Top view · Pin 1 at the upper left · Schematic outline
Selected pin details

22 · GND

Return · Ground

Supply return. Connect every ground pin.

2545W · Pinout and peripheral signal descriptions

Electrical limits · Link to this pin

All 28 pins

PinSignalDirectionFunction
1PC6 Input / I/OInput / I/O Active-low reset input by default. Use as GPIO only where the reset-disable fuse is supported and configured. Alternate assignments: PCINT14 (EXINT).
2PD0 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: RXD (USART0), PCINT16 (EXINT).
3PD1 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: TXD (USART0), PCINT17 (EXINT).
4PD2 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: PCINT18 (EXINT), INT0 (EXINT).
5PD3 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: OCB (TC2), INT1 (EXINT), PCINT19 (EXINT).
6PD4 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: XCK (USART0), T (TC0), PCINT20 (EXINT).
7VCC SupplySupply Digital supply. Connect every VCC pin and place a local 100 nF ceramic bypass close to each VCC-to-ground pair.
8GND ReturnReturn Supply return. Connect every ground pin.
9PB6 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: TOSC1 (TC2), PCINT6 (EXINT), XTAL1 (CPU).
10PB7 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: TOSC2 (TC2), PCINT7 (EXINT), XTAL2 (CPU).
11PD5 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: T (TC1), OCB (TC0), PCINT21 (EXINT).
12PD6 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: AIN0 (AC), OCA (TC0), PCINT22 (EXINT).
13PD7 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: AIN1 (AC), PCINT23 (EXINT).
14PB0 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ICP (TC1), PCINT0 (EXINT), CLK0 (CPU).
15PB1 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: OCA (TC1), PCINT1 (EXINT).
16PB2 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: OCB (TC1), PCINT2 (EXINT), SS (SPI).
17PB3 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: OCA (TC2), PCINT3 (EXINT), MOSI (SPI).
18PB4 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: PCINT4 (EXINT), MISO (SPI).
19PB5 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: PCINT5 (EXINT), SCK (SPI).
20AVCC SupplySupply Analog supply. Connect it to the supply even if analog conversion is unused. Follow the data sheet’s filtering guidance for precision conversion.
21AREF Analog referenceAnalog reference ADC voltage reference terminal. Check the reference selection before driving this pin from an external voltage.
22GND ReturnReturn Supply return. Connect every ground pin.
23PC0 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ADC0 (ADC), PCINT8 (EXINT).
24PC1 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ADC1 (ADC), PCINT9 (EXINT).
25PC2 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ADC2 (ADC), PCINT10 (EXINT).
26PC3 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ADC3 (ADC), PCINT11 (EXINT).
27PC4 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: SDA (TWI), ADC4 (ADC), PCINT12 (EXINT).
28PC5 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: SCL (TWI), ADC5 (ADC), PCINT13 (EXINT).

Signal assignments

USART0 · Serial

Use TXD and RXD for asynchronous serial. XCK is for synchronous mode. The signal levels follow the microcontroller supply domain. TXD → PD1 · RXD → PD0 · XCK → PD4

TWI / I²C

Connect SDA and SCL to the bus with pull-ups to a voltage supported by all devices. Verify the pull-up value for the bus capacitance and rate. SDA → PC4 · SCL → PC5

Timer/Counter 1

Review each signal assignment and the peripheral enable conditions in the data sheet. T → PD5 · ICP → PB0 · OCA → PB1 · OCB → PB2

Timer/Counter 2

Review each signal assignment and the peripheral enable conditions in the data sheet. OCA → PB3 · OCB → PD3 · TOSC1 → PB6 · TOSC2 → PB7

Analog-to-digital converter

Select the analog channel and reference in firmware. The reference choice and supply constrain the input range. ADC0 → PC0 · ADC1 → PC1 · ADC2 → PC2 · ADC3 → PC3 · ADC4 → PC4 · ADC5 → PC5

Analog comparator

Review each signal assignment and the peripheral enable conditions in the data sheet. AIN0 → PD6 · AIN1 → PD7

Timer/Counter 0

Review each signal assignment and the peripheral enable conditions in the data sheet. T → PD4 · OCB → PD5 · OCA → PD6

External interrupts

Review each signal assignment and the peripheral enable conditions in the data sheet. INT1 → PD3 · PCINT19 → PD3 · PCINT20 → PD4 · PCINT6 → PB6 · PCINT7 → PB7 · PCINT21 → PD5 · PCINT22 → PD6 · PCINT23 → PD7 · PCINT0 → PB0 · PCINT1 → PB1 · PCINT2 → PB2 · PCINT3 → PB3 · PCINT4 → PB4 · PCINT5 → PB5 · PCINT8 → PC0 · PCINT9 → PC1 · PCINT10 → PC2 · PCINT11 → PC3 · PCINT12 → PC4 · PCINT13 → PC5 · PCINT14 → PC6 · PCINT16 → PD0 · PCINT17 → PD1 · PCINT18 → PD2 · INT0 → PD2

SPI peripheral

Use SCK, MOSI, MISO and a chip-select line. Firmware selects direction and clock phase. Check the separate ISP mapping when programming. SS → PB2 · MOSI → PB3 · MISO → PB4 · SCK → PB5

System clock

Review each signal assignment and the peripheral enable conditions in the data sheet. CLK0 → PB0 · XTAL1 → PB6 · XTAL2 → PB7

Electrical limits

ParameterLimitConditions and source
Supply and clock grade2.7–5.5 V · 20 MHz maximum2.7–5.5 V · 20 MHz maximum Follow the speed-grade curve for the selected voltage. The headline clock figure is the maximum at its specified supply and temperature. 2545W · Speed grades and ordering information
Ambient temperature grade-40 to +85 °C-40 to +85 °C For this order code. Verify silicon revision and errata in the current manufacturer documentation. 2545W · Ordering information
Program flash16 KiB16 KiB Nonvolatile program memory. 2545W · Memory
SRAM1 KiB1 KiB Volatile data and stack storage. 2545W · Memory
EEPROM512 B512 B Nonvolatile data storage. 2545W · Memory
Clock and supplyOrder-code dependentOrder-code dependent Use the grade table and the device’s speed-versus-voltage curve. 2545W · Electrical Characteristics

Models and documents

Each package lists the documented order codes and variants covered by this map. Select the marked model to see its peripheral assignments and memory. Check the exact order code and datasheet revision before laying out a PCB.

ATmega328
32 KiB flash · 2 KiB SRAM · 1 KiB EEPROM. Choose the marked order code for voltage, clock, and temperature.
ATmega328-PU
32 KiB flash · 2 KiB SRAM · 1 KiB EEPROM · 1.8–5.5 V · 20 MHz maximum · -40 to +85 °C
ATmega328P
32 KiB flash · 2 KiB SRAM · 1 KiB EEPROM. Choose the marked order code for voltage, clock, and temperature.
ATmega328P-PU
32 KiB flash · 2 KiB SRAM · 1 KiB EEPROM · 1.8–5.5 V · 20 MHz maximum · -40 to +85 °C
ATmega328P-PN
32 KiB flash · 2 KiB SRAM · 1 KiB EEPROM · 1.8–5.5 V · 20 MHz maximum · -40 to +105 °C
ATmega168
16 KiB flash · 1 KiB SRAM · 512 B EEPROM. Choose the marked order code for voltage, clock, and temperature.
ATmega168V-10PU
16 KiB flash · 1 KiB SRAM · 512 B EEPROM · 1.8–5.5 V · 10 MHz maximum · -40 to +85 °C
ATmega168-20PU
16 KiB flash · 1 KiB SRAM · 512 B EEPROM · 2.7–5.5 V · 20 MHz maximum · -40 to +85 °C
ATmega8
8 KiB flash · 1 KiB SRAM · 512 B EEPROM. Choose the marked order code for voltage, clock, and temperature.
ATmega8L-8PU
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 2.7–5.5 V · 8 MHz maximum · -40 to +85 °C
ATmega8-16PU
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 4.5–5.5 V · 16 MHz maximum · -40 to +85 °C
ATmega8L-8PN
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 2.7–5.5 V · 8 MHz maximum · -40 to +105 °C
ATmega8-16PN
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 4.5–5.5 V · 16 MHz maximum · -40 to +105 °C