[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] boot loader for atmega163

From: Bryce Denney
Subject: Re: [avr-gcc-list] boot loader for atmega163
Date: Mon, 4 Mar 2002 10:19:56 -0500 (EST)

Ok, the avr-gcc boot loader patches are completed.  One more bug turned up
in AVR109, that caused chip erase to only erase 0-0x3ff on the atmega163.
Find them at:


I mentioned the "multi-word write" feature before, and I've done some more
extensive testing on it.  I wasn't expecting this exactly, but it turns
out that with a boot loader and the multi-word write patch, you can
download code significantly (5-10x) faster than with the usual AVR910
protocol at the same baudrate.  Multiword write reduces the total number
of bytes sent, and the number of times that one side must wait for the
other side to respond.  It works on the atmegas because you can take
advantage of the hardware uart to receive data even while self
programming, and because writing the temporary page buffer is so fast that
it can handle a stream of writes without any delays.

To test its performance, I measured the time required to program 8K of
flash, using different baud rates, and using different serial port
download methods.  The uisp programming software was used for all cases.  
Without multiword writes, it seems to plateau at around 86 sec, while with
multiword it continues to speed up with the baud rate.  Note that a 2400
baud download with multiword write is nearly twice as fast as a 19200 baud
download without it.

                   AVR109         AVR109 w/
Baud    AVR910     boot loader    multiword
rate    download   download       patch       Speedup
------  --------   ----------     ---------   -------
2400               258.7 sec      46.8 sec     5.5x   
4800               171.6 sec      24.4 sec     7.0x   
9600                86.3 sec      12.6 sec     6.8x   
19200   88.3 sec    86.3 sec       8.0 sec    10.8x

I don't know how this compares to parallel port programmers, but I expect
it's faster.

I tried to add multiword write to the AVR910 code, but eventually realized
that it just can't keep up with a stream of serial data because it does
the UART and SPI code in software with no interrupts.  So I gave up on

In conclusion, I hope that my work makes boot loaders more accessible to
AVR users, and avr-gcc users in particular.  I would like to get the
avr-gcc port of avr109 moved to some AVR site where people will be able to
find it, instead of in a dark corner of the web (on my server), but I just
don't know where to ask.  I've submitted the app note patches to Atmel,
and the uisp patches to Marek Michalkiewicz.  But the port to avr-gcc....?

Let me know if you have any problems.
Bryce Denney

On Thu, 28 Feb 2002, Bryce Denney wrote:
> I finally got an AVR boot loader working in an ATmega163.  The code is
> basically a port of the AVR109 example code to avr-gcc with a few
> problems resolved.  Then I made some optimizations. :)
> I'd like to share the work I've done, but am not quite sure who to send it
> to.  Does anyone maintain an updated AVR109?  I have the impression that
> Atmel doesn't update their application note code very regularly.  In the
> meantime, I've broken up the changes by concept into a few patches.  
> Patches #1 and #2 are ready right now on my web site.  #3 and #4 are
> working here, but I want to clean them up some more before posting them.
> 1. patch.port-to-gcc      (apply to avr109)
>    Apply to the original avr109 code from atmel site, and it will compile
>    in the avr-gcc environment.  See the readme inside the patch for gory
>    details.
> 2. patch.version-num      (apply to avr109)
>    Return software version 2.3 instead of 1.0 so that programmer software
>    knows it can use autoincrement feature.  Also return 1.0 for hardware
>    version instead of undefined.
> 3. patch.mword-write      (apply to avr109)
>    Add programming command for multiword writes, up to 32 sequential
>    16-bit words in a burst.  Of course your programmer software has to
>    support it, so I added code to uisp to buffer up consecutive writes so
>    that 32 words can be written in one command (see #4).  My application
>    uses a 2400 baud IR link, and this gave me a 10x improvement in code
>    upload speed.
> 4. patch.uisp-mword-write    (apply to uisp sources)
>    Adds support for multiword writes to uisp. Requires #3.
> My latest patches can be found at http://tlw.com/bryce/robot/avr
> Comments or suggestions welcome.  If you know of similar projects, please
> let me know.
> Regards,
> Bryce
> avr-gcc-list at http://avr1.org

avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]