Table of Contents

Microcontroller resources

The class uses an AVR32 microcontroller from Atmel, specifically, the UC3B type controller AT32UC3B1256, mounted on a small development board based on the successor of the copper board developed by StackFoundry, called bronze_v2, developed by Daniel Fasnacht.

The copper board

The Atmel USB chip is a high-performance Atmel 32-bit CPU optimized for small code size: (AVR32UC3B1256: 256KB flash, 32KB RAM, full-speed USB, 60MHz CPU clock, and lots of features like GPIOs, ADC, DAC(PWM), Timers, USART, I2C and even a 16-bit stereo audio out.

The two really cool things about this device are:

Tool installation

Additional development tool installation guides are available from, but do not install the Atmel tools from Atmel; use the downloads as instructed below from attachments to this page.

To communicate with the copper|bronze USB board, we use Python (the python tutorial) and pyusb (pyusb tutorial). Underlying pyusb is the USB driver which is libusb. Again, see for detailed instructions to develop code, program the controller's flash, and communicate by USB to the board. You will be confused by a large number of versions of these tools if you try to install without following these instructions. For faster download, some of the necessary files are below.

The tool setup is quite lengthy since you need to set up

  1. the development tools,
  2. the example project,
  3. the USB device driver,
  4. the firmware DFU programming tools,
  5. the host side python environment
  6. and the python USB package.

You will need to follow the following steps, referring to for more details.

  1. Install the AVR32 Studio IDE using the IDE from the attachments below. Do NOT install the latest AVR-Studio 5.1 from Atmel. We will be using avr32-studio 2.7x.
  2. Start AVR32 Studio (don't install the USB drivers it offers to install). Import Daniel’s usb-rgb-ldr example project (see attachments below) into AVR32 Studio using the File/Import…/General/Existing projects into workspace option. Use all defaults for project import.
  3. In AVR32 Studio, build the project with ctl-B or using Project/Build all. If there are build errors, check that the device is set properly. Right click on the usb-rgb-ldr project in the left explorer pane, select Properties, select C/C++ Build/Settings, then scroll the panels using the right arrow button to the right to the hidden one called MCU Settings. Select the AT32UC3B1256 from the list of UC3 devices. This should fix the build problems. If not, re-import the project, making sure you are selecting the folder usb-rgb-ldr that contains the .cproject file; this folder is the eclipse project.
  4. Install the Device Firmware Update (DFU) tool called Flip. This installs the command line tool batchisp used by AVR32 Studio when you run a “target” to program the board. Restart AVR32 Studio after installing Flip.
  5. Plug in a 'bronze' or 'copper' board - but don't install a driver yet.
  6. In windows, install the libusb USB driver by downloading the archive, extracting it, and running the bin/inf-wizard.exe program to generate the driver and install it. Note you will need to eventually generate and install two libusb driver instances: one for the device in DFU state and the other running your application. These will have different PID (Product Identifcation) numbers.
  7. In AVR32 Studio, make a new target (lower right corner window) that programs the board using the USB bootloader DFU. Let's call it “DFU”. In the DFU details choose the USB DFU target and the AT32UC3B1256 chip.
  8. Put the device in DFU state by holding down the RST (reset) and DFU buttons, then releasing RST, and then finally releasing the DFU button. The device is now ready for programming.
  9. Program the sample copper board with usb-rgb-ldr. Select the usb-rgb-ldr.elf binary device file in the project's Debug folder. Choose to Execute after programming and also Erase before programming. If you get a complaint about a missing batchisp you haven't installed Flip or batchisp is not on your path. If you installed Flip, maybe you forgot to restart AVR32 Studio. You will not see anything happen yet because the device needs to communicate over USB. But if you look in the console for programming you should see success there, along with a warning about overlapping code segments, which you can ignore. To find the console output from batchisp, hunt around on the top right of the Console tab for the icon that looks like a monitor and select from this pulldown the appropriate console.
  10. Install python and pyusb, so that you can run the python script. We are using python 2.6; in general you cannot use a different version of python.
  11. Run on the host. The firmware usb-rgb-ldr runs on the sample copper board. With LDR and RGB LEDs added you will be able to see it working; you can use the sample board to test this. To run rainbow, you can either start the python shell, open, and run it from the python editor (IDLE). Alternatively, you can import the rainbow project to eclipse (in this case as a python project) and set up the python interpreter environment to use your installed python; point the interpreter to python.exe in your python26 installation (by default in c:\python26). Then you have the comfort of running rainbow from within eclipse. If you don't have your avr32 plugged in, or have not programmed it, rainbow will not be able to open the usb device with VENDOR = 0x03eb and PRODUCT = 0x2300, and you will see a (cryptic) message something like AttributeError: 'NoneType' object has no attribute.'open'. Good luck!

Starting a new project

You might want to start with an existing sample project. Then you will run into the problem that there is no “user_board.h” for the AVR32 board. Please see the sample code below for sample header files for the AVR32 bronze board.


See the following documentation for more information. Remember we are using the AT32UC3B1256.

Within AVR32Studio, use the Help/Help Contents menu to open the built-in help. Then, within the document, navigate to the AT32UC3 Software Framework/Drivers section; there you will see sections for each peripheral, as illustrated below.

AVR32 ATUC3 software framework reference section

Using eclipse

  1. See this post for useful keyboard shortcuts in eclipse, particularly ctl-shift-l for the popup showing you shortcuts.

See also the attached reference documents.

Important note for (old) copper board DFU

You may find that the copper board does not properly enter its application program and always boots up after reset or power on in “DFU” mode (Device Firmware Update mode). That happens because by default the PUER (Pullup Enable Register) does not enable the GPIO internal pullup resistors of 5-25k (nominally 12k) Ohms on the port pins, and the leftover internal pullup resistance on pin PA13 is not sufficiently small to pull the logic level to Vdd, so the AVR32 thinks it should go into DFU mode. You can easily correct this by soldering on the copper board or wiring on the breadboard a resistor of 10-20k Ohms from PA13=pin 25 to 3.3V Vdd. Then on reset PA13 will be held high and the application program will start. The bronze board has this pullup resistor added on the board.

Example firmware


For installers, please see the FTP download area at


There are reports that the downloads below are corrupted and that install of AVR32 studio cannot be completed.