Go Down

Topic: ArduinoISP broken in Arduino 1.0 (Read 7086 times) previous topic - next topic

dc42

Dec 10, 2011, 07:24 pm Last Edit: Dec 24, 2011, 01:31 pm by dc42 Reason: 1
I've been using ArduinoISP successfully on an Arduino Uno with Arduino 0022 software for several months. Having upgraded to Arduino 1.0, I find that if I compile and upload ArduinoISP using Arduino 1.0, I cannot program my target hardware (atmega328 running at 8MHz). It gives the same error each time. Here is a transcript of the session:

Code: [Select]

Binary sketch size: 11662 bytes (of a 32256 byte maximum)
C:\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P\\.\COM5 -b19200 -Uflash:w:C:\Users\David\AppData\Local\Temp\build1997400296219766435.tmp\controller.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2009 Joerg Wunsch

        System wide configuration file is "C:\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

        Using Port                    : \\.\COM5
        Using Programmer              : stk500v1
        Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
        AVR Part                      : ATMEGA328P
        Chip Erase delay              : 9000 us
        PAGEL                         : PD7
        BS2                           : PC2
        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                 :

<cut to stay within max message size allowed by the forum>

        Programmer Type : STK500
        Description     : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
        Hardware Version: 2
        Firmware Version: 1.18
        Topcard         : Unknown
avrdude: Send: A [41] . [84]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [86]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [87]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [89]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
        Vtarget         : 0.0 V
        Varef           : 0.0 V
        Oscillator      : Off
        SCK period      : 0.1 us

avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: Send: V [56] 0 [30] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [1e]
avrdude: Recv: . [10]
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [95]
avrdude: Recv: . [10]
################avrdude: Send: V [56] 0 [30] . [00] . [02] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [0f]
avrdude: Recv: . [10]
################################## | 100% 0.12s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
        To disable this feature, specify the -D option.
avrdude: Send: V [56] . [a0] . [03] . [fc] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: Send: V [56] . [a0] . [03] . [fd] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: Send: V [56] . [a0] . [03] . [fe] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: Send: V [56] . [a0] . [03] . [ff] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: erasing chip
avrdude: Send: V [56] . [ac] . [80] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: reading input file "C:\Users\David\AppData\Local\Temp\build1997400296219766435.tmp\controller.cpp.hex"
avrdude: writing flash (11662 bytes):

Writing | avrdude: Send: U [55] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: d [64] . [00] . [80] F [46] . [0c] . [94] b [62] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [05] . [12] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [0c] . [94] . [8a] . [00] . [00] . [00] . [00] . [00] $ [24] . [00] ' [27] . [00] * [2a] . [00] . [00] . [00] . [00] . [00] % [25] . [00] ( [28] . [00] + [2b] . [00] . [00] . [00] . [00] . [00]   [20]
avrdude: Recv:

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: Send: V [56] @ [40] . [00] . [00] . [0c]   [20]
avrdude: Recv: . [15]
avrdude: stk500_cmd(): programmer is out of sync


If I switch to Arduino-0022 and upload ArduinoISP, then switch back to Arduino 1.0, I can use ArduinoISP to program my target hardware (using the helpful "Upload Using Programmer" feature added in 1.0).

The source code of ArduinoISP is the same for both versions of the software, so I guess there must be a library change in 1.0 that breaks ArduinoISP. Maybe it's the buffered transmit?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

mellis

I've had the same problem: http://code.google.com/p/arduino/issues/detail?id=661

It might be because the size of the serial receive buffers changed in Arduino 1.0 (to 64 bytes from 128 in 0022).  If I put them back to 128 bytes, it works again.  I don't understand why, though, because it seems like should it read the bytes out of the buffer as soon as they arrive.

dc42

Thanks mellis, I'll try increasing the serial buffer size. I guess ArduinoISP must be busy doing something else while Avrdude is sending it lots of data? Maybe a lower baud rate would also fix it?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

mihies


I've had the same problem: http://code.google.com/p/arduino/issues/detail?id=661

It might be because the size of the serial receive buffers changed in Arduino 1.0 (to 64 bytes from 128 in 0022).  If I put them back to 128 bytes, it works again.  I don't understand why, though, because it seems like should it read the bytes out of the buffer as soon as they arrive.


Excellent, I can confirm that it works once buffer is set to 128 (Mega ADK, ArduinoBT probably as well) - argh. Thanks, you solved a huge problem. :)

Coding Badly


I have an update for the ArduinoISP sketch that works correctly with Arduino 1.0.  If you'd like a copy, send me a Personal Message with your email address.

maniacbug

BTW, the buffer only needs to be 100 :)  That's the size of the protocol chunk that is overrunning the 64-byte serial buffer.

Go Up