how to (almost) make (almost) anything


embedded programming


it's lit.

Look what I can do!

I may have unintentionally completed this assignment at the end of week 5, but this week I wanted to make sure that I could program from my own set up instead of relying on the shop computers and components and I wanted to try different programs in different programming environments to change the behavior of the board.

First, I installed CrossPack, which is, according to the website, "a development environment for Atmel’s AVR® microcontrollers running on Apple’s Mac OS X, similar to AVR Studio on Windows. It consists of the GNU compiler suite, a C library for the AVR, the AVRDUDE uploader and several other useful tools." There are a lot of acronyms and jargon getting thrown around this week, so I took some time to try and get a high-level understanding about WTF was going on.

Running Glossery

Atmel is/was a semiconductor manufacturer.
Microcontrollers are small computers on a single metal-oxide-semiconductor chip and contain one or more CPUs (processor cores) along with memory and programmable input/output peripherals.
AVR is a family of Atmel microcontrollers (probably) named for its Norwegian developers: Alf and Vegard's RISC processor.
RISC is a Reduced Instruction Set Computer that uses a small set of simple and general instructions.
GNU is a network of free software and the project is hilariously (/sarcasm) and recursively named GNU is Not Unix.
AVR-GCC is a GNU Compiler Collection that converts a high-level languate (e.g. "C") into the target assembly language of an AVR microcontroller.
AVRDUDE is a is a program for downloading and uploading the on-chip memories of Atmel’s AVR microcontrollers.
AVR-LIBC is a library containing macros, type definitions, and functions for tasks in the AVR development environment and includes many functions found in a Standard C Library.
ISP is In-System Programming and is a feature of certain microcontrollers to be programmed in situ rather than as a seperate process.
FTDI is Future Technology Devices International and is semiconductor device company that manufactures devices and drivers for converting legacy signals to USB technology, for example.

I am still unclear if CrossPack did anything, but I found a link from a previous year to a tutorial to install avr-gcc and avrdude via a package manager for OSX called Homebrew and followed the instructions.

check

After following the instructions, I confirmed that avrdude had installed by typing avrdude -v in the Terminal command line to check the version. The tutorial includes an example to make sure everything installed successfully.

test code

I copied the code from the website and created a new .c file in Atom, the text editor I have been using this semester. By blindly copying the example commands, I was able to generate hex code for an ATmega32 AVR microcontroller. I did not do anything with this code, but it confirmed that the setup seemed succesful.

sure.

I bought an FTDI cable to complete my setup and to begin programming. This time, I tried the Arduino editing environment so that I could simply change a few lines of pre-existing code to alter the behavior of my board.

I followed a tutorial to program an ATtiny with the Arduino developer environment. The first step was to install the ATtiny support by pasting the following link:

https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json

into Preferences > Additional Boards Manager URLS .

Preferences > Additional Boards Manager URLS

The next step was to install the ATtiny boards package from the Tools > Board > Boards Manager... menus.

Tools > Board > Boards Manager...

After installing the package, the ATtiny24/44/84 board appeared in a subheading of the Tools > Board menu labelled ATtiny Microcontrollers along with ATtiny25/45/85.

Tools > Board > ATtiny24/44/84

I selected the ATtiny44 processor from Tools > Processor.

Tools > Processor > ATtiny44

I selected the external clock from Tools > Clock.

Tools > Clock > External 20 MHz

I selected the programmer from the list of devices in Tools > Ports.

Tools > Port > Not my iPhone

Finally, I selected the programmer from Tools > Programmer .

Tools > Programmer > USBtinyISP

In order to program the board, I used the example file "Blink" as a template.

File > Example > 01.Basics > Blink

I referenced the pin configuration of the ATtiny44 so that I could change the example file to match my as-built board configuration in which I had connected the LED to Pin 8 (in position 5 of the microprocessor).

Pin numbers do not match their positions

By default, the LED should have been cycling on for 1000ms and off for 1000ms.