AVR Programming

Here you can find different articles about programming the ATMEL AVR MPUs. I work with ATMEGA-controllers (mainly ATMEGA8) and evaluate my code usually with Pollin evaluationboard including Addon-Board, like it can be seen in the picture below.
The programming is done with the USBTinyISP by Adafruit.

Das Addonboard zum Evaluationsboard von Pollin

Ever if i face some bigger problems that i investigated a bit more to solve, i will write down some note here.

ATMEGA corrupt fusebits

The Fusebits in ATMEL-controllers are loved and hated. On the on hand side they offer an easy way to set properties of the microcontroller, on the other hand side they are quite confusing sometimes as setting a value is done by setting a bit to 0 and unset it means set the bit to 1. Additionally a detailed knowledge about what you are doing is needed to set the exact bit-combination that fits the purpose. Therefor it often happens that you tell a microcontroller "you got an external quarz" but then set the wrong frequency or other things. The result is that you lock yourself out of your microcontroller and cannot reprogram the controller - not even the fusebits.
But as at ATMEL there are smart guys they thought about a possibility to rescue such an "broken" microcontroller. Therefor you need another microcontroller. On this microcontroller you simply put a program, that keeps toggling one single Pin all the time and therefor gives a simple clock pulse:

PORTB ^= (1<<1);

In this example i toggle PIN 1 on Port B (PORTB)
Now you simply connect PB1 to XTAL PIN A of the Microcontroller to be rescued and connect the VCC- and GND-Pins to the appropirate Connectors.
One crucial thing to note is, that the ISP programmer has to know that it is not allowed to program as fast as usual but at maximum a quarter of the clock signal that is put into the broken microcontroller. Using -B 100 at 87 kHz was sufficient for me (the ISP-Speed X is calculated using 1000/1,5*B=X kHz - for example: 1000/1.5*100=9.8 kHz<1/4*87 kHz). Basicly now the rescuing controller is giving the clock signal vor the controller that shall be rescued and you now can reset the fusebits to the appropriate values by connecting the programmer and do the programming of the "broken" microcontroller.
You can find the whole Programm compilable at least for ATMEGA8 here:
taktgeber.tar.gz (5KB)
To calculate the appropriate Fusebitsettings the website engbedded.com is a great help.

News - Sidebar
Ableton MIDI CC automation
In the audio section I shortly describe a way to automate MIDI CC parameters in Ableton Lives Arrangement View.
The german tutorials about ClusterGL are now available in english: tutorials->ClusterGL.
Under projects->votingTool i have put an grails based live votingsystem online.
LaTeX tutorials
The german tutorials about LaTeX are now available in english: tutorials->LaTeX.
AVR tutorials
The german tutorials about AVR are now available in english: tutorials->AVR.
Audio tutorials
The german tutorials about Audio are now available in english: tutorials->Audio.
ARM tutorials
The german tutorials about ARM are now available in english: tutorials->ARM.
new Design
Today Max had a nice present for me - a new design :) Thanks!
Today i took my time to translate the german Entry for ROBERTA - a small research project i participated at. More translations to come...
new sidebar
News will be placed here.

Valid XHTML 1.0 Strict CSS ist valide!