Skip to content

renidotsh/all-about-avr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

All About AVR 🎛️

MkDocs License: MIT AVR-GCC GitHub Actions

The ultimate bare-metal AVR reference hub. Learn AVR microcontroller programming from scratch — no Arduino libraries, no external dependencies. Pure AVR-GCC with direct register access.


🎯 What Is This?

A complete, educational repository for mastering ATtiny85 and ATmega328P (Arduino Nano) at the register level. Every example uses raw AVR-GCC: <avr/io.h>, <avr/interrupt.h>, <util/delay.h> — nothing else.

📊 Chip Comparison

Feature ATtiny85 ATmega328P (Nano)
Pins 8 (6 I/O) 32 (23 I/O)
Flash 8 KB 32 KB
SRAM 512 B 2 KB
EEPROM 512 B 1 KB
Timers 2 (8-bit) 3 (2×8-bit, 1×16-bit)
ADC 4 ch, 10-bit 8 ch, 10-bit
UART USI (software) 1 hardware USART
SPI USI 1 hardware SPI
I²C (TWI) USI 1 hardware TWI
PWM 4 channels 6 channels
Clock Up to 20 MHz Up to 20 MHz
Voltage 2.7 – 5.5 V 1.8 – 5.5 V
Price ~$1 ~$2–3
Package DIP-8, SOIC-8 DIP-28, TQFP-32

🚀 Quickstart

1. Clone & Browse Docs

git clone https://github.com/yourusername/all-about-avr.git
cd all-about-avr
pip install mkdocs mkdocs-material pymdown-extensions
mkdocs serve
# → Open http://127.0.0.1:8000

2. Build & Flash an Example

cd examples
# ATtiny85 blink
make MCU=attiny85 TARGET=c/attiny85/gpio/blink_pb0

# ATmega328P blink
make MCU=atmega328p TARGET=c/atmega328p/gpio/blink_pb5

# Flash (adjust -P for your programmer)
make MCU=attiny85 TARGET=c/attiny85/gpio/blink_pb0 flash

📁 Repository Structure

all-about-avr/
├── docs/              # MkDocs documentation site (Material theme)
│   ├── common/        # Shared AVR basics: toolchain, fuses, debugging
│   ├── attiny85/      # ATtiny85 deep-dives: registers, peripherals
│   └── atmega328p/    # ATmega328P deep-dives: registers, peripherals
├── examples/
│   ├── c/             # Bare-metal C examples per chip
│   │   ├── common/    # Chip-agnostic examples (ifdef)
│   │   ├── attiny85/  # gpio/ timers/ uart/ adc/ sleep/ spi/ pwm/ ...
│   │   └── atmega328p/
│   └── assembly/      # AVR assembly examples
├── tools/             # Fuse calculator (HTML/JS), flash script
├── assets/            # Pinout SVGs, datasheet links
├── benchmarks/        # Performance data (cycles, power)
├── cheat-sheets/      # Quick-reference cards
└── .github/workflows/ # CI: MkDocs deploy + build checks

🔧 Prerequisites

Tool Install Command (Debian/Ubuntu)
avr-gcc sudo apt install gcc-avr
avr-libc sudo apt install avr-libc
avrdude sudo apt install avrdude
make sudo apt install build-essential
mkdocs pip install mkdocs mkdocs-material

macOS: brew install avr-gcc avrdude
Windows: Install WinAVR or use MSYS2.

📚 Topics Covered

  • GPIO: Digital I/O, pull-ups, port manipulation
  • ⏱️ Timers: CTC, PWM (Fast/Phase-Correct), overflow interrupts
  • 📡 UART/USART: TX/RX, printf redirect, baud calculation
  • 🔌 SPI: Master/Slave, USI on Tiny85
  • 🔗 I²C (TWI): Master/Slave, USI-based TWI
  • 📈 ADC: Single conversion, free-running, noise reduction
  • 💤 Sleep Modes: Idle, Power-Down, wake on interrupt
  • 🐕 Watchdog Timer: System reset, wake from sleep
  • 🔔 Interrupts: External (INT0/PCINT), timer, ADC complete
  • 🔧 Fuses: Clock source, BOD, RSTDISBL, lock bits

🤝 Contributing

See CONTRIBUTING.md for guidelines. TL;DR:

  1. Write bare-metal C (no Arduino libs)
  2. Add docs in docs/ + code in examples/
  3. Test on real hardware (or SimulAVR)
  4. Submit a PR

📄 License

This project is licensed under the MIT License.


⭐ Star this repo if you love bare-metal AVR!
Built with ❤️ for the embedded community

About

Everything about AVR architecture

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors