Page 1 of 1

AVR-Doper problems prog ATMEGA2561

Posted: Thu Apr 26, 2007 5:21 pm
by PycLan
Hi.
At programming ATMEGA2561 Flash up to 127,9 kb all OK.
If it is more 127,9 kb the program in the controller does not work.
It is a problem AVR-Doper?
Thanks.

Posted: Thu Apr 26, 2007 6:16 pm
by christian
AVR-Doper is not compatible with devices larger than 128 kB. The ISP protocol we have implemented only supports 16 bit word addresses.

If you know how to extend this protocol, please provide a patch. See the file isp.c in AVR-Doper's firmware source code and search for "stkAddress". This yields all places where the device address is accessed. These should be extended to more than 16 bits where applicable.

Posted: Fri Apr 27, 2007 10:12 am
by PycLan
Well, I've found the declaration of stkAddress

Code: Select all

typedef union{
    unsigned long   dword;
    uchar           bytes[4];
}utilDword_t;


What should I change here to solve the problem?

Posted: Fri Apr 27, 2007 1:07 pm
by ahulap
In avr068.pdf there is a note about address:
"If bit 31 is set, this indicates that the following read/write operation will be performed on a memory that is larger than 64KBytes. This is an indication to STK500 that to load extended address must be executed. "
For mega2561 that ISP command is 4D 00 addr 00.
So, I think, at the beginning of "ispReadMemory" or "ispProgramMemory" it is needed to insert something like this:
if (stkAddress.bytes[3] & 0x80) {
cmdBuffer[0] = 0x4d;
cmdBuffer[1] = 0x00;
cmdBuffer[2] = stkAddress.bytes[2];
cmdBuffer[3] = 0x00;
ispBlockTransfer(cmdBuffer, 4);
}

Posted: Fri Apr 27, 2007 5:28 pm
by PycLan
Thanks, ahulap!!!
All works!!!
(Áîëüøîå ñïàñèáî èç Ñåâàñòîïîëÿ! ;) )

Posted: Fri Apr 27, 2007 5:31 pm
by PycLan
And to author AVR-Doper thanks!!!

Posted: Sun Apr 29, 2007 9:56 pm
by christian
Thanks for that hint and thanks for testing the patch with large devices!

We'll include it in the next release of AVR-Doper.