I built my own bootloader. After every reset it waits for about 0.2sec if a magic was received over the UART. If not, it jumps to 0x0000 to start the user application. The bootloader was completely silent, only the additional 0.2sec reset time tells it was present. The baud rate was automatically detected (1200...115200Baud). At high baud rates a standard crystal e.g. 7.3728MHz or so was suggestet. Otherwise use a lower baud rate, if problems occur. For fast programming I wrote my own command line tool, which can easy be called inside the make file or the compile batch After calling, this tool sends permanently the magic until the ATMega answers. So first start this tool, then press the reset button on the ATMega.
At 115200Baud the programming time was:
15kB (ATMega16): | 2.8sec |
7kB (ATMega8): | 1.5sec |
The bootloader occupy the upper 1kB, thus 15kB on the ATMega16 available for the application. The bootloader read back the former content of a page and check if a new write cycle was needed or not. Overwriting the same content was suppressed.
You can use the ATMega with a crystal or the internal oscillator. Since the baud rate was automatically detected, the internal oscillator was suffcient also. For the connection to the PC a RS-232 level shifter was needed. I suggest the MAX202, since it need only 100nF caps for the internal voltage doubler and inverter.
To invoke the bootloader, connecting a reset button was suggested.
The Bootloader was written in assembler to have full control over all needed special options and to need only a minimum of flash size.
The PC software was written in C and compiled as DOS application with BC2.0. It runs fine under Windows98SE and Windows NT4.0. I use no further Windows versions so I can not tell, how it works on these or if additional drivers are needed.
The bootloader was teset on the ATMega8, ATMega16, ATMega162 and ATMega323. The fuse bits must be set to start on the boot start address, which reserve a boot sector of 512 words. Furthermore you should also enable the brown out reset fuse to get always a reliable reset behaviour.
The PC program support only programming today. The hex file name must be given after the /P switch. An additional EEPROM file can be given after it separated by a comma. E.g.:
pboot.exe -c1 -b115200 -ptest.hex,test.eep |
A more verbose description would follow at later time.