Skip to main content

Arduino Nano - Atmel MEGA328P

Pinout

Arduino-Nano-Pinout-Large.png

  • 5V - comes form USB-C VBUS and/or output of the regulator (VIN); MCU has operating voltage of 1.8 - 5.5V
  • VIN - goes to the regulator and can be maximum 15 V; minimum 5 + ~1.1 (dropout) for regulator to regulate; MCU should run with 2.9 V
  • 3V3 - output from USB-UART 
  • D13/PB5 is connected to LED
Schematics

1ee669b8983149d48d41557d41e3fcb1.png

Atmel MEGA328P

  • Clock: 16 MHz
  • Program Memory Size: 32 KiB
  • RAM: KiB
  • Data EEPROM: 1 KiB

atmega.jpg

Datasheet: ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061B.pdf

LM1117C 50 - 5V regulator

arduino_nano_lm.jpg

Datasheet: lm1117.pdf

CH340C - USB-UART

Datasheet: CH340DS1.PDF

Programming

Arduino / avrdude

Install IDE (and avrdude):

xi arduino

The board shows up on /dev/ttyUSB0 and can be programmed with CTRL-R (Compile/Verify) and CTRL-U (Upload).

Rust

cargo +stable install --locked ravedude
cargo install cargo-generate
cargo generate --git https://github.com/Rahix/avr-hal-template.git # Select: Arduino Nano New Bootloader

# May need specific compiler version to work (see rust-toolchain.toml)
rustup override set nightly-2024-03-22
rustup component add rust-src --toolchain nightly-2024-03-22-x86_64-unknown-linux-gnu

cargo build
RAVEDUDE_PORT=/dev/ttyUSB0 cargo run