I'm trying to program my ATMEGA2560 with the arduino bootloader (STK500V2 ?) with a bluetooth module.
I can't reset my chip automatically so my idea was to watch the serial port, when I send the correct character I reset the chip internally. I only need to find a way how to add a delay to make the bootloader longer active. this way the timing is less critical.
is it possible to add a delay in the STK500V2 bootloader?
Are you loading from the IDE?
Easy way is to check File:Preferences, turn on verbose outputs.
Press & Hold the Mega's reset key.
Start the download, when you see "Compiled xxx of 255000 bytes" (or similar) release the reset button. May take a couple tries to get the timing right.
CrossRoads:
Are you loading from the IDE?
Easy way is to check File:Preferences, turn on verbose outputs.
Press & Hold the Mega's reset key.
Start the download, when you see "Compiled xxx of 255000 bytes" (or similar) release the reset button. May take a couple tries to get the timing right.
Yes I'm loading from the IDE
This is not really a solution for me, this project will be at an inaccessible place when finished.
this is why I want to reset it with the COM port with a character. once reset the bootloader should be active for couple of seconds (4 or more) so I can upload it.
I found in the bootloader code of arduino (STK500boot.c) a variable called boot_timeout.
#ifdef BLINK_LED_WHILE_WAITING
// boot_timeout = 90000; //* should be about 4 seconds
// boot_timeout = 170000;
boot_timeout = 20000; //* should be about 1 second
#else
boot_timeout = 3500000; // 7 seconds , approx 2us per step when optimize "s"
#endif
I saw that BLINK_LED_WHILE_WAITING is defined so boot_timeout = 20000.
will it change the active time of the bootloader when I change it to 3500000 ?
(sorry for my bad English)...