Quick Start

Test that your board works

Aery32 GPIO pin map cheat sheet

Connect the Aery32 board to your computer with a USB cable. The LED on the board should turn on indicating that the preloaded program is running. To let your PC notice the presence of Aery32:

Now Aery32 has been started into a bootloader and your computer should spot a new device connected to it. If the slide switch was connected again to the default position, and the reset button was pressed, the preloaded program would start running again turning the LED on.

Installation

Step 1. Download the tools

Aery32 is based on Atmel AVR32 microcontroller, so all the essential tools are provided by Atmel. To complete this step, download and install the following pieces of software:

  1. FLIP in-system programmer. Requires 32-bit Java JRE, so install this too if not installed yet.
  2. Atmel AVR Toolchain for Windows

Step 2. Setup the USB driver

Go to the Device Manager (Control Panel » Hardware and Sound » Device Manager) and find AT32UC3A DFU from the list.

  • Right click to select Update Driver Software...
  • Select the second option which says Browse my computer for driver software
  • Browse to the Flip installation directory, default was C:\Program Files (x86)\Atmel\Flip 3.4.5
  • Press Next and when prompted press Install this driver software anyway

Step 1. Install dfu-programmer

$ sudo apt-get install dfu-programmer

Step 2. Install AVR 32-bit Toolchain

Follow How to install AVR 32-bit Toolchain on Linux instructions from Aery32 DevZone.

Step 1. Install Homebrew

First make sure that you have a properly maintained version of Homebrew. If you aren't sure, it's recommended to uninstall Homebrew first.

Before installing Homebrew install command-line tools for Xcode 4.4.1. Then edit /etc/paths and make /usr/local/bin occur before /usr/bin. You may edit the file by using nano, for example

$ sudo nano /etc/paths

Remember to restart your terminal instance afterwards!

Now you may install Homebrew with this magical command

$ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
$ brew doctor

Step 3. Install the required additional packages

$ brew install mpfr gmp libmpc texinfo
$ brew install libusb-compat 
$ brew install git

Step 4. Install AVR32 Toolchain from sources

$ cd $HOME
$ git clone git://github.com/jsnyder/avr32-toolchain.git
$ cd avr32-toolchain
$ PREFIX=$HOME/avr32-tools make install-cross

The last command above will take long. Be patient. When done you should see this

====== INSTALLATION NOTE ======
Your tools have now been installed at the following prefix:
$HOME/avr32-tools

Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc
export PATH=$HOME/avr32-tools/bin:$PATH

Step 5. Install dfu-programmer for chip programming

$ cd $HOME/avr32-toolchain
$ PREFIX=$HOME/avr32-tools make install-dfu

Step 6. Update your PATH

It is important to actually add the bin path of avr32-tools to your PATH variable for Aery32 Framework to work.

$ export PATH=$HOME/avr32-tools/bin:$PATH

Blink the LED demo

Download Aery32 Software Framework

Aery32 Software Framework is not a kind of software that would be installed as a regular software. Rather, it is only a set of source files and compiling instructions in a neatly packed structure.

First we have to create a new folder where to download Aery32 Software Framework. This folder can be for example named as workspace and placed in your documents folder, but feel free to select name and place to your liking.

After creating a folder, download the latest version of the framework. Then unzip the package to the folder you just created. Now you have a new folder that's aery32-latest/. You may want to rename it to correspond your project's name.

Modify the main source file

Let's open the main source file, which is main.cpp located under the project root. The file should look like this:


#include <aery32/all.h>
#include "board.h"

#define LED AVR32_PIN_PC00

using namespace aery;

int main(void)
{
	/*
	 * The default board initializer defines all pins as input and
	 * sets the CPU clock speed to 66 MHz.
	 */
	board::init();
	
	gpio_init_pin(LED, GPIO_OUTPUT);
	gpio_set_pin_high(LED);

	for(;;) {
		/* Put your application code here */

	}

	return 0;
}

Actually this is the program preloaded in Aery32 that turns its LED on. To modify the program in a way that the LED starts blinking, take your cursor into the interior of the for(;;) loop and write this:


for(;;) {
	gpio_toggle_pin(LED);
	delay_ms(500);
}

Now it's time to program the board. First make sure that the Aery32 is connected to your computer and started into the bootloader. To compile and upload your program into Aery32 board, open your Terminal window (or Command Prompt in Windows). Although, it may look scary in the first place it is very easy! There's no reason to be afraid of the command line. You can later switch to the integrated development environment or editor you prefer most.

In Windows the quickest way to access to the Command Prompt is to press Windows-key and R (Win+R) at the same time, and type cmd.

Change the directory to your project directory and command make program start, or in its shorter form
make programs. In Windows you should see something like this and before you even noticed the LED has started to blink.


Troubleshooting

MSVCR71.dll is missing ...

MSVCR71.dll is missing from your computer...

In Windows when running make programs, the in system programming (ISP) may be interrupted by the system error saying that "The program can't start because MSVCR71.dll is missing from your computer..." This happens because batchisp cannot find that file. If you already had or installed the Java JRE (Java Runtime Environment) during this Quick Start, you should have this file in your computer despite the error. For some reason, the file just is not accessible through the Windows' PATH environment variable. Most probably you can find MSVCR71.dll from C:\Program Files (x86)\Java\jre6\bin. You can also quickly search for the file when in command line

cd c:\
dir /s msvcr71.dll

Now either set the directory C:\Program Files (x86)\Java\jre6\bin, or where ever the dll was located, to your Windows' PATH environment variable, or you can simply copy the MSVCR71.dll into the bin folder in your FLIP installation directory, C:\Program Files (x86)\Atmel\Flip 3.4.5\bin.

Batchisp cannot find a Java Virtual Machine

Calling batchisp on Command Prompt gives an error Can't load jvm.dll. Check that you have the jvm.dll in your PATH. If this is already in place, then you most probably have 64-bit Java JRE installed. Batchisp does not work on 64-bit Java. Unfortunately. To fix this you have to install 32-bit Java as well. You don't have to remove the 64-bit installation, if you want to keep it.

dfu-programmer complains that there's no device present

In Linux when running make programs, dfu-programmer may complain that it cannot find any device to program

dfu-programmer at32uc3a1128 erase
dfu-programmer: no device present.
make: *** [dfu-program] Error 1

That's because your current user did not have adequate access to the usb device. To fix this, you have to change your udev rules.

/etc/udev/rules.d/80-usbprog.rules
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2ff8", GROUP="plugdev", MODE="0660"

Thanks to Wizzy for pointing this out in his blog.


© 2012-2013 Muiku Oy. All Rights Reserved.