I got no reply so I started to add the BUFF code to ft245r driver. The patch is in the attachment, I did some debug prints (one may not like the prefixes I use...) because the thing did not worked even with the BUFF signal.

In the end I realized, that for a low active BUFF, it would be enough to set the DDR to output the default zero.

Anyway, the clean ATmega32A did not responded, until I used a bitrate below or equal of 2400. That is strange, but now I get that:


         Programmer Type : ftdi_syncbb
         Description     :
         Pin assignment  : 1..8 = DBUS0..7, 9..12 = GPIO0..3
           RESET   =  5
           SCK     =  4
           MOSI    =  6
           MISO    =  7
           BUFF    =  8

 ft245r:  spi bitclk 2400 -> ft baudrate 4800
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9502
avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as 99

avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as 99
avrdude: safemode: Fuses OK

avrdude done.  Thank you.



Daniel



On 04/12/2013 06:15 PM, "Ing. Daniel Rozsnyó" wrote:
Hi,
  I have some issues with the FT232 programmer code.. I had to define a
custom pinout, and the BUFF pin is not recognized. Is that okay, or the
ftdi_syncbb does not support the BUFF pin?



programmer
   id    = "kac-cmos";
   type  = "ftdi_syncbb";
   connection_type = usb;
   miso  = 7;  # /DCD
   sck   = 4;  # /CTS
   mosi  = 6;  # /DSR
   reset = 5;  # /DTR
   buff  = 8;  # /RI
;


results in -v printout of:

          Programmer Type : ftdi_syncbb
          Description     :
          Pin assignment  : 1..8 = DBUS0..7, 9..12 = GPIO0..3
            RESET   =  5
            SCK     =  4
            MOSI    =  6
            MISO    =  7


  And the second issue is, that after that the text goes like:

  ft245r:  spi bitclk 75000 -> ft baudrate 150000
avrdude: ft245r_program_enable: failed
avrdude: initialization failed, rc=-1
          Double check connections and try again, or use -F to override
          this check.


   The chip I am using is however a FT232RQ:

Bus 003 Device 015: ID 0403:6001 Future Technology Devices
International, Ltd FT232 USB-Serial (UART) IC
Device Descriptor:
   bLength                18
   bDescriptorType         1
   bcdUSB               2.00
   bDeviceClass            0 (Defined at Interface level)
   bDeviceSubClass         0
   bDeviceProtocol         0
   bMaxPacketSize0         8
   idVendor           0x0403 Future Technology Devices International, Ltd
   idProduct          0x6001 FT232 USB-Serial (UART) IC
   bcdDevice            6.00
   iManufacturer           1 FTDI
   iProduct                2 FT232R USB UART
   iSerial                 3 A4002rtk
   bNumConfigurations      1


I am using:
avrdude: Version 5.11svn, compiled on Aug 13 2012 at 21:14:46
(with FT2232 in custom configurations it works perfectly!)


Daniel

_______________________________________________
avrdude-dev mailing list
avrdude-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
--- ft245r.orig.c	2013-04-13 06:16:49.586473130 +0200
+++ ft245r.c	2013-04-13 07:35:49.042523780 +0200
@@ -100,7 +100,7 @@
 #define REQ_OUTSTANDINGS	10
 //#define USE_INLINE_WRITE_PAGE
 
-#define FT245R_DEBUG	1
+#define FT245R_DEBUG	0
 
 static struct ftdi_context *handle;
 
@@ -109,6 +109,7 @@
 static unsigned char ft245r_mosi;
 static unsigned char ft245r_reset;
 static unsigned char ft245r_miso;
+static unsigned char ft245r_buff;
 
 #define BUFSIZE 0x2000
 
@@ -168,6 +169,13 @@
 static int ft245r_send(PROGRAMMER * pgm, unsigned char * buf, size_t len) {
     int rv;
 
+    if ((verbose>=2) || FT245R_DEBUG) {
+        int i;
+        printf("FT245R < [%i]:",len);
+        if (len) for(i=0;i<len;i++) printf(" %02X",buf[i]);
+        printf("\n");
+    }
+
     rv = ftdi_write_data(handle, buf, len);
     if (len != rv) return -1;
     return 0;
@@ -187,6 +195,13 @@
         sem_post (&buf_space);
     }
 
+    if ((verbose>=2) || FT245R_DEBUG) {
+        int i;
+        printf("FT245R > [%i]:",len);
+        if (len) for(i=0;i<len;i++) printf(" %02X",buf[i]);
+        printf("\n");
+    }
+
     return 0;
 }
 
@@ -265,6 +280,8 @@
 static int set_reset(PROGRAMMER * pgm, int val) {
     unsigned char buf[1];
 
+    if ((verbose>=2) || FT245R_DEBUG) printf("FT245R * RESET = %i (0x%02X)\n",val,ft245r_reset);
+
     buf[0] = 0;
     if (val) buf[0] |= ft245r_reset;
 
@@ -273,6 +290,21 @@
     return 0;
 }
 
+static int set_buff(PROGRAMMER * pgm, int val) {
+    unsigned char buf[1];
+
+    if (ft245r_buff) {
+        if ((verbose>=2) || FT245R_DEBUG) printf("FT245R * BUFF = %i (0x%02X)\n",val,ft245r_buff);
+
+        buf[0] = 0;
+        if (val) buf[0] |= ft245r_buff;
+
+        ft245r_send (pgm, buf, 1);
+        ft245r_recv (pgm, buf, 1);
+    }
+    return 0;
+}
+
 static int ft245r_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
                       unsigned char res[4]);
 /*
@@ -358,16 +390,19 @@
     check_pin(PIN_AVR_MOSI);
     check_pin(PIN_AVR_MISO);
     check_pin(PIN_AVR_RESET);
+    // no check for BUFF pin (should check at least the unsupported invert flag)
+    // check_pin(PPI_AVR_BUFF);
     return ft245r_program_enable(pgm, p);
 }
 
 static void ft245r_disable(PROGRAMMER * pgm) {
+    set_buff(pgm, 1);
     return;
 }
 
 
 static void ft245r_enable(PROGRAMMER * pgm) {
-    /* Do nothing. */
+    set_buff(pgm, 0);
     return;
 }
 
@@ -506,6 +541,7 @@
     setmybit(&ft245r_ddr, pgm->pinno[PIN_AVR_SCK], 1);
     setmybit(&ft245r_ddr, pgm->pinno[PIN_AVR_MOSI], 1);
     setmybit(&ft245r_ddr, pgm->pinno[PIN_AVR_RESET], 1);
+    setmybits(&ft245r_ddr, pgm->pinno[PPI_AVR_BUFF], 1);
 
     ft245r_sck = 0;
     setmybit(&ft245r_sck, pgm->pinno[PIN_AVR_SCK], 1);
@@ -515,7 +551,10 @@
     setmybit(&ft245r_reset, pgm->pinno[PIN_AVR_RESET], 1);
     ft245r_miso = 0;
     setmybit(&ft245r_miso, pgm->pinno[PIN_AVR_MISO], 1);
+    ft245r_buff = 0;
+    setmybits(&ft245r_buff, pgm->pinno[PPI_AVR_BUFF], 1);
 
+    if ((verbose>=2) || FT245R_DEBUG) printf("FT245R * DDR = %02X\n",ft245r_ddr);
     rv = ftdi_set_bitmode(handle, ft245r_ddr, BITMODE_SYNCBB); // set Synchronous BitBang
 
     if (rv) {
@@ -550,6 +589,7 @@
 static void ft245r_display(PROGRAMMER * pgm, const char * p) {
     fprintf(stderr, "%sPin assignment  : 1..8 = DBUS0..7, 9..12 = GPIO0..3\n",p);
     pgm_display_generic_mask(pgm, p, SHOW_AVR_PINS);
+    pgm_display_generic_mask(pgm, p, (1<<PPI_AVR_BUFF));
 }
 
 static int ft245r_paged_write_gen(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
_______________________________________________
avrdude-dev mailing list
avrdude-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avrdude-dev

Reply via email to