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:
http://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:
UNO to Mega pins
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 |
No comments:
Post a Comment