Mittwoch, 12. Dezember 2012

How to set up Atmel Studio 6 for the use with Teensy on Windows

This Tutorial should work for Teensy 2.0 andalso Teensy++ 2.0

First install follwing software in this order:
Arduino Software
teensyduino + Windows Serial Installer
Atmel Studio 6.0 with Service Pack 2 (build 1996) Installer [Dont download Full]
Download the File Teensy_loader_cli.exe and save it in c:\windows\system32\

 Make alle Updates for Atmel Studio (Gallery + Framework)

Now start Atmel Studio 6.

Now there are two ways.

1) configure everything by hand:

Words between braces are Placeholder and can be renamed
e.g.: [ProjectName] = The Name of your project.

Create a new Project:
New Project -> GCC C Executable Project -> [ProjectName]
As Device select "ATmega32U4"

Open the project properties:

Project -> [ProjectName] Properties

This step is optional, but saves a little time while compiling:
Toolchain ->AVR/GNU Common - > Output Files -> deactivate everything except .hex

Toolchain -> AVR/GNU C Compiler -> Symbols
Click on "add new defined symbol" and type: F_CPU=16000000UL

Again, open the project properties and change the post-build
Build Events -> Post-build command line (the following commandline is one line. There is no line break)
"$(SystemRoot)\system32\teensy_loader_cli.exe" -mmcu=atmega32u4 "$(OutputDirectory)\$(OutputFileName).hex"

Now you can start programming. (Hint: Each variable with the attribut PROGMEM must be declared as cons. i think this is because atmel studio has a more strict compiler..)

If you finished coding, plug in your teensy device and press the little button on the device (bootloader mode). when you code compiles without errors, the post-build command will try to load your compiled program on the teensy.

If there is no teensy plugged in, the post build will exit with an error, which you can just ignore.

If you don't want your teensy to reboot automatically after loading your program to it, simply add " -n" at the end of your post-build.

This should also run with Teensy++ 2.0. Just change the device (Project Properties->Device) to AT90USB1286

2) Download the Project-Template for Teensy 2.0
Save the complete ZIP-File in the following directory

Windows XP: "%userprofile%\My Documents\Atmel Studio\Templates\ProjectTemplates"
Windows 7: "%userprofile%\Documents\Atmel Studio\Templates\ProjectTemplates"

Don't unzip the File, just copy.

If you create a new Project, you can chose the Template "Teensy2.0", where everything is preconfigured.

Happy coding.

1 Kommentar:

  1. This template seemed to have problems with setting F_CPU and with the Post-Build Event required for programming.