Guide to Windows AVR Development Toolchains
Setting up Toolchain
Windows with avr-gcc
- two options: Atmel Studio vs WinAVR
- make sure to change your
PATH
variable with WinAVR to allow commands (make
,avrdude
,avr-gcc
) to be available without needing to type the entire path
Arduino IDE
Read below.
Using the Arduino
Flash Programmer + Chip (Arduino is the target)
Circuitry
The pins of the ATmega chip on the Arduino corresponds to the I/O pins exposed by it. All you need to do is find which Arduino pin associates with the chip pin.
Flashing
Arduino IDE
- The Arduino IDE is capable of running C code. It might need setting up.
- Download the AVR Programming Library and add it as a library in the Arduino IDE
- Fix up the portpins.h file
- Put the code in the IDE, include the header files by importing the library.
- Plug in the Arduino to the computer, click ‘Verify’ and ‘Run’.
avr-gcc
toolchain
Linux
Flash Programmer (Chip is External, Arduino is just the programmer)
Circuitry
Hook up the Arduino to the chip on the breadboard. Connect the essential six connections:
- VCC, GND, RESET, SCK, MISO, MOSI
Flashing
Arduino IDE
- Flash example code ArduinoISP (converts Arduino to Arduino In-System Programmer)
- Tools > Programmer > Arduino as ISP
- Tools > Board > Arduino Pro Mini
- Processor > ATmega168 (3.3V, 8MHz)
- Shift + Ctrl + U to upload
avr-gcc
toolchain
- Flash example code ArduinoISP (converts Arduino to Arduino In-System Programmer)
- Edit Makefile so it know how to use the Arduino programmer:
PROGRAMMER_TYPE = avrisp PROGRAMMER_ARGS = -b 19200 -P com5 # or whatever port it is
- Edit
MCU=atmega168
- Flash the code:
make flash
Flash Programmer (USBasp)
- Need to install driver with Zadig
- Some warning about sck, resolve by updating the firmware But need to solder on header pins for the programming mode switch with jumpers
https://www.instructables.com/USBASP-Installation-in-Windows-10/ https://zadig.akeo.ie/ https://forum.arduino.cc/t/usbasp-cannot-set-sck-period/96164/4 https://www.fischl.de/usbasp/ https://www.fischl.de/usbasp/Readme.txt
Jumpers
https://cs.uwaterloo.ca/~brecht/servers/docs/PowerEdge-2600/en/Pe6450/IT/4097Paa0.pdf https://maker.pro/forums/threads/what-is-a-jumper-cap-and-when-do-i-use-them.293037/ https://electronics.stackexchange.com/questions/74259/how-are-jumpers-used