Skip to content

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

Adafruit AVR Tutorial

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):

09%20Embedded%20Programming%20b245ee35437d4403a502930bc193a58a/Untitled.png

Install attiny board library into Arduino IDE and select to use attiny45 with the appropriate settings/parameters:

09%20Embedded%20Programming%20b245ee35437d4403a502930bc193a58a/Untitled%201.png

09%20Embedded%20Programming%20b245ee35437d4403a502930bc193a58a/Untitled%202.png

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.

Setup Arduino as an ISP

Anna K’s documentation

Neil’s programming video

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


Last update: May 5, 2021