component
ATmega328P
Public Unreviewedby adom
Microchip 8-bit AVR MCU, 28-pin DIP. 32 KB flash, 2 KB SRAM, 20 MHz, the Arduino Uno chip. Datasheet-verified.
← Commit history
Publish 0.1.0
8 files changed
+1109−285
README.md+63−278@@ -1,290 +1,75 @@-**Source:** [Microchip / Atmel Datasheet (DS40002061B)](https://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061B.pdf)-**Manufacturer:** Microchip (formerly Atmel)-**Part Number:** ATmega328P-**Document:** DS40002061B — 2020 (megaAVR, part of ATmega48A/PA/88A/PA/168A/PA/328/P family datasheet)-**Architecture:** 8-bit AVR RISC--## Description--The ATmega328P is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, it achieves throughputs approaching 1 MIPS per MHz, allowing the system designer to optimize power consumption versus processing speed. The ATmega328P combines 32 KB of ISP flash with read-while-write capabilities, 1 KB EEPROM, 2 KB SRAM, 23 general-purpose I/O lines, 32 general-purpose working registers, three flexible timer/counters with compare modes, internal and external interrupts, a serial programmable USART, a byte-oriented 2-wire serial interface, an SPI serial port, a 6-channel 10-bit ADC (8 channels in TQFP and QFN/MLF packages), a programmable watchdog timer with internal oscillator, and five software-selectable power-saving modes. This part is the microcontroller at the heart of the Arduino Uno / Nano / Pro Mini.--## Key Specifications+# ATmega328P++**Microchip Technology** · 8-bit AVR MCU · PDIP-28++The 8-bit AVR microcontroller at the heart of the Arduino Uno, here in its classic 28-pin DIP. It packs 32 KB of self-programming flash, 2 KB SRAM, and 1 KB EEPROM, and runs the AVR RISC core at up to 20 MHz from 1.8 to 5.5 V. The 28-pin package brings out 23 GPIO across three ports, a 6-channel 10-bit ADC, three timer/counters with PWM, and hardware USART, SPI, and I2C (TWI). A ceramic resonator or crystal on XTAL1/XTAL2 sets the clock, or the internal 8 MHz RC oscillator frees both pins. Datasheet-verified 28-pin pinout.++## Pinout++| Pin | Name | Type | Function |+|---|---|---|---|+| 1 | PC6/RESET/PCINT14 | bidirectional | Active-low reset input (when RSTDISBL fuse is unprogrammed); a low pulse longer than the minimum length generates a reset even without clock. If RSTDISBL is programmed, functions as PC6 GPIO (different electrical characteristics than other PC pins). Also PCINT14 pin-change interrupt source. |+| 2 | PD0/RXD/PCINT16 | bidirectional | Port D bit 0. Alternate functions: RXD (USART receive input), PCINT16 pin-change interrupt. |+| 3 | PD1/TXD/PCINT17 | bidirectional | Port D bit 1. Alternate functions: TXD (USART transmit output), PCINT17 pin-change interrupt. |+| 4 | PD2/INT0/PCINT18 | bidirectional | Port D bit 2. Alternate functions: INT0 external interrupt, PCINT18 pin-change interrupt. |+| 5 | PD3/INT1/OC2B/PCINT19 | bidirectional | Port D bit 3. Alternate functions: INT1 external interrupt, OC2B (Timer/Counter2 compare output B / PWM), PCINT19 pin-change interrupt. |+| 6 | PD4/T0/XCK/PCINT20 | bidirectional | Port D bit 4. Alternate functions: T0 (Timer/Counter0 external counter input), XCK (USART external clock), PCINT20 pin-change interrupt. |+| 7 | VCC | power_in | Digital supply voltage. Operating range 1.8V-5.5V (speed-grade dependent: 20MHz requires 4.5-5.5V, 10MHz at 2.7V, 4MHz at 1.8V). |+| 8 | GND | power_in | Ground reference. Tie together with pin 22 GND and the AVCC ground return. |+| 9 | PB6/XTAL1/TOSC1/PCINT6 | bidirectional | Port B bit 6. Alternate functions: XTAL1 (input to inverting oscillator amplifier for external crystal/resonator), TOSC1 (Timer/Counter2 asynchronous oscillator input when AS2 in ASSR is set and internal RC oscillator selected), PCINT6 pin-change interrupt. |+| 10 | PB7/XTAL2/TOSC2/PCINT7 | bidirectional | Port B bit 7. Alternate functions: XTAL2 (output from inverting oscillator amplifier), TOSC2 (Timer/Counter2 asynchronous oscillator output), PCINT7 pin-change interrupt. |+| 11 | PD5/T1/OC0B/PCINT21 | bidirectional | Port D bit 5. Alternate functions: T1 (Timer/Counter1 external counter input), OC0B (Timer/Counter0 compare output B / PWM), PCINT21 pin-change interrupt. |+| 12 | PD6/AIN0/OC0A/PCINT22 | bidirectional | Port D bit 6. Alternate functions: AIN0 (analog comparator positive input), OC0A (Timer/Counter0 compare output A / PWM), PCINT22 pin-change interrupt. |+| 13 | PD7/AIN1/PCINT23 | bidirectional | Port D bit 7. Alternate functions: AIN1 (analog comparator negative input), PCINT23 pin-change interrupt. |+| 14 | PB0/ICP1/CLKO/PCINT0 | bidirectional | Port B bit 0. Alternate functions: ICP1 (Timer/Counter1 input capture), CLKO (divided system clock output when CKOUT fuse is programmed), PCINT0 pin-change interrupt. |+| 15 | PB1/OC1A/PCINT1 | bidirectional | Port B bit 1. Alternate functions: OC1A (Timer/Counter1 compare output A / PWM), PCINT1 pin-change interrupt. |+| 16 | PB2/SS/OC1B/PCINT2 | bidirectional | Port B bit 2. Alternate functions: SS (SPI slave-select input; also controls SPI master/slave mode via DDRB), OC1B (Timer/Counter1 compare output B / PWM), PCINT2 pin-change interrupt. |+| 17 | PB3/MOSI/OC2A/PCINT3 | bidirectional | Port B bit 3. Alternate functions: MOSI (SPI master-out/slave-in data), OC2A (Timer/Counter2 compare output A / PWM), PCINT3 pin-change interrupt. Also used for ISP programming (data in). |+| 18 | PB4/MISO/PCINT4 | bidirectional | Port B bit 4. Alternate functions: MISO (SPI master-in/slave-out data), PCINT4 pin-change interrupt. Also used for ISP programming (data out). |+| 19 | PB5/SCK/PCINT5 | bidirectional | Port B bit 5. Alternate functions: SCK (SPI bus clock), PCINT5 pin-change interrupt. Also used for ISP programming (clock). |+| 20 | AVCC | power_in | Analog supply voltage for the A/D converter, Port C (PC3:0) and (in TQFP/VQFN) ADC7:6. Must be externally connected to VCC even if the ADC is unused; if the ADC is used, connect through an LC low-pass filter for noise isolation. |+| 21 | AREF | passive | Analog reference input for the A/D converter. Bypass with a decoupling capacitor to GND; may be driven externally or internally selected via ADMUX (AVCC or 1.1V internal bandgap). |+| 22 | GND | power_in | Analog ground return (shared with digital GND). Tie to pin 8 GND. |+| 23 | PC0/ADC0/PCINT8 | bidirectional | Port C bit 0. Alternate functions: ADC0 (analog input channel 0, 10-bit), PCINT8 pin-change interrupt. |+| 24 | PC1/ADC1/PCINT9 | bidirectional | Port C bit 1. Alternate functions: ADC1 (analog input channel 1, 10-bit), PCINT9 pin-change interrupt. |+| 25 | PC2/ADC2/PCINT10 | bidirectional | Port C bit 2. Alternate functions: ADC2 (analog input channel 2, 10-bit), PCINT10 pin-change interrupt. |+| 26 | PC3/ADC3/PCINT11 | bidirectional | Port C bit 3. Alternate functions: ADC3 (analog input channel 3, 10-bit), PCINT11 pin-change interrupt. |+| 27 | PC4/ADC4/SDA/PCINT12 | bidirectional | Port C bit 4. Alternate functions: ADC4 (analog input channel 4, 10-bit), SDA (TWI/I2C data line), PCINT12 pin-change interrupt. |+| 28 | PC5/ADC5/SCL/PCINT13 | bidirectional | Port C bit 5. Alternate functions: ADC5 (analog input channel 5, 10-bit), SCL (TWI/I2C clock line), PCINT13 pin-change interrupt. |++## Key specifications | Parameter | Value |-| --- | --- |-| Architecture | 8-bit AVR RISC |-| Flash Memory | 32 KB (ISP, read-while-write) |+|---|---|+| Core | 8-bit AVR RISC |+| Flash | 32 KB (self-programming) | | SRAM | 2 KB | | EEPROM | 1 KB |-| Operating Voltage | 1.8 V – 5.5 V |-| Max Clock | 20 MHz @ 4.5 V – 5.5 V |-| Max MIPS | 20 MIPS @ 20 MHz |-| Digital I/O Lines | 23 |-| ADC | 10-bit, 8-channel (TQFP/VQFN), 6-channel (SPDIP) |-| Timers | 2 × 8-bit + 1 × 16-bit, PWM channels ×6 |-| Serial Interfaces | USART, SPI, 2-wire (I²C-compatible) |-| Interrupt Sources | 26 |-| Temperature Range | −40 °C to 85 °C (industrial); −40 °C to 105 °C (extended) |-| Packages | 28-pin PDIP, 32-pin TQFP, 28-pad VQFN, 32-pad VQFN |-| Active Current @ 8 MHz, 5 V | 5.2 mA typ |-| Power-down Current @ 3 V | 0.1 µA typ |--## Features--- High-performance, low-power AVR 8-bit microcontroller-- Advanced RISC architecture — 131 instructions, mostly single-cycle execution, 32 × 8 general-purpose working registers, fully static operation, up to 20 MIPS throughput at 20 MHz, on-chip 2-cycle multiplier-- High-endurance non-volatile memory — 32 KB in-system self-programmable flash, 1 KB EEPROM, 2 KB internal SRAM; 10 000 flash / 100 000 EEPROM write-erase cycles; 20-year data retention at 85 °C / 100 years at 25 °C-- Optional boot-loader section with independent lock bits; in-system programming via the on-chip boot program; true read-while-write operation-- Programming lock for software security-- QTouch library support: capacitive touch buttons, sliders and wheels; up to 64 sense channels-- Peripheral features — Two 8-bit timer/counters and one 16-bit timer/counter with separate prescaler, compare & capture modes; real-time counter with separate oscillator; six PWM channels; 10-bit 6-channel ADC (SPDIP) or 8-channel ADC (TQFP/QFN) with optional temperature measurement; programmable serial USART; master/slave SPI; byte-oriented 2-wire serial (Philips I²C compatible); programmable watchdog timer with separate on-chip oscillator; on-chip analog comparator; interrupt & wake-up on pin change-- Special microcontroller features — Power-on reset and programmable brown-out detection; internal calibrated RC oscillator; external and internal interrupt sources; six sleep modes: Idle, ADC noise reduction, Power-save, Power-down, Standby, Extended Standby-- I/O and packages — 23 programmable I/O lines; 28-pin SPDIP, 32-lead TQFP, 28-pad VQFN, 32-pad VQFN-- Operating voltage: 1.8 V – 5.5 V-- Temperature range: −40 °C to 85 °C (industrial), extended to −40 °C to 105 °C on select orderable codes-- Speed grades: 0 – 4 MHz @ 1.8 – 5.5 V, 0 – 10 MHz @ 2.7 – 5.5 V, 0 – 20 MHz @ 4.5 – 5.5 V-- Ultra-low power: 0.2 mA active @ 1 MHz / 1.8 V / 25 °C; 0.1 µA power-down; 0.75 µA power-save (32 kHz RTC on)--## Pin Configuration--Pinout shown for the 28-pin SPDIP / 28-pad VQFN package. The 32-pin TQFP / VQFN adds two extra ADC channels (ADC6, ADC7) and separate AVCC / AGND pins.--| Pin | Name | Type | Description |-| --- | --- | --- | --- |-| 1 | PC6 / RESET | I/O / Reset | Port C bit 6 when RSTDISBL fuse is programmed; otherwise active-low reset. Also PCINT14. |-| 2 | PD0 | I/O | Port D bit 0. RXD (USART input), PCINT16. |-| 3 | PD1 | I/O | Port D bit 1. TXD (USART output), PCINT17. |-| 4 | PD2 | I/O | Port D bit 2. INT0 external interrupt, PCINT18. |-| 5 | PD3 | I/O | Port D bit 3. INT1, OC2B PWM, PCINT19. |-| 6 | PD4 | I/O | Port D bit 4. XCK (USART clock) / T0 (Timer0 ext. clock), PCINT20. |-| 7 | VCC | Power | Digital supply voltage (1.8 V – 5.5 V). |-| 8 | GND | Power | Ground. |-| 9 | PB6 | I/O / XTAL1 | Port B bit 6 or crystal/resonator input XTAL1 / TOSC1. PCINT6. |-| 10 | PB7 | I/O / XTAL2 | Port B bit 7 or crystal/resonator output XTAL2 / TOSC2. PCINT7. |-| 11 | PD5 | I/O | Port D bit 5. T1 (Timer1 ext. clock), OC0B PWM, PCINT21. |-| 12 | PD6 | I/O | Port D bit 6. AIN0 (analog comparator +), OC0A PWM, PCINT22. |-| 13 | PD7 | I/O | Port D bit 7. AIN1 (analog comparator −), PCINT23. |-| 14 | PB0 | I/O | Port B bit 0. ICP1 (Timer1 input capture), CLKO (clock output), PCINT0. |-| 15 | PB1 | I/O | Port B bit 1. OC1A PWM, PCINT1. |-| 16 | PB2 | I/O | Port B bit 2. SS̄ (SPI slave select), OC1B PWM, PCINT2. |-| 17 | PB3 | I/O | Port B bit 3. MOSI (SPI data in), OC2A PWM, PCINT3. |-| 18 | PB4 | I/O | Port B bit 4. MISO (SPI data out), PCINT4. |-| 19 | PB5 | I/O | Port B bit 5. SCK (SPI clock), PCINT5. |-| 20 | AVCC | Power | ADC supply voltage. Must be within ±0.3 V of VCC; connect through LC filter when ADC is used. |-| 21 | AREF | Analog | ADC reference voltage input. |-| 22 | GND | Power | Ground (analog / digital). |-| 23 | PC0 | I/O | Port C bit 0. ADC0, PCINT8. |-| 24 | PC1 | I/O | Port C bit 1. ADC1, PCINT9. |-| 25 | PC2 | I/O | Port C bit 2. ADC2, PCINT10. |-| 26 | PC3 | I/O | Port C bit 3. ADC3, PCINT11. |-| 27 | PC4 | I/O | Port C bit 4. ADC4, SDA (TWI data), PCINT12. |-| 28 | PC5 | I/O | Port C bit 5. ADC5, SCL (TWI clock), PCINT13. |--## Absolute Maximum Ratings--| Parameter | Value | Unit |-| --- | --- | --- |-| Operating Temperature | −55 to +125 | °C |-| Storage Temperature | −65 to +150 | °C |-| Voltage on any pin (except RESET) w.r.t. GND | −0.5 to V<sub>CC</sub> + 0.5 | V |-| Voltage on RESET w.r.t. GND | −0.5 to +13.0 | V |-| Maximum Operating Voltage | 6.0 | V |-| DC Current per I/O Pin | 40.0 | mA |-| DC Current V<sub>CC</sub> and GND Pins | 200.0 | mA |--Stresses beyond these ratings may cause permanent damage. Exposure to absolute-maximum conditions for extended periods may affect device reliability.--## Recommended Operating Conditions--| Parameter | Min | Typ | Max | Unit |-| --- | --- | --- | --- | --- |-| Supply Voltage V<sub>CC</sub> | 1.8 | — | 5.5 | V |-| Ambient Temperature (industrial) | −40 | — | +85 | °C |-| Ambient Temperature (extended) | −40 | — | +105 | °C |-| Clock Frequency @ 1.8 – 2.7 V | 0 | — | 4 | MHz |-| Clock Frequency @ 2.7 – 4.5 V | 0 | — | 10 | MHz |-| Clock Frequency @ 4.5 – 5.5 V | 0 | — | 20 | MHz |--## Electrical Characteristics--**ATmega328P DC Characteristics** — T<sub>A</sub> = −40 °C to 85 °C, V<sub>CC</sub> = 1.8 V to 5.5 V (unless otherwise noted).--| Symbol | Parameter | Condition | Typ | Max | Unit |-| --- | --- | --- | --- | --- | --- |-| I<sub>CC</sub> | Active Supply Current | 1 MHz, V<sub>CC</sub> = 2 V | 0.3 | 0.5 | mA |-| I<sub>CC</sub> | Active Supply Current | 4 MHz, V<sub>CC</sub> = 3 V | 1.7 | 2.5 | mA |-| I<sub>CC</sub> | Active Supply Current | 8 MHz, V<sub>CC</sub> = 5 V | 5.2 | 9 | mA |-| I<sub>CC</sub> | Idle Supply Current | 1 MHz, V<sub>CC</sub> = 2 V | 0.04 | 0.15 | mA |-| I<sub>CC</sub> | Idle Supply Current | 4 MHz, V<sub>CC</sub> = 3 V | 0.3 | 0.7 | mA |-| I<sub>CC</sub> | Idle Supply Current | 8 MHz, V<sub>CC</sub> = 5 V | 1.2 | 2.7 | mA |-| I<sub>CC</sub> | Power-save — 32 kHz TOSC enabled | V<sub>CC</sub> = 1.8 V | 0.8 | — | µA |-| I<sub>CC</sub> | Power-save — 32 kHz TOSC enabled | V<sub>CC</sub> = 3 V | 0.9 | — | µA |-| I<sub>CC</sub> | Power-down — WDT enabled | V<sub>CC</sub> = 3 V | 4.2 | 8 | µA |-| I<sub>CC</sub> | Power-down — WDT disabled | V<sub>CC</sub> = 3 V | 0.1 | 2 | µA |--**ADC Characteristics (from Table 29-15)**--| Parameter | Min | Typ | Max | Unit |-| --- | --- | --- | --- | --- |-| Resolution | — | 10 | — | Bits |-| Absolute accuracy, ADC clock = 200 kHz (V<sub>REF</sub> = V<sub>CC</sub> = 4 V) | — | 2 | 4.5 | LSB |-| Integral Non-Linearity (INL) | — | 0.5 | — | LSB |-| Differential Non-Linearity (DNL) | — | 0.25 | — | LSB |-| Gain Error | — | 2 | — | LSB |-| Offset Error | — | 2 | — | LSB |-| Conversion Time (free-running) | 13 | — | 260 | µs |-| Clock Frequency | 50 | — | 1000 | kHz |-| Analog Supply Voltage AV<sub>CC</sub> | V<sub>CC</sub> − 0.3 | — | V<sub>CC</sub> + 0.3 | V |-| Reference Voltage V<sub>REF</sub> | 1.0 | — | AV<sub>CC</sub> | V |-| Internal Voltage Reference | 1.0 | 1.1 | 1.2 | V |-| Analog Input Resistance R<sub>AIN</sub> | — | 100 | — | MΩ |--**Extended Temperature (T<sub>A</sub> = −40 °C to 105 °C).** Active-mode I<sub>CC</sub> typicals are identical to the 85 °C table; max values increase slightly (e.g. power-down max 5 µA instead of 2 µA). See datasheet §30 for the full 105 °C characterization.--## Memory Map--The ATmega328P has three separate memory spaces: program flash, data SRAM, and EEPROM.--**Program Memory (Flash)** — 32 KB organized as 16K × 16 (16-bit wide instructions). The Program Counter is 14 bits wide. Flash is split into an Application Flash Section and an optional Boot Flash Section; the boot section size is fuse-selectable (256/512/1024/2048 words).--| Region | Start | End | Size |-| --- | --- | --- | --- |-| Application Flash Section | 0x0000 | 0x3FFF (or BOOTSZ boundary − 1) | ≤ 32 KB |-| Boot Flash Section (optional) | BOOTSZ boundary | 0x3FFF | 0.5 – 4 KB |--**Data Memory (SRAM)** — 2 KB of internal SRAM plus the AVR's memory-mapped register file and I/O space.--| Region | Start | End | Size |-| --- | --- | --- | --- |-| 32 General-Purpose Registers (R0–R31) | 0x0000 | 0x001F | 32 B |-| 64 Standard I/O Registers | 0x0020 | 0x005F | 64 B |-| 160 Extended I/O Registers | 0x0060 | 0x00FF | 160 B |-| Internal SRAM | 0x0100 | 0x08FF | 2048 B |--Only `ST/STS/STD` and `LD/LDS/LDD` instructions reach the Extended I/O space (0x60–0xFF); the shorter `IN`/`OUT` opcodes only address the 64 standard I/O registers. SRAM access takes two `clkCPU` cycles. The stack grows downward from `RAMEND` (0x08FF) — user code must initialize the Stack Pointer (SPH:SPL) before any `CALL`/`PUSH`.--**EEPROM** — 1 KB of non-volatile data memory, addressable through the `EEAR`, `EEDR`, and `EECR` registers. Endurance is 100 000 write/erase cycles; typical write time is 3.3 ms. EEPROM retains data for 20 years at 85 °C (100 years at 25 °C).--| Parameter | Value |-| --- | --- |-| Flash size | 32 KB (16K × 16) |-| Flash endurance | 10 000 erase/write cycles |-| SRAM size | 2 KB |-| EEPROM size | 1 KB |-| EEPROM endurance | 100 000 erase/write cycles |-| EEPROM write time (typ) | 3.3 ms |-| Data retention | 20 yr @ 85 °C / 100 yr @ 25 °C |--## Interrupt Vectors--The ATmega328P has 26 interrupt sources with dedicated vectors. Each vector is 2 words (4 bytes) long and typically holds a `jmp` to the handler. The reset vector is always at 0x0000; when the `BOOTRST` fuse is programmed the device jumps instead to the boot reset address. When the `IVSEL` bit in `MCUCR` is set, all interrupt vectors relocate to the start of the boot flash section.--| # | Address | Source | Definition |-| --- | --- | --- | --- |-| 1 | 0x0000 | RESET | External pin, power-on reset, brown-out reset, watchdog system reset |-| 2 | 0x0002 | INT0 | External interrupt request 0 |-| 3 | 0x0004 | INT1 | External interrupt request 1 |-| 4 | 0x0006 | PCINT0 | Pin change interrupt request 0 (port B) |-| 5 | 0x0008 | PCINT1 | Pin change interrupt request 1 (port C) |-| 6 | 0x000A | PCINT2 | Pin change interrupt request 2 (port D) |-| 7 | 0x000C | WDT | Watchdog time-out interrupt |-| 8 | 0x000E | TIMER2_COMPA | Timer/Counter2 compare match A |-| 9 | 0x0010 | TIMER2_COMPB | Timer/Counter2 compare match B |-| 10 | 0x0012 | TIMER2_OVF | Timer/Counter2 overflow |-| 11 | 0x0014 | TIMER1_CAPT | Timer/Counter1 capture event |-| 12 | 0x0016 | TIMER1_COMPA | Timer/Counter1 compare match A |-| 13 | 0x0018 | TIMER1_COMPB | Timer/Counter1 compare match B |-| 14 | 0x001A | TIMER1_OVF | Timer/Counter1 overflow |-| 15 | 0x001C | TIMER0_COMPA | Timer/Counter0 compare match A |-| 16 | 0x001E | TIMER0_COMPB | Timer/Counter0 compare match B |-| 17 | 0x0020 | TIMER0_OVF | Timer/Counter0 overflow |-| 18 | 0x0022 | SPI_STC | SPI serial transfer complete |-| 19 | 0x0024 | USART_RX | USART Rx complete |-| 20 | 0x0026 | USART_UDRE | USART data register empty |-| 21 | 0x0028 | USART_TX | USART Tx complete |-| 22 | 0x002A | ADC | ADC conversion complete |-| 23 | 0x002C | EE_READY | EEPROM ready |-| 24 | 0x002E | ANALOG_COMP | Analog comparator |-| 25 | 0x0030 | TWI | 2-wire serial interface |-| 26 | 0x0032 | SPM_READY | Store program memory ready |--Lower vector addresses have higher priority — RESET is highest, SPM_READY lowest. The global interrupt enable is bit 7 (`I`) in `SREG`, set with `sei` and cleared with `cli`.--## Clock System--The ATmega328P supports six clock sources, selectable via the `CKSEL[3:0]` fuse bits. All clock options feed a common system clock prescaler that divides by 1, 2, 4, ..., 256 under software control (`CLKPR` register).--| CKSEL[3:0] | Clock Source | Typical Frequency |-| --- | --- | --- |-| 0000 | External clock (CLKI pin) | 0 – 20 MHz |-| 0010 | Calibrated internal RC oscillator | 8 MHz (factory-calibrated, ±1 % @ 25 °C / 5 V) |-| 0011 | Internal 128 kHz RC oscillator | 128 kHz (low-power WDT clock) |-| 0100–0101 | Low-frequency crystal oscillator | 32.768 kHz (RTC) |-| 0110–0111 | Full-swing crystal oscillator | 0.4 – 20 MHz |-| 1000–1111 | Low-power crystal oscillator | 0.4 – 16 MHz |--The default fuse setting ships the device running on the internal 8 MHz RC oscillator with a ÷8 prescaler → 1 MHz system clock. Writing `CLKPR = 0` selects the full 8 MHz. Switching to an external 16 MHz crystal requires reprogramming `CKSEL[3:0]` and `SUT[1:0]` fuses (Arduino bootloaders do this automatically).--## Peripherals Overview--| Peripheral | Count | Key Features |-| --- | --- | --- |-| Timer/Counter0 | 1 | 8-bit, PWM (OC0A/OC0B), external clock T0 |-| Timer/Counter1 | 1 | 16-bit, PWM (OC1A/OC1B), input capture (ICP1) |-| Timer/Counter2 | 1 | 8-bit, async (TOSC crystal), PWM (OC2A/OC2B) |-| USART | 1 | Full-duplex, MSPIM mode, auto-baud |-| SPI | 1 | Master/slave, 4 modes, up to f<sub>CPU</sub>/2 |-| TWI (I²C) | 1 | Multi-master, 7/10-bit addressing, up to 400 kHz |-| ADC | 1 | 10-bit, 8 channels (TQFP) / 6 channels (SPDIP), 13 – 260 µs conv. |-| Analog Comparator | 1 | Bandgap reference, input-capture trigger |-| Watchdog Timer | 1 | 16 ms – 8 s, interrupt + reset modes |-| External Interrupts | 2 | INT0, INT1 (edge/level) |-| Pin Change Interrupts | 24 | PCINT0–PCINT23 across PORTB/C/D |--## Packages--| Code | Package | Size | Lead Pitch |-| --- | --- | --- | --- |-| 28P3 | 28-lead Plastic Dual Inline (SPDIP), 0.300″ wide | 28 × 0.300″ | 2.54 mm |-| 32A | 32-lead Thin Quad Flat Pack (TQFP), 1.0 mm body | 7 × 7 × 1.0 mm | 0.80 mm BSC |-| 28M1 | 28-pad Very Thin Quad Flat No-Lead (VQFN) | 4 × 4 × 1.0 mm | 0.45 mm |-| 32M1-A | 32-pad Thin Quad Flat No-Lead (VQFN, S4B) | 5 × 5 × 1.0 mm | 0.50 mm |--### Ordering Codes (ATmega328P)--| Code | Package | Temp Range |-| --- | --- | --- |-| ATmega328P-AU / -AUR | 32A (TQFP) | −40 °C to 85 °C |-| ATmega328P-MMH / -MMHR | 28M1 (VQFN) | −40 °C to 85 °C |-| ATmega328P-MU / -MUR | 32M1-A (VQFN) | −40 °C to 85 °C |-| ATmega328P-PU | 28P3 (SPDIP) | −40 °C to 85 °C |-| ATmega328P-AN / -ANR | 32A (TQFP) | −40 °C to 105 °C |-| ATmega328P-MN / -MNR | 32M1-A (VQFN) | −40 °C to 105 °C |-| ATmega328P-PN | 28P3 (SPDIP) | −40 °C to 105 °C |--Suffix `R` = tape & reel. Suffix `N` = extended (105 °C) temperature grade. `MMH` leadframe uses NiPdAu finish.--## Applications--- Arduino Uno, Nano, Pro Mini, and compatible development boards-- Hobby and educational microcontroller projects-- Low-power sensor nodes and battery-operated devices (thanks to 0.1 µA power-down)-- Motor control, lighting, and simple industrial automation-- USB-to-serial gadgets, LED controllers, data loggers-- Safety-critical timing with programmable watchdog + brown-out detection+| Max clock | 20 MHz |+| GPIO | 23 (ports B/C/D) |+| ADC | 6-channel 10-bit (DIP) |+| Serial | USART + SPI + I2C (TWI) |+| Timers | 3 (2x 8-bit, 1x 16-bit) with PWM |+| Supply voltage | 1.8-5.5 V |+| Package | PDIP-28 (SPDIP) | -## Key Formulas+## Ordering variants -### Speed vs. Supply Voltage+- `ATmega328P-PU (PDIP-28, tube)`+- `ATmega328P-PN (PDIP-28)` -The maximum CPU clock frequency scales linearly with V<sub>CC</sub>:+## CAD (KiCad official) -$$f_{CLK,\,max} = \begin{cases} 4\ \text{MHz} & 1.8\ \text{V} \le V_{CC} \le 2.7\ \text{V} \\ 10\ \text{MHz} & 2.7\ \text{V} \le V_{CC} \le 4.5\ \text{V} \\ 20\ \text{MHz} & 4.5\ \text{V} \le V_{CC} \le 5.5\ \text{V} \end{cases}$$+- Symbol: `MCU_Microchip_ATmega:ATmega328P-P`+- Footprint: `Package_DIP:DIP-28_W7.62mm`+- 3D model: DIP-28 (KiCad packages3D) -### I/O Switching Current Estimate+## Provenance -Current drawn on a capacitively-loaded pin is approximately:+Data extracted from the manufacturer datasheet, not a distributor listing: -$$I_{pin} \approx C_L \cdot V_{CC} \cdot f$$+- **Datasheet:** [Microchip Technology datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061B.pdf) (653 pp, sha256 `b9b9d83cda56a95d`, retrieved 2026-08-17, tier: manufacturer)+- **Extractor:** `ds2sf` (Claude). Every pin and dimension is cited to a datasheet page; it refuses to fabricate.+- **CAD:** KiCad official libraries (CC-BY-SA 4.0). -where $C_L$ is load capacitance, $V_{CC}$ is operating voltage, and $f$ is the average switching frequency of the pin.+[Datasheet PDF](docs/atmega328p-datasheet.pdf)
atmega328p.glbadded⋯ 1 unchanged line ⋯
atmega328p.kicad_modadded+374@@ -0,0 +1,374 @@+(footprint "DIP-28_W7.62mm"+ (version 20260206)+ (generator "kicad-footprint-generator")+ (layer "F.Cu")+ (descr "28-lead though-hole mounted DIP package, row spacing 7.62mm (300 mils)")+ (tags "THT DIP DIL PDIP 2.54mm 7.62mm 300mil")+ (property "Reference" "REF**"+ (at 3.81 -2.33 0)+ (layer "F.SilkS")+ (effects+ (font+ (size 1 1)+ (thickness 0.15)+ )+ )+ )+ (property "Value" "DIP-28_W7.62mm"+ (at 3.81 35.35 0)+ (layer "F.Fab")+ (effects+ (font+ (size 1 1)+ (thickness 0.15)+ )+ )+ )+ (property "KiLib_Generator" "package/DIP/legacy"+ (at 0 0 0)+ (layer "F.SilkS")+ (hide yes)+ (effects+ (font+ (size 1 1)+ (thickness 0.15)+ )+ )+ )+ (attr through_hole)+ (duplicate_pad_numbers_are_jumpers no)+ (fp_line+ (start 1.16 -1.33)+ (end 1.16 34.35)+ (stroke+ (width 0.12)+ (type solid)+ )+ (layer "F.SilkS")+ )+ (fp_line+ (start 1.16 34.35)+ (end 6.46 34.35)+ (stroke+ (width 0.12)+ (type solid)+ )+ (layer "F.SilkS")+ )+ (fp_line+ (start 2.81 -1.33)+ (end 1.16 -1.33)+ (stroke+ (width 0.12)+ (type solid)+ )+ (layer "F.SilkS")+ )+ (fp_line+ (start 6.46 -1.33)+ (end 4.81 -1.33)+ (stroke+ (width 0.12)+ (type solid)+ )+ (layer "F.SilkS")+ )+ (fp_line+ (start 6.46 34.35)+ (end 6.46 -1.33)+ (stroke+ (width 0.12)+ (type solid)+ )+ (layer "F.SilkS")+ )+ (fp_arc+ (start 4.81 -1.33)+ (mid 3.81 -0.33)+ (end 2.81 -1.33)+ (stroke+ (width 0.12)+ (type solid)+ )+ (layer "F.SilkS")+ )+ (fp_rect+ (start -1.06 -1.53)+ (end 8.67 34.55)+ (stroke+ (width 0.05)+ (type solid)+ )+ (fill no)+ (layer "F.CrtYd")+ )+ (fp_line+ (start 0.635 -0.27)+ (end 1.635 -1.27)+ (stroke+ (width 0.1)+ (type solid)+ )+ (layer "F.Fab")+ )+ (fp_line+ (start 0.635 34.29)+ (end 0.635 -0.27)+ (stroke+ (width 0.1)+ (type solid)+ )+ (layer "F.Fab")+ )+ (fp_line+ (start 1.635 -1.27)+ (end 6.985 -1.27)+ (stroke+ (width 0.1)+ (type solid)+ )+ (layer "F.Fab")+ )+ (fp_line+ (start 6.985 -1.27)+ (end 6.985 34.29)+ (stroke+ (width 0.1)+ (type solid)+ )+ (layer "F.Fab")+ )+ (fp_line+ (start 6.985 34.29)+ (end 0.635 34.29)+ (stroke+ (width 0.1)+ (type solid)+ )+ (layer "F.Fab")+ )+ (fp_text user "${REFERENCE}"+ (at 3.81 16.51 90)+ (layer "F.Fab")+ (effects+ (font+ (size 1 1)+ (thickness 0.15)+ )+ )+ )+ (pad "1" thru_hole roundrect+ (at 0 0)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ (roundrect_rratio 0.15625)+ )+ (pad "2" thru_hole circle+ (at 0 2.54)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "3" thru_hole circle+ (at 0 5.08)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "4" thru_hole circle+ (at 0 7.62)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "5" thru_hole circle+ (at 0 10.16)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "6" thru_hole circle+ (at 0 12.7)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "7" thru_hole circle+ (at 0 15.24)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "8" thru_hole circle+ (at 0 17.78)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "9" thru_hole circle+ (at 0 20.32)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "10" thru_hole circle+ (at 0 22.86)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "11" thru_hole circle+ (at 0 25.4)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "12" thru_hole circle+ (at 0 27.94)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "13" thru_hole circle+ (at 0 30.48)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "14" thru_hole circle+ (at 0 33.02)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "15" thru_hole circle+ (at 7.62 33.02)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "16" thru_hole circle+ (at 7.62 30.48)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "17" thru_hole circle+ (at 7.62 27.94)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "18" thru_hole circle+ (at 7.62 25.4)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "19" thru_hole circle+ (at 7.62 22.86)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "20" thru_hole circle+ (at 7.62 20.32)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "21" thru_hole circle+ (at 7.62 17.78)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "22" thru_hole circle+ (at 7.62 15.24)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "23" thru_hole circle+ (at 7.62 12.7)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "24" thru_hole circle+ (at 7.62 10.16)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "25" thru_hole circle+ (at 7.62 7.62)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "26" thru_hole circle+ (at 7.62 5.08)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "27" thru_hole circle+ (at 7.62 2.54)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (pad "28" thru_hole circle+ (at 7.62 0)+ (size 1.6 1.6)+ (drill 0.8)+ (layers "*.Cu" "*.Mask")+ (remove_unused_layers no)+ )+ (point+ (at 3.81 16.51)+ (size 1.27)+ (layer "F.Fab")+ )+ (embedded_fonts no)+ (model "${KICAD10_3DMODEL_DIR}/Package_DIP.3dshapes/DIP-28_W7.62mm.step"+ (offset+ (xyz 0 0 0)+ )+ (scale+ (xyz 1 1 1)+ )+ (rotate+ (xyz 0 0 0)+ )+ )+)
atmega328p.kicad_symadded+611@@ -0,0 +1,611 @@+(kicad_symbol_lib+ (version 20251024)+ (generator "kicad_symbol_editor")+ (generator_version "10.0")+(symbol "ATmega328P-P"+ (exclude_from_sim no)+ (in_bom yes)+ (on_board yes)+ (in_pos_files yes)+ (duplicate_pin_numbers_are_jumpers no)+ (property "Reference" "U"+ (at -12.7 36.83 0)+ (show_name no)+ (do_not_autoplace no)+ (effects+ (font+ (size 1.27 1.27)+ )+ (justify left bottom)+ )+ )+ (property "Value" "ATmega328P-P"+ (at 2.54 -36.83 0)+ (show_name no)+ (do_not_autoplace no)+ (effects+ (font+ (size 1.27 1.27)+ )+ (justify left top)+ )+ )+ (property "Footprint" "Package_DIP:DIP-28_W7.62mm"+ (at 0 0 0)+ (show_name no)+ (do_not_autoplace no)+ (hide yes)+ (effects+ (font+ (size 1.27 1.27)+ (italic yes)+ )+ )+ )+ (property "Datasheet" "http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-8025-8-bit-AVR-Microcontroller-ATmega48P-88P-168P_Datasheet.pdf"+ (at 0 0 0)+ (show_name no)+ (do_not_autoplace no)+ (hide yes)+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (property "Description" "10MHz, 4kB Flash, 512B SRAM, 256B EEPROM, DIP-28"+ (at 0 0 0)+ (show_name no)+ (do_not_autoplace no)+ (hide yes)+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (property "ki_keywords" "AVR 8bit Microcontroller MegaAVR"+ (at 0 0 0)+ (show_name no)+ (do_not_autoplace no)+ (hide yes)+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (property "ki_fp_filters" "DIP*W7.62mm*"+ (at 0 0 0)+ (show_name no)+ (do_not_autoplace no)+ (hide yes)+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (symbol "ATmega328P-P_0_1"+ (rectangle+ (start -12.7 -35.56)+ (end 12.7 35.56)+ (stroke+ (width 0.254)+ (type default)+ )+ (fill+ (type background)+ )+ )+ )+ (symbol "ATmega328P-P_1_1"+ (pin bidirectional line+ (at 15.24 -7.62 180)+ (length 2.54)+ (name "~{RESET}/PC6"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "1"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -12.7 180)+ (length 2.54)+ (name "PD0"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "2"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -15.24 180)+ (length 2.54)+ (name "PD1"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "3"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -17.78 180)+ (length 2.54)+ (name "PD2"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "4"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -20.32 180)+ (length 2.54)+ (name "PD3"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "5"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -22.86 180)+ (length 2.54)+ (name "PD4"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "6"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin power_in line+ (at 0 38.1 270)+ (length 2.54)+ (name "VCC"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "7"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin power_in line+ (at 0 -38.1 90)+ (length 2.54)+ (name "GND"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "8"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 15.24 180)+ (length 2.54)+ (name "XTAL1/PB6"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "9"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 12.7 180)+ (length 2.54)+ (name "XTAL2/PB7"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "10"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -25.4 180)+ (length 2.54)+ (name "PD5"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "11"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -27.94 180)+ (length 2.54)+ (name "PD6"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "12"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -30.48 180)+ (length 2.54)+ (name "PD7"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "13"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 30.48 180)+ (length 2.54)+ (name "PB0"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "14"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 27.94 180)+ (length 2.54)+ (name "PB1"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "15"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 25.4 180)+ (length 2.54)+ (name "PB2"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "16"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 22.86 180)+ (length 2.54)+ (name "PB3"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "17"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 20.32 180)+ (length 2.54)+ (name "PB4"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "18"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 17.78 180)+ (length 2.54)+ (name "PB5"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "19"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin power_in line+ (at 2.54 38.1 270)+ (length 2.54)+ (name "AVCC"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "20"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin passive line+ (at -15.24 30.48 0)+ (length 2.54)+ (name "AREF"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "21"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin passive line+ (at 0 -38.1 90)+ (length 2.54)+ (hide yes)+ (name "GND"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "22"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 7.62 180)+ (length 2.54)+ (name "PC0"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "23"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 5.08 180)+ (length 2.54)+ (name "PC1"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "24"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 2.54 180)+ (length 2.54)+ (name "PC2"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "25"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 0 180)+ (length 2.54)+ (name "PC3"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "26"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -2.54 180)+ (length 2.54)+ (name "PC4"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "27"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ (pin bidirectional line+ (at 15.24 -5.08 180)+ (length 2.54)+ (name "PC5"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ (number "28"+ (effects+ (font+ (size 1.27 1.27)+ )+ )+ )+ )+ )+ (embedded_fonts no)+ )+)
docs/atmega328p-datasheet.pdfadded⋯ 1 unchanged line ⋯
docs/hero.pngadded⋯ 1 unchanged line ⋯
package.jsonadded+32@@ -0,0 +1,32 @@+{+ "slug": "atmega328p",+ "version": "0.1.0",+ "type": "component",+ "description": "Microchip 8-bit AVR MCU, 28-pin DIP. 32 KB flash, 2 KB SRAM, 20 MHz, the Arduino Uno chip. Datasheet-verified.",+ "tags": [+ "component",+ "microcontroller",+ "mcu",+ "avr",+ "atmega",+ "arduino",+ "pdip-28",+ "microchip"+ ],+ "dependencies": {},+ "hero": {+ "type": "image",+ "path": "docs/hero.png"+ },+ "files": [+ "page.json",+ "README.md",+ "atmega328p.kicad_sym",+ "atmega328p.kicad_mod",+ "atmega328p.glb",+ "docs/hero.png",+ "docs/atmega328p-datasheet.pdf",+ "viewers/symbol.html",+ "viewers/footprint.html"+ ]+}
page.json+29−7@@ -4,8 +4,17 @@ "slug": "atmega328p", "title": "ATmega328P — 8-bit AVR Microcontroller", "brief": "Microchip (Atmel) ATmega328P. 8-bit AVR RISC, 32KB flash, 2KB SRAM, 1KB EEPROM, 23 I/O, 10-bit ADC, 20 MHz, 1.8–5.5 V. The core of the Arduino Uno.",- "version": "1.0.0",- "tags": [],+ "version": "0.1.0",+ "tags": [+ "component",+ "microcontroller",+ "mcu",+ "avr",+ "atmega",+ "arduino",+ "pdip-28",+ "microchip"+ ], "license": "MIT", "component": { "mpn": "ATmega328P — 8-bit AVR Microcontroller",@@ -20,18 +29,31 @@ }, "readme": "**Source:** [Microchip / Atmel Datasheet (DS40002061B)](https://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061B.pdf)\n**Manufacturer:** Microchip (formerly Atmel)\n**Part Number:** ATmega328P\n**Document:** DS40002061B — 2020 (megaAVR, part of ATmega48A/PA/88A/PA/168A/PA/328/P family datasheet)\n**Architecture:** 8-bit AVR RISC\n\n## Description\n\nThe ATmega328P is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, it achieves throughputs approaching 1 MIPS per MHz, allowing the system designer to optimize power consumption versus processing speed. The ATmega328P combines 32 KB of ISP flash with read-while-write capabilities, 1 KB EEPROM, 2 KB SRAM, 23 general-purpose I/O lines, 32 general-purpose working registers, three flexible timer/counters with compare modes, internal and external interrupts, a serial programmable USART, a byte-oriented 2-wire serial interface, an SPI serial port, a 6-channel 10-bit ADC (8 channels in TQFP and QFN/MLF packages), a programmable watchdog timer with internal oscillator, and five software-selectable power-saving modes. This part is the microcontroller at the heart of the Arduino Uno / Nano / Pro Mini.\n\n## Key Specifications\n\n| Parameter | Value |\n| --- | --- |\n| Architecture | 8-bit AVR RISC |\n| Flash Memory | 32 KB (ISP, read-while-write) |\n| SRAM | 2 KB |\n| EEPROM | 1 KB |\n| Operating Voltage | 1.8 V – 5.5 V |\n| Max Clock | 20 MHz @ 4.5 V – 5.5 V |\n| Max MIPS | 20 MIPS @ 20 MHz |\n| Digital I/O Lines | 23 |\n| ADC | 10-bit, 8-channel (TQFP/VQFN), 6-channel (SPDIP) |\n| Timers | 2 × 8-bit + 1 × 16-bit, PWM channels ×6 |\n| Serial Interfaces | USART, SPI, 2-wire (I²C-compatible) |\n| Interrupt Sources | 26 |\n| Temperature Range | −40 °C to 85 °C (industrial); −40 °C to 105 °C (extended) |\n| Packages | 28-pin PDIP, 32-pin TQFP, 28-pad VQFN, 32-pad VQFN |\n| Active Current @ 8 MHz, 5 V | 5.2 mA typ |\n| Power-down Current @ 3 V | 0.1 µA typ |\n\n## Features\n\n- High-performance, low-power AVR 8-bit microcontroller\n- Advanced RISC architecture — 131 instructions, mostly single-cycle execution, 32 × 8 general-purpose working registers, fully static operation, up to 20 MIPS throughput at 20 MHz, on-chip 2-cycle multiplier\n- High-endurance non-volatile memory — 32 KB in-system self-programmable flash, 1 KB EEPROM, 2 KB internal SRAM; 10 000 flash / 100 000 EEPROM write-erase cycles; 20-year data retention at 85 °C / 100 years at 25 °C\n- Optional boot-loader section with independent lock bits; in-system programming via the on-chip boot program; true read-while-write operation\n- Programming lock for software security\n- QTouch library support: capacitive touch buttons, sliders and wheels; up to 64 sense channels\n- Peripheral features — Two 8-bit timer/counters and one 16-bit timer/counter with separate prescaler, compare & capture modes; real-time counter with separate oscillator; six PWM channels; 10-bit 6-channel ADC (SPDIP) or 8-channel ADC (TQFP/QFN) with optional temperature measurement; programmable serial USART; master/slave SPI; byte-oriented 2-wire serial (Philips I²C compatible); programmable watchdog timer with separate on-chip oscillator; on-chip analog comparator; interrupt & wake-up on pin change\n- Special microcontroller features — Power-on reset and programmable brown-out detection; internal calibrated RC oscillator; external and internal interrupt sources; six sleep modes: Idle, ADC noise reduction, Power-save, Power-down, Standby, Extended Standby\n- I/O and packages — 23 programmable I/O lines; 28-pin SPDIP, 32-lead TQFP, 28-pad VQFN, 32-pad VQFN\n- Operating voltage: 1.8 V – 5.5 V\n- Temperature range: −40 °C to 85 °C (industrial), extended to −40 °C to 105 °C on select orderable codes\n- Speed grades: 0 – 4 MHz @ 1.8 – 5.5 V, 0 – 10 MHz @ 2.7 – 5.5 V, 0 – 20 MHz @ 4.5 – 5.5 V\n- Ultra-low power: 0.2 mA active @ 1 MHz / 1.8 V / 25 °C; 0.1 µA power-down; 0.75 µA power-save (32 kHz RTC on)\n\n## Pin Configuration\n\nPinout shown for the 28-pin SPDIP / 28-pad VQFN package. The 32-pin TQFP / VQFN adds two extra ADC channels (ADC6, ADC7) and separate AVCC / AGND pins.\n\n| Pin | Name | Type | Description |\n| --- | --- | --- | --- |\n| 1 | PC6 / RESET | I/O / Reset | Port C bit 6 when RSTDISBL fuse is programmed; otherwise active-low reset. Also PCINT14. |\n| 2 | PD0 | I/O | Port D bit 0. RXD (USART input), PCINT16. |\n| 3 | PD1 | I/O | Port D bit 1. TXD (USART output), PCINT17. |\n| 4 | PD2 | I/O | Port D bit 2. INT0 external interrupt, PCINT18. |\n| 5 | PD3 | I/O | Port D bit 3. INT1, OC2B PWM, PCINT19. |\n| 6 | PD4 | I/O | Port D bit 4. XCK (USART clock) / T0 (Timer0 ext. clock), PCINT20. |\n| 7 | VCC | Power | Digital supply voltage (1.8 V – 5.5 V). |\n| 8 | GND | Power | Ground. |\n| 9 | PB6 | I/O / XTAL1 | Port B bit 6 or crystal/resonator input XTAL1 / TOSC1. PCINT6. |\n| 10 | PB7 | I/O / XTAL2 | Port B bit 7 or crystal/resonator output XTAL2 / TOSC2. PCINT7. |\n| 11 | PD5 | I/O | Port D bit 5. T1 (Timer1 ext. clock), OC0B PWM, PCINT21. |\n| 12 | PD6 | I/O | Port D bit 6. AIN0 (analog comparator +), OC0A PWM, PCINT22. |\n| 13 | PD7 | I/O | Port D bit 7. AIN1 (analog comparator −), PCINT23. |\n| 14 | PB0 | I/O | Port B bit 0. ICP1 (Timer1 input capture), CLKO (clock output), PCINT0. |\n| 15 | PB1 | I/O | Port B bit 1. OC1A PWM, PCINT1. |\n| 16 | PB2 | I/O | Port B bit 2. SS̄ (SPI slave select), OC1B PWM, PCINT2. |\n| 17 | PB3 | I/O | Port B bit 3. MOSI (SPI data in), OC2A PWM, PCINT3. |\n| 18 | PB4 | I/O | Port B bit 4. MISO (SPI data out), PCINT4. |\n| 19 | PB5 | I/O | Port B bit 5. SCK (SPI clock), PCINT5. |\n| 20 | AVCC | Power | ADC supply voltage. Must be within ±0.3 V of VCC; connect through LC filter when ADC is used. |\n| 21 | AREF | Analog | ADC reference voltage input. |\n| 22 | GND | Power | Ground (analog / digital). |\n| 23 | PC0 | I/O | Port C bit 0. ADC0, PCINT8. |\n| 24 | PC1 | I/O | Port C bit 1. ADC1, PCINT9. |\n| 25 | PC2 | I/O | Port C bit 2. ADC2, PCINT10. |\n| 26 | PC3 | I/O | Port C bit 3. ADC3, PCINT11. |\n| 27 | PC4 | I/O | Port C bit 4. ADC4, SDA (TWI data), PCINT12. |\n| 28 | PC5 | I/O | Port C bit 5. ADC5, SCL (TWI clock), PCINT13. |\n\n## Absolute Maximum Ratings\n\n| Parameter | Value | Unit |\n| --- | --- | --- |\n| Operating Temperature | −55 to +125 | °C |\n| Storage Temperature | −65 to +150 | °C |\n| Voltage on any pin (except RESET) w.r.t. GND | −0.5 to V<sub>CC</sub> + 0.5 | V |\n| Voltage on RESET w.r.t. GND | −0.5 to +13.0 | V |\n| Maximum Operating Voltage | 6.0 | V |\n| DC Current per I/O Pin | 40.0 | mA |\n| DC Current V<sub>CC</sub> and GND Pins | 200.0 | mA |\n\nStresses beyond these ratings may cause permanent damage. Exposure to absolute-maximum conditions for extended periods may affect device reliability.\n\n## Recommended Operating Conditions\n\n| Parameter | Min | Typ | Max | Unit |\n| --- | --- | --- | --- | --- |\n| Supply Voltage V<sub>CC</sub> | 1.8 | — | 5.5 | V |\n| Ambient Temperature (industrial) | −40 | — | +85 | °C |\n| Ambient Temperature (extended) | −40 | — | +105 | °C |\n| Clock Frequency @ 1.8 – 2.7 V | 0 | — | 4 | MHz |\n| Clock Frequency @ 2.7 – 4.5 V | 0 | — | 10 | MHz |\n| Clock Frequency @ 4.5 – 5.5 V | 0 | — | 20 | MHz |\n\n## Electrical Characteristics\n\n**ATmega328P DC Characteristics** — T<sub>A</sub> = −40 °C to 85 °C, V<sub>CC</sub> = 1.8 V to 5.5 V (unless otherwise noted).\n\n| Symbol | Parameter | Condition | Typ | Max | Unit |\n| --- | --- | --- | --- | --- | --- |\n| I<sub>CC</sub> | Active Supply Current | 1 MHz, V<sub>CC</sub> = 2 V | 0.3 | 0.5 | mA |\n| I<sub>CC</sub> | Active Supply Current | 4 MHz, V<sub>CC</sub> = 3 V | 1.7 | 2.5 | mA |\n| I<sub>CC</sub> | Active Supply Current | 8 MHz, V<sub>CC</sub> = 5 V | 5.2 | 9 | mA |\n| I<sub>CC</sub> | Idle Supply Current | 1 MHz, V<sub>CC</sub> = 2 V | 0.04 | 0.15 | mA |\n| I<sub>CC</sub> | Idle Supply Current | 4 MHz, V<sub>CC</sub> = 3 V | 0.3 | 0.7 | mA |\n| I<sub>CC</sub> | Idle Supply Current | 8 MHz, V<sub>CC</sub> = 5 V | 1.2 | 2.7 | mA |\n| I<sub>CC</sub> | Power-save — 32 kHz TOSC enabled | V<sub>CC</sub> = 1.8 V | 0.8 | — | µA |\n| I<sub>CC</sub> | Power-save — 32 kHz TOSC enabled | V<sub>CC</sub> = 3 V | 0.9 | — | µA |\n| I<sub>CC</sub> | Power-down — WDT enabled | V<sub>CC</sub> = 3 V | 4.2 | 8 | µA |\n| I<sub>CC</sub> | Power-down — WDT disabled | V<sub>CC</sub> = 3 V | 0.1 | 2 | µA |\n\n**ADC Characteristics (from Table 29-15)**\n\n| Parameter | Min | Typ | Max | Unit |\n| --- | --- | --- | --- | --- |\n| Resolution | — | 10 | — | Bits |\n| Absolute accuracy, ADC clock = 200 kHz (V<sub>REF</sub> = V<sub>CC</sub> = 4 V) | — | 2 | 4.5 | LSB |\n| Integral Non-Linearity (INL) | — | 0.5 | — | LSB |\n| Differential Non-Linearity (DNL) | — | 0.25 | — | LSB |\n| Gain Error | — | 2 | — | LSB |\n| Offset Error | — | 2 | — | LSB |\n| Conversion Time (free-running) | 13 | — | 260 | µs |\n| Clock Frequency | 50 | — | 1000 | kHz |\n| Analog Supply Voltage AV<sub>CC</sub> | V<sub>CC</sub> − 0.3 | — | V<sub>CC</sub> + 0.3 | V |\n| Reference Voltage V<sub>REF</sub> | 1.0 | — | AV<sub>CC</sub> | V |\n| Internal Voltage Reference | 1.0 | 1.1 | 1.2 | V |\n| Analog Input Resistance R<sub>AIN</sub> | — | 100 | — | MΩ |\n\n**Extended Temperature (T<sub>A</sub> = −40 °C to 105 °C).** Active-mode I<sub>CC</sub> typicals are identical to the 85 °C table; max values increase slightly (e.g. power-down max 5 µA instead of 2 µA). See datasheet §30 for the full 105 °C characterization.\n\n## Memory Map\n\nThe ATmega328P has three separate memory spaces: program flash, data SRAM, and EEPROM.\n\n**Program Memory (Flash)** — 32 KB organized as 16K × 16 (16-bit wide instructions). The Program Counter is 14 bits wide. Flash is split into an Application Flash Section and an optional Boot Flash Section; the boot section size is fuse-selectable (256/512/1024/2048 words).\n\n| Region | Start | End | Size |\n| --- | --- | --- | --- |\n| Application Flash Section | 0x0000 | 0x3FFF (or BOOTSZ boundary − 1) | ≤ 32 KB |\n| Boot Flash Section (optional) | BOOTSZ boundary | 0x3FFF | 0.5 – 4 KB |\n\n**Data Memory (SRAM)** — 2 KB of internal SRAM plus the AVR's memory-mapped register file and I/O space.\n\n| Region | Start | End | Size |\n| --- | --- | --- | --- |\n| 32 General-Purpose Registers (R0–R31) | 0x0000 | 0x001F | 32 B |\n| 64 Standard I/O Registers | 0x0020 | 0x005F | 64 B |\n| 160 Extended I/O Registers | 0x0060 | 0x00FF | 160 B |\n| Internal SRAM | 0x0100 | 0x08FF | 2048 B |\n\nOnly `ST/STS/STD` and `LD/LDS/LDD` instructions reach the Extended I/O space (0x60–0xFF); the shorter `IN`/`OUT` opcodes only address the 64 standard I/O registers. SRAM access takes two `clkCPU` cycles. The stack grows downward from `RAMEND` (0x08FF) — user code must initialize the Stack Pointer (SPH:SPL) before any `CALL`/`PUSH`.\n\n**EEPROM** — 1 KB of non-volatile data memory, addressable through the `EEAR`, `EEDR`, and `EECR` registers. Endurance is 100 000 write/erase cycles; typical write time is 3.3 ms. EEPROM retains data for 20 years at 85 °C (100 years at 25 °C).\n\n| Parameter | Value |\n| --- | --- |\n| Flash size | 32 KB (16K × 16) |\n| Flash endurance | 10 000 erase/write cycles |\n| SRAM size | 2 KB |\n| EEPROM size | 1 KB |\n| EEPROM endurance | 100 000 erase/write cycles |\n| EEPROM write time (typ) | 3.3 ms |\n| Data retention | 20 yr @ 85 °C / 100 yr @ 25 °C |\n\n## Interrupt Vectors\n\nThe ATmega328P has 26 interrupt sources with dedicated vectors. Each vector is 2 words (4 bytes) long and typically holds a `jmp` to the handler. The reset vector is always at 0x0000; when the `BOOTRST` fuse is programmed the device jumps instead to the boot reset address. When the `IVSEL` bit in `MCUCR` is set, all interrupt vectors relocate to the start of the boot flash section.\n\n| # | Address | Source | Definition |\n| --- | --- | --- | --- |\n| 1 | 0x0000 | RESET | External pin, power-on reset, brown-out reset, watchdog system reset |\n| 2 | 0x0002 | INT0 | External interrupt request 0 |\n| 3 | 0x0004 | INT1 | External interrupt request 1 |\n| 4 | 0x0006 | PCINT0 | Pin change interrupt request 0 (port B) |\n| 5 | 0x0008 | PCINT1 | Pin change interrupt request 1 (port C) |\n| 6 | 0x000A | PCINT2 | Pin change interrupt request 2 (port D) |\n| 7 | 0x000C | WDT | Watchdog time-out interrupt |\n| 8 | 0x000E | TIMER2_COMPA | Timer/Counter2 compare match A |\n| 9 | 0x0010 | TIMER2_COMPB | Timer/Counter2 compare match B |\n| 10 | 0x0012 | TIMER2_OVF | Timer/Counter2 overflow |\n| 11 | 0x0014 | TIMER1_CAPT | Timer/Counter1 capture event |\n| 12 | 0x0016 | TIMER1_COMPA | Timer/Counter1 compare match A |\n| 13 | 0x0018 | TIMER1_COMPB | Timer/Counter1 compare match B |\n| 14 | 0x001A | TIMER1_OVF | Timer/Counter1 overflow |\n| 15 | 0x001C | TIMER0_COMPA | Timer/Counter0 compare match A |\n| 16 | 0x001E | TIMER0_COMPB | Timer/Counter0 compare match B |\n| 17 | 0x0020 | TIMER0_OVF | Timer/Counter0 overflow |\n| 18 | 0x0022 | SPI_STC | SPI serial transfer complete |\n| 19 | 0x0024 | USART_RX | USART Rx complete |\n| 20 | 0x0026 | USART_UDRE | USART data register empty |\n| 21 | 0x0028 | USART_TX | USART Tx complete |\n| 22 | 0x002A | ADC | ADC conversion complete |\n| 23 | 0x002C | EE_READY | EEPROM ready |\n| 24 | 0x002E | ANALOG_COMP | Analog comparator |\n| 25 | 0x0030 | TWI | 2-wire serial interface |\n| 26 | 0x0032 | SPM_READY | Store program memory ready |\n\nLower vector addresses have higher priority — RESET is highest, SPM_READY lowest. The global interrupt enable is bit 7 (`I`) in `SREG`, set with `sei` and cleared with `cli`.\n\n## Clock System\n\nThe ATmega328P supports six clock sources, selectable via the `CKSEL[3:0]` fuse bits. All clock options feed a common system clock prescaler that divides by 1, 2, 4, ..., 256 under software control (`CLKPR` register).\n\n| CKSEL[3:0] | Clock Source | Typical Frequency |\n| --- | --- | --- |\n| 0000 | External clock (CLKI pin) | 0 – 20 MHz |\n| 0010 | Calibrated internal RC oscillator | 8 MHz (factory-calibrated, ±1 % @ 25 °C / 5 V) |\n| 0011 | Internal 128 kHz RC oscillator | 128 kHz (low-power WDT clock) |\n| 0100–0101 | Low-frequency crystal oscillator | 32.768 kHz (RTC) |\n| 0110–0111 | Full-swing crystal oscillator | 0.4 – 20 MHz |\n| 1000–1111 | Low-power crystal oscillator | 0.4 – 16 MHz |\n\nThe default fuse setting ships the device running on the internal 8 MHz RC oscillator with a ÷8 prescaler → 1 MHz system clock. Writing `CLKPR = 0` selects the full 8 MHz. Switching to an external 16 MHz crystal requires reprogramming `CKSEL[3:0]` and `SUT[1:0]` fuses (Arduino bootloaders do this automatically).\n\n## Peripherals Overview\n\n| Peripheral | Count | Key Features |\n| --- | --- | --- |\n| Timer/Counter0 | 1 | 8-bit, PWM (OC0A/OC0B), external clock T0 |\n| Timer/Counter1 | 1 | 16-bit, PWM (OC1A/OC1B), input capture (ICP1) |\n| Timer/Counter2 | 1 | 8-bit, async (TOSC crystal), PWM (OC2A/OC2B) |\n| USART | 1 | Full-duplex, MSPIM mode, auto-baud |\n| SPI | 1 | Master/slave, 4 modes, up to f<sub>CPU</sub>/2 |\n| TWI (I²C) | 1 | Multi-master, 7/10-bit addressing, up to 400 kHz |\n| ADC | 1 | 10-bit, 8 channels (TQFP) / 6 channels (SPDIP), 13 – 260 µs conv. |\n| Analog Comparator | 1 | Bandgap reference, input-capture trigger |\n| Watchdog Timer | 1 | 16 ms – 8 s, interrupt + reset modes |\n| External Interrupts | 2 | INT0, INT1 (edge/level) |\n| Pin Change Interrupts | 24 | PCINT0–PCINT23 across PORTB/C/D |\n\n## Packages\n\n| Code | Package | Size | Lead Pitch |\n| --- | --- | --- | --- |\n| 28P3 | 28-lead Plastic Dual Inline (SPDIP), 0.300″ wide | 28 × 0.300″ | 2.54 mm |\n| 32A | 32-lead Thin Quad Flat Pack (TQFP), 1.0 mm body | 7 × 7 × 1.0 mm | 0.80 mm BSC |\n| 28M1 | 28-pad Very Thin Quad Flat No-Lead (VQFN) | 4 × 4 × 1.0 mm | 0.45 mm |\n| 32M1-A | 32-pad Thin Quad Flat No-Lead (VQFN, S4B) | 5 × 5 × 1.0 mm | 0.50 mm |\n\n### Ordering Codes (ATmega328P)\n\n| Code | Package | Temp Range |\n| --- | --- | --- |\n| ATmega328P-AU / -AUR | 32A (TQFP) | −40 °C to 85 °C |\n| ATmega328P-MMH / -MMHR | 28M1 (VQFN) | −40 °C to 85 °C |\n| ATmega328P-MU / -MUR | 32M1-A (VQFN) | −40 °C to 85 °C |\n| ATmega328P-PU | 28P3 (SPDIP) | −40 °C to 85 °C |\n| ATmega328P-AN / -ANR | 32A (TQFP) | −40 °C to 105 °C |\n| ATmega328P-MN / -MNR | 32M1-A (VQFN) | −40 °C to 105 °C |\n| ATmega328P-PN | 28P3 (SPDIP) | −40 °C to 105 °C |\n\nSuffix `R` = tape & reel. Suffix `N` = extended (105 °C) temperature grade. `MMH` leadframe uses NiPdAu finish.\n\n## Applications\n\n- Arduino Uno, Nano, Pro Mini, and compatible development boards\n- Hobby and educational microcontroller projects\n- Low-power sensor nodes and battery-operated devices (thanks to 0.1 µA power-down)\n- Motor control, lighting, and simple industrial automation\n- USB-to-serial gadgets, LED controllers, data loggers\n- Safety-critical timing with programmable watchdog + brown-out detection\n\n## Key Formulas\n\n### Speed vs. Supply Voltage\n\nThe maximum CPU clock frequency scales linearly with V<sub>CC</sub>:\n\n$$f_{CLK,\\,max} = \\begin{cases} 4\\ \\text{MHz} & 1.8\\ \\text{V} \\le V_{CC} \\le 2.7\\ \\text{V} \\\\ 10\\ \\text{MHz} & 2.7\\ \\text{V} \\le V_{CC} \\le 4.5\\ \\text{V} \\\\ 20\\ \\text{MHz} & 4.5\\ \\text{V} \\le V_{CC} \\le 5.5\\ \\text{V} \\end{cases}$$\n\n### I/O Switching Current Estimate\n\nCurrent drawn on a capacitively-loaded pin is approximately:\n\n$$I_{pin} \\approx C_L \\cdot V_{CC} \\cdot f$$\n\nwhere $C_L$ is load capacitance, $V_{CC}$ is operating voltage, and $f$ is the average switching frequency of the pin.\n", "author": {- "id": "695820315b5f1e4db2fcf602", "name": "Kyle Bergstedt", "email": "[email protected]" },- "visibility": {- "public": true+ "visibility": "public",+ "hero": {+ "type": "image",+ "path": "docs/hero.png" },- "hero": null, "sample_prompts": [], "discovery_triggers": [], "discovery_pitch": null, "metadata": {}, "created_at": "2026-05-28T05:36:47.222Z",- "updated_at": "2026-05-28T05:36:47.222Z"+ "updated_at": "2026-05-28T05:36:47.222Z",+ "description": "Microchip 8-bit AVR MCU, 28-pin DIP. 32 KB flash, 2 KB SRAM, 20 MHz, the Arduino Uno chip. Datasheet-verified.",+ "dependencies": {},+ "files": [+ "page.json",+ "README.md",+ "atmega328p.kicad_sym",+ "atmega328p.kicad_mod",+ "atmega328p.glb",+ "docs/hero.png",+ "docs/atmega328p-datasheet.pdf",+ "viewers/symbol.html",+ "viewers/footprint.html"+ ] }