11 novembre 2009

Bootloader Xmega

I received the prototype board (Stk600) for Atmel processor and started to play with it. The First step was to install a bootloader in the Xmega192a3.

Hum, that was more complex than I thought. Xmega world is still very new and I discover several problems: avrdude program (to flash the xmega) does not work under linux (pdi does not work), and bigger problem, the Xmega 192a3 has a bug which prevent its flash memory to be written directly.

So to workaround the "avrdude" problem on linux, I simply used XP and avr-studio 4.17. This is a recent version whcih support Xmega. Even if it not perfect, because the x192a3 is not yet in the compiler mcus list. But it is known in the uploader part of avr-studio.

Then for the second problem, I port on avr-studio (avr-gcc) the workaround from Atmel (application note 1008) which allows the flash to be self-written. Unfortunately, the workaround provided by Atmel was made for IAR (not avr-Gcc compiler) and was not a complete bootloader. So I had to port it and integrate in an existing bootloader port.

The first version I made did not work. Good opportunity to learn AVR assembly. So I redo and finally it worked ! Ouf , thanks to Atmel support which provided me this application note. My bootloader is here: bootloader Xmega 192a3.

The project files are included, and you need avr-studio v4.17 (free from Atmel). Serial port is port D and baud rate is 19200. See defines.h and compiler options before using. Once the bootloader has been installed, an application can be flashed with the command "avrdude -c avr109 -b 19200 ..." and other needed parameters.

Aucun commentaire: