problem with using avrdude on the linux (ubuntu)

Hi All,

I was using arduino atmega2560 board (MEGA ADK) (ON LINUX)
I was able to program my device from command line:

Launching /usr/local/avr/bin/avrdude -pm2560 -cstk500v2 -P/dev/ttyACM3 -b115200 -D -Uflash:w:AVR_hello.hex:a

Everything was fine till today

Today I got output:
Quote:
Launching /usr/local/avr/bin/avrdude -pm2560 -cstk500v2 -P/dev/ttyACM3 -b115200 -D -Uflash:w:AVR_hello.hex:a
Output:

avrdude: stk500v2_command(): unknown status 0x1e

avrdude: stk500v2_setparm(): failed to set parameter 0x9e
avrdude: stk500v2_command(): unknown status 0x48
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: stk500v2_command(): unknown status 0x01
avrdude: stk500v2_disable(): failed to leave programming mode

avrdude done. Thank you.

When I try to program my device on Windows directly from arduino IDE everything works fine (device is programmed correctly)

When I try to program my device on Windows directly from arduino IDE everything works fine (device is programmed correctly)

And what happens when you try to program it on Ubuntu from the Arduino IDE?

In the meantime my /dev/ttyACM3 changed to /dev/ttyACM0

And now I have my previous problem.
Is it connected with the size of the hex file.
This one is too big:

/usr/local/avr/bin/avrdude -pm2560 -cstk500v2 -P/dev/ttyACM0 -b115200 -Uflash:w:AVR_hello.hex:a -v -v -B 333

avrdude: Version 5.11.1, compiled on Mar 12 2012 at 15:10:07
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "/usr/local/avr/etc/avrdude.conf"
User configuration file is "/home/przemek/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyACM0
Using Programmer : stk500v2
Overriding Baud Rate : 115200
Setting bit clk period : 333.0
avrdude: stk500v2_set_sck_period(): p = 333.0 us too large, using 276.7 us
AVR Part : ATMEGA2560
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : STK500V2
Description : Atmel STK500 Version 2.x firmware
Programmer Model: AVRISP
Hardware Version: 15
Firmware Version Master : 2.10
Vtarget : 0.0 V
SCK period : 8.7 us

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9801
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
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 "AVR_hello.hex"
avrdude: input file AVR_hello.hex auto detected as Intel Hex
avrdude: writing flash (42756 bytes):

Writing | ################################################# | 98% 6.05savrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout

This is working correctly:

Launching /usr/local/avr/bin/avrdude -pm2560 -cstk500v2 -P/dev/ttyACM0 -b115200 -D -Uflash:w:AVR_hello.hex:a
Output:

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9801
avrdude: reading input file "AVR_hello.hex"
avrdude: input file AVR_hello.hex auto detected as Intel Hex
avrdude: writing flash (42724 bytes):

Writing | ################################################## | 100% 6.16s

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

Reading | ################################################## | 100% 4.79s

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

avrdude done. Thank you.

avrdude finished

In the meantime my /dev/ttyACM3 changed to /dev/ttyACM0

That is what I suspected.

This is working correctly:

That means it is working correctly now, correct?

SurferTim:

This is working correctly:

That means it is working correctly now, correct?

Unfortunately if the size is 42724 it is working but with bigger size (42756) I am getting timeouts.

I found problem!!!

The problem is that it cannot be put anywhere in the code: !!!

client.println("Hello !!!");

Please see:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1295548146

OH YES- I heard back from the the Bootloader Developer. He said don't put !!! anywhere in your code. There is a bug when you use 3 exclamations in a row, no matter how you use them, the bootloader tries to go to a monitor mode and breaks the sketch. no !!!

I will not comment above :frowning:

Good to hear you found your problem. You don't really need !!! unless the sky is falling or something important like that. :wink: