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 Current package
PDIP-28 28 contacts

Microchip Technology · 32 numbered contacts. The underside pad appears below the contact map. See the individual package drawings for footprint dimensions.

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

QFN-32 pinout

Top view · Pin 1 at the upper left · Schematic outline
EP is the exposed center pad on the underside.
Selected pin details

3 · GND

Return · Ground

Supply return. Connect every ground pin.

2486AA · Pinout and peripheral signal descriptions

Electrical limits · Link to this pin

All 33 pins

PinSignalDirectionFunction
1PD3 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: INT1 (EXINT).
2PD4 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: T (TC0), XCK (USART).
3GND ReturnReturn Supply return. Connect every ground pin.
4VCC SupplySupply Digital supply. Connect every VCC pin and place a local 100 nF ceramic bypass close to each VCC-to-ground pair.
5GND ReturnReturn Supply return. Connect every ground pin.
6VCC SupplySupply Digital supply. Connect every VCC pin and place a local 100 nF ceramic bypass close to each VCC-to-ground pair.
7PB6 BidirectionalBidirectional General-purpose digital I/O.
8PB7 BidirectionalBidirectional General-purpose digital I/O.
9PD5 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: T (TC1).
10PD6 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: AIN0 (AC).
11PD7 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: AIN1 (AC).
12PB0 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ICP (TC1).
13PB1 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: OCA (TC1).
14PB2 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: SS (SPI), OCB (TC1).
15PB3 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: MOSI (SPI), OC (TC2).
16PB4 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: MISO (SPI).
17PB5 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: SCK (SPI).
18AVCC SupplySupply Analog supply. Connect it to the supply even if analog conversion is unused. Follow the data sheet’s filtering guidance for precision conversion.
19ADC6 Analog inputAnalog input Dedicated analog input to ADC channel 6. Alternate assignments: ADC6 (ADC).
20AREF Analog referenceAnalog reference ADC voltage reference terminal. Check the reference selection before driving this pin from an external voltage.
21GND ReturnReturn Supply return. Connect every ground pin.
22ADC7 Analog inputAnalog input Dedicated analog input to ADC channel 7. Alternate assignments: ADC7 (ADC).
23PC0 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ADC0 (ADC).
24PC1 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ADC1 (ADC).
25PC2 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ADC2 (ADC).
26PC3 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: ADC3 (ADC).
27PC4 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: SDA (TWI), ADC4 (ADC).
28PC5 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: SCL (TWI), ADC5 (ADC).
29PC6 Input / I/OInput / I/O Active-low reset input by default. Use as GPIO only where the reset-disable fuse is supported and configured.
30PD0 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: RXD (USART).
31PD1 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: TXD (USART).
32PD2 BidirectionalBidirectional General-purpose digital I/O. Alternate assignments: INT0 (EXINT).
EPEP Ground padGround pad Solder the exposed center pad to ground as shown in the package pinout notes. Connect the numbered ground contacts too.

Signal assignments

Analog comparator

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

SPI peripheral

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

External interrupts

Review each signal assignment and the peripheral enable conditions in the data sheet. INT1 → PD3 · INT0 → PD2

Timer/Counter 0

Review each signal assignment and the peripheral enable conditions in the data sheet. T → PD4

Timer/Counter 1

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

Timer/Counter 2

Review each signal assignment and the peripheral enable conditions in the data sheet. OC → PB3

USART · Serial

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

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. SCL → PC5 · SDA → PC4

Analog-to-digital converter

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

Electrical limits

ParameterLimitConditions and source
Supply and clock grade4.5–5.5 V · 16 MHz maximum4.5–5.5 V · 16 MHz maximum Follow the speed-grade curve for the selected voltage. The headline clock figure is the maximum at its specified supply and temperature. 2486AA · 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. 2486AA · Ordering information
Program flash8 KiB8 KiB Nonvolatile program memory. 2486AA · Memory
SRAM1 KiB1 KiB Volatile data and stack storage. 2486AA · Memory
EEPROM512 B512 B Nonvolatile data storage. 2486AA · Memory
Clock and supplyOrder-code dependentOrder-code dependent Use the grade table and the device’s speed-versus-voltage curve. 2486AA · 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-MU
32 KiB flash · 2 KiB SRAM · 1 KiB EEPROM · 1.8–5.5 V · 20 MHz maximum · -40 to +85 °C
ATmega328-MUR
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-MU
32 KiB flash · 2 KiB SRAM · 1 KiB EEPROM · 1.8–5.5 V · 20 MHz maximum · -40 to +85 °C
ATmega328P-MUR
32 KiB flash · 2 KiB SRAM · 1 KiB EEPROM · 1.8–5.5 V · 20 MHz maximum · -40 to +85 °C
ATmega328P-MN
32 KiB flash · 2 KiB SRAM · 1 KiB EEPROM · 1.8–5.5 V · 20 MHz maximum · -40 to +105 °C
ATmega328P-MNR
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-10MU
16 KiB flash · 1 KiB SRAM · 512 B EEPROM · 1.8–5.5 V · 10 MHz maximum · -40 to +85 °C
ATmega168V-10MUR
16 KiB flash · 1 KiB SRAM · 512 B EEPROM · 1.8–5.5 V · 10 MHz maximum · -40 to +85 °C
ATmega168-20MU
16 KiB flash · 1 KiB SRAM · 512 B EEPROM · 2.7–5.5 V · 20 MHz maximum · -40 to +85 °C
ATmega168-20MUR
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-8MU
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 2.7–5.5 V · 8 MHz maximum · -40 to +85 °C
ATmega8L-8MUR
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 2.7–5.5 V · 8 MHz maximum · -40 to +85 °C
ATmega8-16MU
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 4.5–5.5 V · 16 MHz maximum · -40 to +85 °C
ATmega8-16MUR
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 4.5–5.5 V · 16 MHz maximum · -40 to +85 °C
ATmega8L-8MN
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 2.7–5.5 V · 8 MHz maximum · -40 to +105 °C
ATmega8-16MN
8 KiB flash · 1 KiB SRAM · 512 B EEPROM · 4.5–5.5 V · 16 MHz maximum · -40 to +105 °C