
Atmel's AVR microcontrollers have a RISC core running single cycle instructions and a well-defined I/O structure that limits the need for external components. Internal oscillators, timers, UART, SPI, pull-up resistors, pulse width modulation, ADC, analog comparator and watch-dog timers are some of the features you will find in AVR devices.
|
AT90S8515 | |
|
ATmega16(L) | |
|
AT90USB64x / AT90USB128x |
|
AVR Instruction Set |
AVR-GCC ist ein kostenloser C-Cross-Compiler für AVR-Mikrocontroller. Die Windows-Installation wird auf dieser Seite beschrieben.
AVRStudio ist ein Assembler und Debugger für AVR-Mikrokontroller von Atmel. Neuerdings kann auch AVR-GCC im AVRStudio integriert werden. Dazu muss AVR-GCC vorgängig installiert sein. Beachten Sie, dass Sie den neusten Service Pack für AVRStudio auch herunterladen und installieren.
Für den AVR gibt es eine C-Bibliothek, die avr-libc. Die Bibliothek wird von WinAVR benutzt und ist in WinAVR enthalten. Die folgende Liste zeigt einen Teil der Funktionalität der Bibliothek: Startup-Code, AVR spezifische IO Definitionen, Watchdog Handling, Standard IO, mathematische Funktionen, Interrupts, CRC Berechnung, Delays, ...
Die Dokumentation, welche auch eine gut FAQ Sammlung, generelle Informationen und Beispiele enthält, finden Sie auf der avr-libc Doku-Seite. Ein PDF der Doku ist ebenfalls in der WinAVR Distribution enthalten.
AVRStudio beinhaltet einen guten Debugger, welcher für Assembler und C-Code (WinAVR muss installiert sein), verwendet werden kann. Eine Alternative ist die Verwendung des GNU Debuggers GDB, welcher in Eclipse integriert werden kann (Link) .
Je nach Mikrokontroller-Typ stehen unterschiedliche Schnittstellen für das Herunterladen und zum Debuggen zur Verfügung. Die unterstützten Schnittstellen sind in der Beschreibung zum jeweiligen Mikrokontroller und im Datenblatt aufgeführt.
ISP: In System Programming
Über den ISP (oder JTAG) Port kann der Mikrokontroller programmiert werden. Mit diesem Verfahren können auch Fuse-Bits verändert werden. Der STK500 Entwicklungskit ( „Entwicklungs Kit“ ) hat einen ISP Programmer integriert.
Der JTAG-Port wird für das Programmieren, Debuggen und Testen verwendet. Nicht jeder AVR Prozessor hat eine solche Schnittstelle. Um die JTAG-Schnittstelle benutzen zu können, wird spezielle Hardware benötigt. Ein günstiger JTAG ICE-Adapter kann von Olimex gekauft werden. Allerdings unterstütz dieses Modell nicht alle AVR-Typen mit JTAG (z.B. AT90USBxxxx). Der einiges teurere Atmel JTAG mkII Debugger unterstützt alle Typen. Beachten Sie, dass die Pinbelegung je nach Typ unterschiedlich ist.
debugWire
Das debugWire On-chip Debug System benutzt eine 1-Draht bidirektionale Schnittstelle um den Programmfluss zu kontrollieren, AVR Instruktionen auszuführen oder nicht-volatiles Memory zu programmieren. Um diese Schnittstelle zu verwenden, ist der teure Atmel JTAG mkII Debugger (~450 CHF) nötig.
Am Beispiel des ATmega16 wird erklärt, welche Tools und Schnittstellen verwendet werden können.
Will man den ATmega16 nur programmieren genügt ein ISP-Programmer. Dazu kann zum Beispiel der STK500 Entwicklungskit verwendet werden. Für das Debugging muss die JTAG Schnittstelle und entsprechende Hardware verwendet werden. Zur Auswahl stehen der billige JTAG ICE Adapter von Olimex oder der teure Atmel JTAG mkII Debugger. Zu beachten ist, dass der JTAG-Port über Fuse-Bits abgeschaltet werden kann. Ist dies der Fall, ist die einzige Möglichkeit, die JTAG-Schnittstelle über ISP wieder zu aktivieren. Als Debug-Software kann der im AVRStudio integrierte Debugger mit installiertem WinAVR benutzt werden. Falls nur Assembler programmiert wird, ist WinAVR nicht nötig.
Das Atmel AVR STK500 Entwicklungssystem für Atmel's AVR Flash Mikrocontroller bietet die Möglichkeit, diverse AVR Typen zu programmieren und Schaltungen auszutesten. Die flexible Verwendungsmöglichkeit bringt es mit sich, dass die Verdrahtung nicht ganz einfach ist. Einen guten Überblick wird im STK500 User Guide gegeben.
|
STK500 User Guide | |
|
STK500 Schema | |
|
JTAG ICE |
This project aims to provide a easy to use USB experimental board for students of the first year. Instead of only using the standard log for their (yet simple) programs, they are able to integrate hardware into their applications, which makes programming more interesting. The project provides a Java API to access the hardware such as display, flash, ADCs, etc. on the target board over USB from the PC. This approach requires a high level of abstraction to make it possible to use a simple but flexible Java API hiding the hardware and communication details.
For advanced students, firmware based on the existing framework can be developed on the microcontroller and downloaded over USB or JTAG.
For communication and controlling the hardware a Atmel AT90USB1287 USB microcontroller is used. The following hardware components are accessible on the board:
3x12 Characters I2C/TWI LCD Display
Serial Interface (UART)
32 Mbit Serial Flash Memory (SPI)
4+1-Way Joystick
Loudspeaker
Microphone
Light Dependent Resistor (LDR)
Thermal Resistor (NTC)
4 LEDs
6 Buttons

|
Installationsanleitung Eclipse und AVR-Plugin | Download (pdf) |
|
Programmierung mittes Eclipse | Download (pdf) |
|
Schema | Download (pdf) |
|
Port Assignment | Download (pdf) |

The communication with the device is based on the Java libusb wrapper.
Each hardware component is represented by a Java class. Prior to using the class, the connection to the USB device must be established. The following code snippet shows how to write a string to the Display using the Display class.
// create and open the USB device
Device dev = DeviceFactory.getDevice();
dev.open();
// create and initialize the display
Display disp = new Display(dev);
disp.init(true, true, true);
// write a string to the display
disp.write("Hello World");
// close the USB device
dev.close();
More information can be found in the
javadoc.
To test your device you can use the test application AVRExpboard TA . To use this program the Inf USB Library must be installed.
