Bringup
Open the editor
Microcontroller with real firmwareATmega328P-PUatmega328p

ATmega328P (AVR, Firmware)

ATmega328P on its own (as in the Arduino Uno), 16 MHz: runs Arduino sketches or AVR firmware (HEX/ELF).

VCCGNDPD0PD1PD2PD3PD4PD5PD6PD7PB0PB1PB2PB3PB4PB5PC0PC1PC2PC3PC4PC5RESETXTAL1XTAL2AREFATmega328P-PU
Schematic symbol

Key data

Category
ICs
Simulation model
Microcontroller with real firmware
Manufacturer part number
ATmega328P-PU
Reference prefix
U
Pins
26
Land pattern
DIP-28_W7.62mm

Notes

The firmware runs on an emulated CPU core, instruction by instruction. Peripherals that the model implements (GPIO, timers, UART, SPI, I²C, ADC and others, see the description) act on the pins of the circuit, so the analog parts around the chip see the same voltages and timing as on a real board.

  • The bare chip needs VCC, GND and decoupling capacitors on the board.
  • Right-click the part and choose "Open in code editor" to write and compile its code; "Serial monitor" shows its UART output.
  • In the inspector you can load a demo firmware or your own ELF / Intel HEX / BIN file instead.
  • GPIO pins are real circuit pins: an LED on an output needs a series resistor, an input needs a defined level (pull-up or pull-down).
  • The debugger in the code view stops at breakpoints and shows registers, variables and the call stack.

Simulation model

An emulated CPU core runs the firmware binary instruction by instruction. The GPIO pins are pins of the analog circuit: outputs drive through a driver resistance, inputs read the voltage with thresholds.

Device
atmega328p
CPU core
AVR 8-bit
Emulator
AVR emulator
Firmware
Arduino sketch compiled in the code view (arduino-cli, arduino:avr), or your own ELF / Intel HEX / BIN file
Flash / RAM for firmware
32 KB / 2 KB
Supply pins
VCC / GND
Mapped GPIO pins
21

Pins 26

simulatedreal chip onlyPin functions from the emulator and the datasheet.

PinNameFunctionsUse
VCCVCCSupply pinSupply 1.8–5.5 V (5 V for 16 MHz): 100 nF next to VCC and AVCC
GNDGNDGround pinGround
PD0PD0I/O pinUSART0_RXDSerial data in: from the TX pin of the other device
PD1PD1I/O pinUSART0_TXDSerial data out: to the RX pin of the other device (console, GPS, modules)
PD2PD2I/O pinINT0General-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
PD3PD3I/O pinINT1OC2BPWM output: LED dimming, servos, motor drivers
PD4PD4I/O pinT0XCKGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
PD5PD5I/O pinOC0BT1PWM output: LED dimming, servos, motor drivers
PD6PD6I/O pinOC0AAIN0PWM output: LED dimming, servos, motor drivers
PD7PD7I/O pinAIN1General-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
PB0PB0I/O pinICP1CLKOGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
PB1PB1I/O pinOC1APWM output: LED dimming, servos, motor drivers
PB2PB2I/O pinOC1BSPI_SSSPI chip select (SS): keep it an output while the SPI runs as master
PB3PB3I/O pinSPI_MOSIOC2ASPI data out (MOSI): to DIN / SDA / SDI of the device
PB4PB4I/O pinSPI_MISOSPI data in (MISO): from DOUT / SDO of the device
PB5PB5I/O pinSPI_SCKSPI clock: displays, flash, SD cards
PC0PC0I/O pinADC0Analog input: potentiometer, sensor voltage (0 V … supply)
PC1PC1I/O pinADC1Analog input: potentiometer, sensor voltage (0 V … supply)
PC2PC2I/O pinADC2Analog input: potentiometer, sensor voltage (0 V … supply)
PC3PC3I/O pinADC3Analog input: potentiometer, sensor voltage (0 V … supply)
PC4PC4I/O pinADC4TWI_SDAI²C data: pull-up (about 4.7 kΩ) to the supply
PC5PC5I/O pinADC5TWI_SCLI²C clock: sensors, displays; pull-up (about 4.7 kΩ) to the supply
RESETRESETInput pinRESETReset, active low: 10 kΩ pull-up, 100 nF to GND, optional button to GND
XTAL1XTAL1Analog pinXTAL116 MHz crystal with 22 pF to GND (or external clock in)
XTAL2XTAL2Analog pinXTAL216 MHz crystal with 22 pF to GND
AREFAREFAnalog pinAREFADC reference: 100 nF to GND; only connect a voltage here with the external reference selected

Parameters 1

Packagepackage
DefaultDIP28
DIP28TQFP32

PCB

Verified land patternDIP-28_W7.62mm
PackageLand patternStatusSource
DIP28 · ATMEGA328P-PUDIP-28_W7.62mmVerified land patternKiCad 10.0.7: symbol ATmega328P-P, footprint Package_DIP:DIP-28_W7.62mm
  • XTAL1 16 MHz crystal between XTAL1 and XTAL2, 22 pF each to GND (the simulation assumes 16 MHz)
  • XTAL2 16 MHz crystal between XTAL1 and XTAL2, 22 pF each to GND
  • RESET 10 kΩ pull-up to VCC (optional 100 nF to the programmer's DTR)
  • AREF 100 nF to GND (with AVcc reference)
TQFP32 · ATMEGA328P-AUTQFP-32_7x7mm_P0.8mmVerified land patternKiCad 10.0.7: symbol ATmega328P-A, footprint Package_QFP:TQFP-32_7x7mm_P0.8mm
  • XTAL1 16 MHz crystal between XTAL1 and XTAL2, 22 pF each to GND (the simulation assumes 16 MHz)
  • XTAL2 16 MHz crystal between XTAL1 and XTAL2, 22 pF each to GND
  • RESET 10 kΩ pull-up to VCC (optional 100 nF to the programmer's DTR)
  • AREF 100 nF to GND (with AVcc reference)