Bootloader Issues with Arduino Mega 2560
If you are interested in using Solar Power on the Arduino, check out SunAir.
Hit a significant roadblock on the Battery Watchdog last week. During one development session, the Arduino Mega 2560 we are using for the Watchdog stopped taking programming, giving a series of errors:
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
After eliminating the possibility of a bad Arduino Mega, bad programming environment, bad cable, and others, we determined that we had run into the “!!!” bug. The “!!!” bug can happen because you have “!!!” in an text string or, unfortunately, generated by the compiler as part of the code. Eliminating the text string, we suspected that the code contained 0x212121. We verified this by looking at the battery watchdog hex file and found a sequence of “212121” which in ascii, is “!!!”. It is generated by the code and not part of a text string in the program.
We used “hexdump” on the mac command line and then searched for the value. We found the location of the compiled file by turning on the additional compilation output (on the Arduino preferences menu) and then looking through the compile information to find the .hex file.
The Bootloader that is shipped with some Megas (we bought ours early in 2013) detects the “!!!” sequence and goes into a monitor mode, hence timing out the loading process.
This is fixed in the latest boot loader (which also reenables the internal watchdog timer, Yes!).
We have now completed the process of flashing a new boot loader into the Arduino Mega by using a Arudino Uno as an ISP programmer as shown in these links. Use the following boot loader:
hardware/arduino/bootloader/stk500v2/stk500boot_v2_mega2560.hex
The new boot loader image we used was in the Arduino directory. If you are on a Mac, open up the app bundle in Finder.
This fixed our problem, but still with a verification error, but the boot loader is working and we can program the Mega again. (note: We suspect the following will remove the verification error, but we haven’t tested it yet: disable the -D command to auto erase the chip and add the -e instead.)
We used the tutorial on:
https://arduino.cc/en/Tutorial/ArduinoISP
for the IDE procedure.
Remember that the pins to be used changed from the Uno to the Mega, so use the following wiring diagram:
Arduino Uno Target Mega2560
D10 (SS) Reset
D11 (MOSI) D51
D12 (MISO) D50
D13 (SCK) D52
Gnd Gnd
+5V +5V
Now the Arduino is working fine in the system. Here is a picture from the RasPiConnect App (www.milocreek.com) of the functioning Arduino system.
Arduino Based Battery Watchdog |
Picture of the location of Project Curacao |
hello
I also have that problem with my arduino mega 2560
to remove that error then I have to make the connection arduino arduino mega one and nothing but the connect to the stream or do occupy another procedure or some code I get?
This urges me
because I have final projects for school this week and I have weeks looking for him and I could not find a solution.
regards