Using AVR Microprocessors At CCRMA Under Win32

Pascal Stang, May 2005 (Based heavily on the AVR/OSX guide written by Matt Wright)

This document explains how to prepare your Win32 PC (PC running Windows98, Windows2000, WindowsXP) for AVR software development at CCRMA. This is primarily intended for people who have done AVR development under the Planet CCRMA Linux environment, and who now wish to do development on their own Windows PCs. This guide is designed for those involved in CCRMA's 250a class or Human-Computer Interaction summer workshop), but it may also be useful to others.

Contents


Win32 Software needed for AVR development

There are many ways to obtain the full set of tools needed to do AVR development on the PC. This guide strives to present the easiest way set up a fully-functional AVR development environment. Below is a list of the required software tools that you will be installing. The CCRMA version is the one presently supported by CCRMA. Where possible, links to orginal sources are also given.


Installation Steps

To install all of the required tools, you will need about 80MB of disk space. You will also need to choose a HOME directory on your Windows PC. This directory will have the same structure as the HOME directory of your CCRMA linux account.

  1. Download the following required files (CCRMA versions from above):
  2. Run the WinAVR installer.
  3. Add a windows environment variable that points to your new HOME directory.
    For most versions of Windows:
  4. Download AVRlib and place in your home directory.
  5. Install Atmel AVR Studio. [web]

Why those particular directories?

It's a good idea to put the WinAVR tools in a directory path that has no spaces because spaces can cause problems with unix command-line parsing.

It's a convention at CCRMA that avrlib lives in each user's home directory, so if you put avrlib in your designated windows HOME directory, you have less to change when you copy over AVR projects from your CCRMA Linux account.


USB-to-Serial Converters

Many modern PC/x86 computers no longer come with serial ports, so you may have to use a USB-to-Serial adapter. I've personally had success with the Keyspan UPR-112 and the Keyspan USA-19 devices, and a lack of success with an unlabeled generic device known as "Prolific" or "BF". I've heard that in general these tools work only with Keyspan hardware; please let me know [matt at CCRMA] of your experiences with other hardware. If you're physically at CCRMA in spring of 2005, you're welcome to borrow one or both of my serial to USB devices.

All of these USB devices require drivers, which generally come on a CD when you buy the device, but are also available for download from the manufacturer's website (for example, http://www.keyspan.com/downloads/win).

Once you install the driver and plug in the USB device, it will appear as a standard COM port. You can see which COM number has been assigned to your USB-serial adapter by checking in the Windows Device Manager.


osc serial: avr to pd

To get the AVRmini to talk to Pd on your Win32 machine via OSC over Serial over USB at this time is not trivial. However, there are several hacks....


CBI and SBI Macros

Many of CCRMA's example programs use macros including CBI and SBI to clear and set individual bits of I/O ports. These old macros are now no longer supported by avr-libc, so if you've got a recent enough version of avr-libc to not include those macros, make sure you have a recent enough version of Pascal Stang's avrlib (March 2005 or later) that does include them.

The silver lining is that the AVR toolchain now supports this programming style for reading and writing individual bits from I/O ports, which I personally prefer:

PORTA = 0x01;
PORTB |= 0x02;
PORTC &= ~0x04;
var = PIND;