Go Down

Topic: Mega 2560 upload at 57600 (Read 832 times) previous topic - next topic

PatrickLL

Hi @ all,

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


Thanks
Patrick

retrolefty


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

PatrickLL

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

westfw

I would change this in the .c file and leave the makefile unchanged:
Code: [Select]
/*
* 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.

PatrickLL

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.

PatrickLL

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

hiduino

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: [Select]

# 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.


PatrickLL

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

Go Up