Thursday, May 6, 2010

Micro Hex Bootloader for ATmega microcontrollers

New in 1.1 version:

The boot loader from microcontroller can report 5 different errors:
  1. LineDefError = One line is not have the defined destination.
  2. SecondHexCharNotFound = If first hex char is found but second hex char is not found or is not one hex char.
  3. CheckSum = If in one line is detected one check sum error.
  4. LineMismach = After conversion from hex to bin If total length line - 5 is not equal to data bytes contained by that line.
  5. NoMemorySelected = If user is trying to write in memory but the user is not sends the command to select Flash or EEProm memory.
Resources:
  • Flash = 852 Bytes For Atmega8( The fusible for jumping in boot loader is necessarily to set to 512 Words ).
  • Flash = 860 Bytes For Uart0 Atmega64-128( The fusible for jumping in boot loader is necessarily to set to 512 Words ).
  • Flash = 878 Bytes For Uart1 Atmega64-128( The fusible for jumping in boot loader is necessarily to set to 512 Words ).

From this moment the source code is ready to download for free.
To compile this boot loader is necessarily to use last ASM SDK.
This Bootloader has maximum 512Words(1KB) of flash and can work on controllers listened down:

ATmega48 Not Tested
ATmega48P Not Tested
Atmega8 Not Tested
Atmega8A Not Tested
ATmega88 Not Tested
ATmega88A Not Tested
ATmega88PA Not Tested
ATmega16 Not Tested
ATmega16A Not Tested
ATmega162 Not Tested
ATmega168 Not Tested
ATmega168A Not Tested
ATmega168PA Not Tested
ATmega32 Not Tested
ATmega32A Not Tested
ATmega64 OK
ATmega64A Not Tested
ATmega640 Not Tested
ATmega128 OK
ATmega128A Not Tested
ATmega1281 Not Tested
ATmega1280 Not Tested
ATmega2561 Not Tested
ATmega2560 Not Tested

Download Bootloader V1.1 ASM Source code and PC uploader C# source code.


First version V1.0

This is an utility that eliminate the ISP programmer for ATmega Microcontrollers and he work even on Windows Vista and Windows 7.

This boot loader is created to upload data in hex format no bin like others boot loaders, to convert from hex to bin is used an function integrated in boot loader not in up loader.

Version ( V1.0 ) is capable to write flash and eeprom (.hex and .eep) generated by AVR Studio and AVR GCC.

The .eep file is detected automatically by the program from the name of .hex file, for this reason is necessarily to select only .hex file.

When this boot loader is present on an ATmega microcontroller ,at reset is booting in boot loader and is programed to stay and wait for "BootInit" + Cr for entering in programed mode for 2 seconds, if "BootInit" + Cr is not received the boot loader jumps to address 0 in flash.

If communication is interrupted more than 2 seconds this boot loader jump to address 0 of flash.

The boot loader from microcontroller can report 4 different errors that can be appear:
  1. LineDefError = One line is not have the defined destination.
  2. SecondHexCharNotFound = If first hex char is found but second hex char is not found or is not one hex char.
  3. CheckSum = If in one line is detected one check sum error.
  4. LineMismach = After conversion from hex to bin If total length line - 5 is not equal to data bytes contained by that line.
Resources:
Flash = 952 Bytes For Uart1 ( The fusible for jumping in boot loader is necessarily to set to 512 Words ).

Down is ready to download 2 Hex demo files that contain the boot loader for ATmega64 at 16Mhz and 8Mhz at Baud rate 19200b/s for Uart1

Download PC uploader V1.0
Download BootLoader for ATmega64 8Mhz Uart1 19200b/s V1.0
Download BootLoader for ATmega64 16Mhz Uart1 19200b/s V1.0

2 comments:

Anonymous said...

Hi, had to make the following changes to make it work for atmega1280:
line 923 and 942:
IN R17, SPMCSR ; was lds R17, SPMCSR
line 967:
OUT SPMCSR, R16 ; was sts SPMCSR, R16
Found it very useful since it can process .hex files. Thank you very much.

Shazia Usman said...

I really appreciate you for all the valuable information that you are providing us through your blog.