AVR-Doper problems prog ATMEGA2561

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
PycLan

AVR-Doper problems prog ATMEGA2561

Post by PycLan » Thu Apr 26, 2007 5:21 pm

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.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Thu Apr 26, 2007 6:16 pm

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.

PycLan

Post by PycLan » Fri Apr 27, 2007 10:12 am

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?

ahulap
Posts: 16
Joined: Tue Dec 26, 2006 1:30 pm
Location: Kharkiv, Ukraine

Post by ahulap » Fri Apr 27, 2007 1:07 pm

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);
}

PycLan

Post by PycLan » Fri Apr 27, 2007 5:28 pm

Thanks, ahulap!!!
All works!!!
(Áîëüøîå ñïàñèáî èç Ñåâàñòîïîëÿ! ;) )

PycLan

Post by PycLan » Fri Apr 27, 2007 5:31 pm

And to author AVR-Doper thanks!!!

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Sun Apr 29, 2007 9:56 pm

Thanks for that hint and thanks for testing the patch with large devices!

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

Post Reply