Help needed with ATMega644P bootloader

I made my own Arduino clone board using a ATMega644P microcontroller. In the past, I used the AdaFruit 644P boatloader with no problems. Unfortunately the bootloader does not seem to work with the current Arduino IDE. I would really like to use my home-brew boards with the current IDE, since I need both USB and XBee communications in the projects I am working on.

When I try to use avrdude to install the ATmegaBOOT_644P.hex bootloader, I get the following error:

avrdude: verifying ... avrdude: 1 bytes of efuse verified avrdude: reading input file "ATmegaBOOT_644P.hex" avrdude: ERROR: address 0x1f010 out of range at line 2 of ATmegaBOOT_644P.hex avrdude: write to file 'ATmegaBOOT_644P.hex' failed

Any suggestions to resolve the bootloader issue would be appreciated.

Here is an image of my board in case anyone is interested: The board is not Arduino shield compatible, since I wanted to be able to wire the 8-bit data ports grouped in their logical structure.

I have never used the bootloader but I have used the mighty1284 core with a 644 before

you would have to modify the boards.txt to reflect a 644 (name and its 64k of program space instead of 128k) but outside of program memory and ram, they are the same chip

and signature bytes

watch for 644 vs 644a vs 644P I think only P has dual serial ports, check data sheet to be sure.

CrossRoads: I think only P has dual serial ports, check data sheet to be sure.


avrdude: ERROR: address 0x1f010 out of range at line 2 of ATmegaBOOT_644P.hex

That address is out of range indeed: it is > 64K.
Since the error is at line 2, I guess line 1 contains a so called “extended segment address record” (long live wikipedia). These are used to accomplish addressing over 64K. It are lines looking like this:

If line 1 looks like this, try deleting it. Or just post the hex file you use.

Recently I built optiboot_atmega644p.hex and flashed it to my sanguino rbk using ArduinoISP.
I used these command lines:

avrdude -pm644p -c avrisp -b 19200 -P /dev/ttyUSB0 -e -u -U lock:w:0x3f:m -U efuse:w:0xFD:m -U hfuse:w:0xDE:m -U lfuse:w:0xFF:m
avrdude -pm644p -c avrisp -b 19200 -P /dev/ttyUSB0 -U flash:w:optiboot_atmega644p.hex:i -U lock:w:0x2f:m

It worked fine.
I attached it, it is only 1.4K

optiboot_atmega644p.hex (1.44 KB)

I was running into the same error as the first one. Eliminating the first line of the hex file fixed that issue, but now I have a new one.

I've noticed that the verify step in the flash fails no matter what bootloader I try to load.

Using the optiboot hex file that was attached, my command is: avrdude -p m644p -C "[path to avrdude.conf]" -c dapa -P lpt1 -U flash:w:[path to optiboot_atmega644p.hex]

Avrdude appears to write and read normally, then says:

avrdude: verifying ... avrdude: verification error, first mismatch at byte 0xfc00 0x0f != 0xff avrdude: verification error; content mismatch

Then what's weirder is that the fuse bits have been changed, because the next thing it says is

avrdude: safemode: hfuse changed! Was de, and is now ff Would you like this fuse to be changed back? [y/n]

I am using Windows 7 and a parallel cable that I built. I suspect the cable could cause the issues and I have a usbasp on the way, but I'd really like to get it to work with the parallel cable. Any thoughts?

CrossRoads: and signature bytes

Where do I specify signature bytes? In boards.txt file?

I also need to update my 644p with Optiboot version via Arduino IDE (I don't have ISP). Sanguino boot-loader is horrendous :( Would changing boards.txt file and be sufficient or I need to do something else?

Signature bytes are in avrdude.conf. Copy the 1284 section or another 644 section with a new name and update the memory size and signature bytes. Make a new section in boards.txt to match.