Hey Guys,
Brand new to the forum. I have a Mega 2560 board. Win 7 64 Bit. (V. 1.6.3).
I'm having some trouble uploaded sketches. Its been working for a long time until recently. Now when I try to upload a sketch, it times out and I get errors. I did some research and basically came to the conclusion that the bootloader somehow got corrupted. So I purchased a USBasp online. I got the drivers installed for it. hooked it up and went to burn the bootloader. It finished burning, however i got an error about avrdud cannot set sck period.
I did some research on that and found out that my programmer has old firmware, but maybe it didn't matter since I use the slow clock... or something along those lines that I don't understand.
So, now that I have a new bootloader. (Red light does flash on reset). I am able to upload a sketch, and it works. That is until I try to upload another sketch. When I try to upload again, it times out and fails to upload just like before.
So I re-burn the bootloader and then it lets me upload the sketch again.
In a nut shell, I have to burn the bootloader before every time I upload a sketch.
Any idea whats going on there? Thanks!
Check the fuses.
That sort of behavior is usually from BOOTRST not being set (so it doesn't go to the bootloader on startup, unless there's nothing else on the flash)
One upload per bootloader burn is a classic symptom of the auto-reset system not working. You can work around that by manually resetting. Hold down the Reset button and start the upload. Release the Reset button when you see the RX LED blink.
Thanks guys, I will have to check out the Reset when I get home. Is that a temporary solution I have to do every time? Or is there a more permanent solution?
DrAzzy, I'm sorry, I'm not familiar with BOOTRST. What is it, and how do I set it?
Thanks again!
Ah yeah, good call on the problem with auto-reset - I knew there was another common cause of that I couldn't remember.
If the auto-reset circuit isn't working you will have to use the reset button every time you upload a sketch. If you have access to an oscilloscope you can check the action on the Reset pin. It should be HIGH when running and LOW when the Reset button is pressed. It should pulse LOW briefly when you try to start an upload. If it doesn't pulse LOW then either the USB-to-Serial chip isn't getting the DTR signal or it isn't passing it on or the 100 nF capacitor between that chip and the Reset pin is not connected.
Thanks for your suggestions, unfortunately. the reset didn't work. I tried it several times over.
here is the error I'm getting.
Sketch uses 1,518 bytes (0%) of program storage space. Maximum is 253,952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8,183 bytes for local variables. Maximum is 8,192 bytes.
C:\Users\test\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino5/bin/avrdude -CC:\Users\test\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino5/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM5 -b115200 -D -Uflash:w:C:\Users\test\AppData\Local\Temp\build1485115919522606630.tmp/Blink.cpp.hex:i
avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\Users\test\AppData\Roaming\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino5/etc/avrdude.conf"
Using Port : COM5
Using Programmer : wiring
Overriding Baud Rate : 115200
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
avrdude done. Thank you.
Hey Guys, Just wondered if there was anything else I could try. I still cant get ti to upload without a bootloader burn first. FYI, I tried to solder the Reset-EN connection to "Re-enable" the reset. That didn't work either.
Thanks for your help!