Package: avrdude
Version: 6.1-1
Severity: normal

Current program fails with ftdi_syncbb (used by FT232R and FT245R) with
recent Arduino, at least.  

The attached patch was dropped into current package and its problem was
gone. Please see the execution result.  It is clear, this patch fixes
the problem.

This is patch reported in the upstream bug:
 http://savannah.nongnu.org/bugs/?40086

Here, ft232r is defined in as attached matching my pins.

Regards,

Osamu

FYI:
Some blogs talk about the same problem for the SERTAG fork in Japanese.
Both seems to lack timing adjustment proposed by
      http://savannah.nongnu.org/bugs/?40086

Arduino Uno changed rest line with adding a pull down resistor on the
driving circuit.  I guess that is why people complain on SERTAG now
which was very popular in Japan.

-- System Information:
Debian Release: jessie/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.14-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages avrdude depends on:
ii  libc6         2.19-10
ii  libelf1       0.159-3
ii  libftdi1      0.20-1+b2
ii  libncurses5   5.9+20140712-2
ii  libreadline6  6.3-8
ii  libtinfo5     5.9+20140712-2
ii  libusb-0.1-4  2:0.1.12-24

avrdude recommends no packages.

Versions of packages avrdude suggests:
ii  avrdude-doc  6.1-1

-- no debconf information
From: Ing. Daniel Rozsnyó
Subject: patch: FT245R correct reset (ftdi_syncbb)
Date: Sun, 22 Sep 2013 20:18:35 +0200

 Originally https://lists.nongnu.org/archive/html/avrdude-dev/2013-09/msg00162.html
 http://savannah.nongnu.org/bugs/?40086 reported by Daniel Rozsnyo <rozsnyo>

--- a/ft245r.c
+++ b/ft245r.c
@@ -297,6 +297,10 @@
     return 0;
 }
 
+static int set_sck(PROGRAMMER * pgm, int value) {
+    return set_pin(pgm, PIN_AVR_SCK, value);
+}
+
 static int set_reset(PROGRAMMER * pgm, int value) {
     return set_pin(pgm, PIN_AVR_RESET, value);
 }
@@ -419,6 +423,12 @@
  */
 static int ft245r_initialize(PROGRAMMER * pgm, AVRPART * p) {
 
+    /* Apply power between VCC and GND while RESET and SCK are set to “0”. In some systems,
+     * the programmer can not guarantee that SCK is held low during power-up. In this
+     * case, RESET must be given a positive pulse of at least two CPU clock cycles duration
+     * after SCK has been set to “0”.
+     */
+    set_sck(pgm, OFF);
     ft245r_powerup(pgm);
 
     set_reset(pgm, OFF);
@@ -426,7 +436,11 @@
     set_reset(pgm, ON);
     usleep(5000); // 5ms
     set_reset(pgm, OFF);
-    usleep(5000); // 5ms
+
+    /* Wait for at least 20 ms and enable serial programming by sending the Programming
+     * Enable serial instruction to pin MOSI.
+     */
+    usleep(20000); // 20ms
 
     return ft245r_program_enable(pgm, p);
 }
# ********************** with 6.1-1.1 avrdude (patched) *********************
$ sudo dpkg -i avrdude_6.1-1.1_amd64.deb 
(Reading database ... 254234 files and directories currently installed.)
Preparing to unpack avrdude_6.1-1.1_amd64.deb ...
Unpacking avrdude (6.1-1.1) over (6.1-1) ...
Setting up avrdude (6.1-1.1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Press any key to continue...

$ make erase
sudo avrdude -p ATmega328P -c ttl232r -e

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: erasing chip

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

Press any key to continue...

$ make set
make check
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U lfuse:r:-:h -U hfuse:r:-:h -U 
efuse:r:-:h -U lock:r:-:h

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xff
avrdude: reading hfuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xd6
avrdude: reading efuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0x5
avrdude: reading lock memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0x3f

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make lfuse
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U lfuse:w:0xff:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "0xff"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xff:
avrdude: load data lfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make hfuse
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U hfuse:w:0xd6:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "0xd6"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd6:
avrdude: load data hfuse data from input file 0xd6:
avrdude: input file 0xd6 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make efuse
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U efuse:w:0x05:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "0x05"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0x05:
avrdude: load data efuse data from input file 0x05:
avrdude: input file 0x05 contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make flash
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U 
flash:w:/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

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: erasing chip
avrdude: reading input file 
"/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex"
avrdude: input file 
/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex
 auto detected as Intel Hex
avrdude: writing flash (32670 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 32670 bytes of flash written
avrdude: verifying flash memory against 
/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:
avrdude: load data flash data from input file 
/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:
avrdude: input file 
/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex
 auto detected as Intel Hex
avrdude: input file 
/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex
 contains 32670 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

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

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make lock
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U lock:w:0xf:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "0xf"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xf:
avrdude: load data lock data from input file 0xf:
avrdude: input file 0xf contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make check
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U lfuse:r:-:h -U hfuse:r:-:h -U 
efuse:r:-:h -U lock:r:-:h

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xff
avrdude: reading hfuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xd6
avrdude: reading efuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0x5
avrdude: reading lock memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xf

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'

# ********************** with 6.1-1 avrdude ***************************
$ sudo dpkg -i avrdude_6.1-1_amd64.deb 
dpkg: warning: downgrading avrdude from 6.1-1.1 to 6.1-1
(Reading database ... 254234 files and directories currently installed.)
Preparing to unpack avrdude_6.1-1_amd64.deb ...
Unpacking avrdude (6.1-1) over (6.1-1.1) ...
Setting up avrdude (6.1-1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Press any key to continue...

$ make reset
make check
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U lfuse:r:-:h -U hfuse:r:-:h -U 
efuse:r:-:h -U lock:r:-:h

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xff
avrdude: reading hfuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xd6
avrdude: reading efuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0x5
avrdude: reading lock memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xf

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make erase
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -e

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: erasing chip
avrdude: Device is not responding to program enable. Check connection.

avrdude done.  Thank you.

Makefile:35: recipe for target 'erase' failed
make[1]: *** [erase] Error 255
make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
Makefile:68: recipe for target 'reset' failed
make: *** [reset] Error 2
Press any key to continue...

$ make set
make check
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U lfuse:r:-:h -U hfuse:r:-:h -U 
efuse:r:-:h -U lock:r:-:h

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xff
avrdude: reading hfuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0xd6
avrdude: reading efuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0x5
avrdude: reading lock memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0x3f

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make lfuse
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U lfuse:w:0xff:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "0xff"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xff:
avrdude: load data lfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make hfuse
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U hfuse:w:0xd6:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "0xd6"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd6:
avrdude: load data hfuse data from input file 0xd6:
avrdude: input file 0xd6 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make efuse
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U efuse:w:0x05:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "0x05"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0x05:
avrdude: load data efuse data from input file 0x05:
avrdude: input file 0x05 contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified

avrdude: safemode: Fuses OK (E:05, H:D6, L:FF)

avrdude done.  Thank you.

make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
make flash
make[1]: Entering directory '/home/osamu/tmp/avrdude/test-rebuild'
sudo avrdude -p ATmega328P -c ttl232r -U 
flash:w:/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

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: erasing chip
avrdude: Device is not responding to program enable. Check connection.

avrdude done.  Thank you.

Makefile:58: recipe for target 'flash' failed
make[1]: *** [flash] Error 255
make[1]: Leaving directory '/home/osamu/tmp/avrdude/test-rebuild'
Makefile:74: recipe for target 'set' failed
make: *** [set] Error 2
Press any key to continue...

# There is a ATmega328P kit PCB called "uncompatino".
# This board allows ISP via its on-board FT232R.
# This is designed like Arduino Duemilanove but has no standard ICPS header.
# Its 4 pairs of pins are shorted to enable ftdi_syncbb.
# http://akizukidenshi.com/catalog/g/gP-07487/
# http://akizukidenshi.com/download/ds/akizuki/k6096_manual_20130816.pdf
programmer
  id    = "uncompatino";
  desc  = "uncompatino with all pairs of pins shorted";
  type  = "ftdi_syncbb";
  connection_type = usb;
  miso  = 3; # cts
  sck   = 5; # dsr
  mosi  = 6; # dcd
  reset = 7; # ri
;

# FTDI USB to serial cable TTL-232R-5V with a custon adapter for ICSP
# http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
# 
http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232R_CABLES.pdf
# TTL-232R GND 1 Black  -> ICPS GND   (6 pin)
# TTL-232R CTS 2 Brown  -> ICPS MOSI  (4 pin)
# TTL-232R VCC 3 Red    -> ICPS VCC   (2 pin)
# TTL-232R TXD 4 Orange -> ICPS RESET (5 pin)
# TTL-232R RXD 5 Yellow -> ICPS SCK   (3 pin)
# TTL-232R RTS 6 Green  -> ICPS MISO  (1 pin)
# Except for VCC and GND, you can connect arbitual pairs as long as 
# the following table is adjusted.
programmer
  id    = "ttl232r";
  desc  = "FTDI TTL232R-5V with the ICSP adapter";
  type  = "ftdi_syncbb";
  connection_type = usb;
  miso  = 2; # rts
  sck   = 1; # rxd
  mosi  = 3; # cts
  reset = 0; # txd
;

Reply via email to