Arduino Mega 1280 - unable to program ( bootloader )

You would also need to make the changes to boards.txt he suggested, but the change to the bootloader-uploader should have worked.

Yes, the result of the uploading and verifing of the bootloader with your programmer and the sketch-uploading-problem resp. the updating of the boards.txt suggests, that your programmer works. I wasn't aware of this interaction with the txt-file (and much more things). I'm glad that my 1280 works now and has a working WTD.

Thank you and Retrolefty for your help!

OK, in that case I committed that change to GitHub, so that is now the new loader for the Atmega1280 in my sketch.

[quote author=Nick Gammon link=topic=100881.msg1383992#msg1383992 date=1378672924] OK, in that case I committed that change to GitHub, so that is now the new loader for the Atmega1280 in my sketch. [/quote]

That would be an improvement as the 'official' IDE distrubution seems to not care about adding/updating the 1280 bootloader hex file like they did for the 2560 board.

One big caution however is that unless you embed some comments that prints to the serial monitor on your program when it burns the new mega1280 bootloader, the user must read/remember that he must also modify his copy of the boards.txt file in his arduino core directory?

Lefty

Good suggestion. I've added a note to the end of this post:

http://www.gammon.com.au/forum/?id=11635

[quote author=Nick Gammon link=topic=100881.msg1385258#msg1385258 date=1378761402] Good suggestion. I've added a note to the end of this post:

http://www.gammon.com.au/forum/?id=11635 [/quote]

Nice!

Hi

I can confirm that it works. Today I uploaded a new bootloader to the old Mega with using Usbasp programmer and now the watchdog works fine XD


Edit: 30.12.2013 20:19

But I have question, it is possible to change the upload speed to the old value 57600, Now I have to used this:

mega.upload.speed=115200

I'm guessing that this speed is stored in the new bootloader, there is any easy way to change it ?

rat-: Hi

I can confirm that it works. Today I uploaded a new bootloader to the old Mega with using Usbasp programmer and now the watchdog works fine XD


Edit: 30.12.2013 20:19

But I have question, it is possible to change the upload speed to the old value 57600, Now I have to used this:

mega.upload.speed=115200

I'm guessing that this speed is stored in the new bootloader, there is any easy way to change it ?

No easy way. The bootloader program is compiled with a fixed baud rate and to change optiboot to 57600 would require the bootloader source code to be edited and recompiled, which is not something you can do in the Arduino IDE environment.

Lefty

retrolefty: No easy way. The bootloader program is compiled with a fixed baud rate and to change optiboot to 57600 would require the bootloader source code to be edited and recompiled, which is not something you can do in the Arduino IDE environment.

Lefty

Yes, You have right :) I used the uncle google.com and compile my own bootloader with baud rate 9600 (other shetch and watchdog works fine )

According with atmega1280 datasheet (and some "AVR ATmega Baudraten" http://www.gjlay.de/helferlein/avr-uart-rechner.html )

The baud rate 9600, introduces maximum errors during communication at the level of 0.2 %, just us 76800 (what is better then 57600).

The test compilation with baud rate 115200, gives me warning:

#warning BAUD_RATE error greater than -2%

I am not user jet, what exactly mean the different between -3% and 3%.

Tip: Link to the optiboot bootlader https://code.google.com/p/optiboot/downloads/list .

I am not user jet, what exactly mean the different between -3% and 3%.

Asynchronous serial communications means the receiving end must create and use self timed mid-bit sampling for each of the incoming bits of a character. Any timing error of the speed actual being sent and what speed the receiver is expecting can cause the receiver to misread a bit within a character. Such sampling errors accumulate with each bit until the stop bit and next start bit restarts the sampling counter. So the closer the sender and receiver are in actual timing accuracy the better, however even a +/-2% error does not mean that there will be garbled characters.