programming¶
We are going to be using Harvard Architecture (RISC)
microcontroller (different than microprocessor)
- ATtiny45v
- ATtiny412
AVR¶
The follow bash (terminal) commands should be run to setup a new macOS device for developing and programming AVR microcontrollers.
brew update
brew install make
brew tap osx-cross/avr && brew install avr-gcc
brew install avrdude
brew install avr-libc
xcode-select --install
Resources & Links¶
Make files - a program to compile c code into executable programs (HEX)
avr-libc - toolchain for compiling and making hex code files for microcontrollers
avrdude - program for programming microcontrollers
c programming language (reference book)
Summary¶
This process of programming requires that you have a main program file (i.e., main.c) and a Makefile to compile, generate a hex file, and flash the code onto the microcontroller using avrdude.
Install FTDI Drivers for macOS
Run make using the following code to program the board via Terminal.
make -f hello.ftdi.45.echo.make program-avrisp2
Arduino¶
Arduino as a toolchain to program ATtiny45v.
brew update
brew install arduino-cli
Summary¶
Install the Arduino CLI
Install the Arduino IDE
Link Additional Board Library: ATtiny (see below):
Install attiny board library into Arduino IDE and select to use attiny45 with the appropriate settings/parameters:
Then just open your .ino (sketch) file and upload sketch using programming (sketch menu). This does the same thing as running make in the command line but avoids having to using the command line.
Resouces & Links¶
Test and Edit Code¶
Serial Terminal¶
To test and verify that the code is working as expected on the board, I needed to install some type of terminal application on my computer. I decided to try and use pySerial (miniterm).
Arduino Tutorial: https://www.youtube.com/watch?v=Oi5mpWqeIDk&feature=youtu.be