Pages: [1]   Go Down
Author Topic: Problem uploading sketch in verify phase  (Read 510 times)
0 Members and 1 Guest are viewing this topic.
Davie, Fl
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The following applies to Arduino -1.0 on Linux(64 bit).

I ported the IDE to run on an a atmega2561 in an STK500/STK501 dev board. (modified pins_arduino.h and boards.txt) The bootloader is the STK500v2 at 115200 with a 16mhz clock. I set the fuses using AVR studio and a jtagmkII (on a windows machine).  I then used avrdude from the command line to burn the bootloader to the controller (from the Linux computer).  I verified that avrdude will connect to the bootloader (avrdude -pm2561 -cstk500v2 -b115200 -P/dev/ttyUSB1) this  on Linux using a USB serial dongle plugged into the stk501 DB9.  A .1uf capacitor is soldered from the DB9 pin 4 to the RST line on the STK500.  The boards.txt file was modified with an entry for my STK500/m2561 having the correct baud rate and bootloader entries.  I am able to download sketches to the board using the IDE, but they don't verify.  I downloaded a simple blink example and then modified it to go faster.  During the download the led stops blinking which verifies that the IDE does reset the board.  Following the output in verbose mode I can see that the download proceeds, but gets stuck during the verify readback phase during which I see the "timed out" message.  If I exit the IDE and reset the board manually the newly loaded sketch runs.  I can also manually load the sketch with avrdude from the command line by using the verify option to compile the sketch and then find the hex file in the /tmp/buildxxxxxx directory.  Manually loading with avrdude from the command line DOES verify the download correctly.  Somehow the IDE is NOT communicating correctly with avrdude.

Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Just to make certain I understand: When you upload from the command-line, does the verify work?  Or do you have avrdude skip the verify?
Logged

Davie, Fl
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Just to make certain I understand: When you upload from the command-line, does the verify work?  Or do you have avrdude skip the verify?

Avrdude works perfectly from the command line and does complete the verify.

ken@franken-penguin /tmp/build6480978933833115943.tmp $ avrdude -pm2561 -b57600 -cstk500v2 -P/dev/ttyUSB1 -U flash:w:Blink.cpp.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9802
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Blink.cpp.hex"
avrdude: input file Blink.cpp.hex auto detected as Intel Hex
avrdude: writing flash (1478 bytes):

Writing | ################################################## | 100% 0.35s

avrdude: 1478 bytes of flash written
avrdude: verifying flash memory against Blink.cpp.hex:
avrdude: load data flash data from input file Blink.cpp.hex:
avrdude: input file Blink.cpp.hex auto detected as Intel Hex
avrdude: input file Blink.cpp.hex contains 1478 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.29s

avrdude: verifying ...
avrdude: 1478 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.
« Last Edit: April 25, 2012, 12:48:15 pm by scharkalvin » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Does verify work from the IDE if you enable verbose output?
Logged

Davie, Fl
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Does verify work from the IDE if you enable verbose output?

Actually I had the verbose output enabled for both compiling and uploading from the very start.  I tried turning it off and it still failed to get though the verify phase.  Once in a blue moon it DID manage to compete the upload (Blink example) and it didn't matter if verbose was on or off.  I'd say out of several dozen attempts the upload completed perhaps three times.  Even when it doesn't complete if I exit the IDE closing ALL windows and then reset the hardware the script runs fine.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The bootloader is the STK500v2 at 115200 with a 16mhz clock.
I verified that avrdude will connect to the bootloader (avrdude -pm2561 -cstk500v2 -b115200 -P/dev/ttyUSB1)
avrdude -pm2561 -b57600 -cstk500v2 -P/dev/ttyUSB1 -U flash:w:Blink.cpp.hex

- ? -
« Last Edit: April 25, 2012, 07:28:00 pm by Coding Badly » Logged

Davie, Fl
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried running the board at both 8mhz and 16mhz (it is a 16mhz device).  I burned a new bootloader for the 8mhz speed at 57600, at the 16mhz it ran at 115200.  So BOTH are correct and the IDE worked with both speeds.  I just wanted to see if that would make a difference.  It didn't.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Please upload from the IDE with verbose output enabled and post the output.  Use [code] [/code] tags when posting.  If the output is too big it can be attached as a text file.
Logged

Davie, Fl
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is very strange.  Today I repeated exactly the same procedure to reproduce the error.  And now it works correctly.
I have tried with the verbose turned on and off in both the compile and upload options, no difference.  If the issue shows up again as I strongly suspect it will, I will try to capture the output of the dialog and post it here.   BTW, I now have the 8mhz bootloader at 57600 installed, I will try putting back the 16mhz bootloader at 115200 and replace the 16mhz crystal and try it again.  I have two options in boards.txt one for each case.  (It's possible a final product will use a processor running at 3.3v to be compatible with other LV parts hence having the 8mhz development option).
Logged

Pages: [1]   Go Up
Jump to: