Arduino mini | avrdude: failed to write flash memory

Hello,

I tried to upload a first sketch to a new Arduino mini. But the upload failed...

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: failed to write flash memory, rc=-4
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

The already installed standard program lets switch pin 13 between high and low. Any ideas what I can do?

Sebastian

Do you have the correct board selected?

Have you selected the correct serial port?

Have you tried a different USB cable?

  1. Jep, Board: mini
  2. & 3. programming a mini pro works

I'm using the sparkfun FDTI adapter...

Have you successfully used the FTDI adapter on any board?

Yes, it works well with my Arduini pro and arduino mini pro.

To recap...

The software works.

The FTDI adapter works.

The USB cable works.

As far as I can tell, the only thing left is the new Arduino Mini. I hate to say it but it sure sounds like you have a defective board.

Is anything connected to the new board when you try to upload?

Could I try to reflash the bootloader? Or maybe to change the crystal?

Could I try to reflash the bootloader?

I'm not certain how easy or difficult that would be with the set of Arduinos you have. Do you have an Uno (or similar) or a Mega?

If not, this should work using the FTDI adapter...
http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html

These instructions should help...

The already installed standard program lets switch pin 13 between high and low.
Or maybe to change the crystal?

If the pin 13 LED is blinking, the crystal is very likely fine.

Do you have an Arduino Pro Mini? Or an Arduino Mini?

I'm not certain how easy or difficult that would be with the set of Arduinos you have. Do you have an Uno (or similar) or a Mega?

I have both boards, I will try that in the afternoon.

Do you have an Arduino Pro Mini? Or an Arduino Mini?

the Arduino mini pro is working fine, but the Arduino mini are making problems...

Depending on how you have things set up, the auto-reset might not be active. You probably have to press the reset button on the Mini shortly before (or just after) pressing the upload in the Arduino software. Or you could try to connect DTR/RTS of the FTDI cable through a 100 nF (0.1 uF) capacitor to the reset pin of the Mini.

I use the manual reset. If I have the wrong timing, there will be a different fail (not in sync).

Can you post the verbose output (hold shift while clicking the upload button in the toolbar in the Arduino software)? And explain how you have the cable connected to the board?

Here the log:

Binary sketch size: 1010 bytes (of a 14336 byte maximum)
C:\Programme\arduino-0021\hardware/tools/avr/bin/avrdude -CC:\Programme\arduino-0021\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega168 -cstk500v1 -P\.\COM5 -b19200 -D -Uflash:w:C:\DOKUME~1\SEBAST~1\LOKALE~1\Temp\build5004083981102255721.tmp\Blink.cpp.hex:i

avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

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

Using Port : \.\COM5
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: ser_open(): setting dtr
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv:
avrdude: Recv:
AVR Part : ATMEGA168
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 :

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


eeprom 65 5 4 0 no 512 4 0 3600 3600 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


flash 65 6 128 0 yes 16384 128 128 4500 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

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

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

Reading | avrdude: Send: u [75] [20]
avrdude: Recv:
################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9406
avrdude: Send: V [56] . [a0] . [01] . [fc] . [00] [20]
avrdude: Recv:
avrdude: Recv:
avrdude: Recv:
avrdude: Send: V [56] . [a0] . [01] . [fd] . [00] [20]
avrdude: Recv:
avrdude: Recv:
avrdude: Recv:
avrdude: Send: V [56] . [a0] . [01] . [fe] . [00] [20]
avrdude: Recv:
avrdude: Recv:
avrdude: Recv:
avrdude: Send: V [56] . [a0] . [01] . [ff] . [00] [20]
avrdude: Recv:
avrdude: Recv:
avrdude: Recv:
avrdude: reading input file "C:\DOKUME~1\SEBAST~1\LOKALE~1\Temp\build5004083981102255721.tmp\Blink.cpp.hex"
avrdude: writing flash (1010 bytes):

Writing | avrdude: Send: U [55] . [00] . [00] [20]
avrdude: Recv:
avrdude: Recv:
avrdude: Send: d [64] . [00] . [80] F [46] . [0c] . [94] a [61] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] . [9a] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [00] . [0c] . [94] ~ [7e] . [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
################################################## | 100% 10.05s

avrdude: failed to write flash memory, rc=-4
avrdude: Send: Q [51] [20]
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

avrdude done. Thank you.

Wiring:
FDTI - Arduino mini
GND - GND
5V - 5V
Rx - Tx
Tx - Rx

Hello again,

I tried with the same wiring to upload a sketch to another mini... And it works best. Tomorrow I will try to reflash the bootloader.

Sebastian

From the output you posted, it looks like you're communicating with the bootloader on the Mini successfully. It might be a slightly flakey solder joint or other physical problem that causes an occasional byte to drop. But you could try reburning the bootloader too.

Yehaa, after burning the bootloader new, it works! :slight_smile: