Pages: [1]   Go Down
Author Topic: Mega 2560 upload at 57600  (Read 787 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi @ all,

is there a way to change the programming speed at "Arduino Mega 2560" from 115200 to 57600.


Thanks
Patrick
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi @ all,

is there a way to change the programming speed at "Arduino Mega 2560" from 115200 to 57600.


Thanks
Patrick

That would require two changes, one easy, one not so easy.

First the easy one, the baud rate entry for the mega2560 board selection in the arduino core file boards.txt would have to be edited to change
 mega2560.upload.speed=115200
to
 mega2560.upload.speed= 57600

Second the harder task. You would have to take the source file for the mega2560 bootloader code and change it for the new baud rate and recompile the bootloader and then burn the modified bootloader code on to the board. This can't all be done within the arduino IDE so you would have to do some research on how to accomplish all that.

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Lefty,

thanks for the answer.
I have already changed the upload speed in "boards.txt" and also recompiled the bootloader and uploaded it with AVR Studio and AVR Dagon.
But it doesn't works.

Probably I changed the wrong things in the "STK500V2" file and "make" file.
I forgot to make a screenshot from the error, when I tried to upload a program with the Arduino IDE,
but maybe you know what I must change in the "stk500boot.c" and how to modify the "make" file.
(I think that are the two files, which I must change).

Thanks
Patrick
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6782
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would change this in the .c file and leave the makefile unchanged:
Code:
/*
 * UART Baudrate, AVRStudio AVRISP only accepts 115200 bps
 */

#ifndef BAUDRATE
#define BAUDRATE 115200
#endif
Note the comment, however.  The stk500v2 protocol used sort-of specifies that it should run at 115200bps, and various programming software might not support changing the bitrate.  Turn on "verbose" uploading in the arduino preferences to confirm that avrdude is overriding the bitrate.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks.

That's what I changed, and it doesn't works.
But I will try it again, because I forgot to try it with "verbose" uploading.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried again (recombiled bootloader --> Programmed arduino with AVR Dragon --> Upload programm with Arduino IDE), but I get this error:

Binäre Sketchgröße: 1.582 Bytes (von einem Maximum von 258.048 Bytes)
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
Logged

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 29
Posts: 613
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To run correctly with 57.6K baud you need to disable the double speed in the UART.

You can try this in the Makefile:
Code:
# Place -D or -U options here
CDEFS = -DF_CPU=$(F_CPU)UL -DBAUDRATE=57600 -DUART_BAUDRATE_DOUBLE_SPEED=0

Note: You do not need to modify the stk500boot.c, only the Makefile for this.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Hiduino,

thanks.
I made the changes in the make file recompiled it and uploaded it to the Arduino Mega 2560 via AVR Dragon and AVR Studio 6.1.
After that, everything works fine when I uploaded the program with Arduino IDE, also with via XBee according http://www.ladyada.net/make/xbee/arduino.html.

Thnaks to all
Patrick
Logged

Pages: [1]   Go Up
Jump to: