patchAVR Downloader/UploaDEr - Patches: patch #7486, Patch to add FT2232C/D, FT2232H,...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #7486: Patch to add FT2232C/D, FT2232H, FT4232H, usbvid, usbpid, usbdev for USB support - Based on #7062

Submitter:  Doug S <rickyrockrat>
Submitted:  Mon 28 Feb 2011 06:04:12 PM UTC
   
 
Category:  None Priority:  6
Status:  Done Privacy:  Public
Assigned to:  joerg_wunsch Open/Closed:  Closed

Jump to the original submission

Thu 25 Aug 2011 04:16:37 PM UTC, comment #14: 

Committed in r979, thanks to everybody involved into this!

And, please help eliminating the toplevel static variables.

Joerg Wunsch <joerg_wunsch>
Group administrator
Thu 25 Aug 2011 04:06:44 PM UTC, comment #13: 

Minor notes while I'm making a final cosmetic sweep over the
code (prior to committing it):

. Please eventually turn the toplevel static variables into
  per-programmer private data (see other programmers about
  that); I'll commit the code as is, but they should go away.

. I removed all trailing white spaces, and tried to unify
  the style quite a bit (in general, this means a lot of
  added white space around arithmetic operators, after an
  "if" etc.), as well as limit the line length where possible.

. _FUNCTION_ is a GCC extension (C99 names it _func_).
  As it's only been used once, I inserted the (well-known
  at this place) function name manually.

. A failed malloc() does never set errno, so there's no point
  in evaluating it in the error message.

. Use the ! operator within a condition only to express a
  logical negation, rather than as a lazy shortcut for == 0
  (which is simply more descriptive to humans).

. The various exit() statements should probably be avoided
  wherever possible (the code goes into a library!), replaced
  by error returns which of course have to be handled by the
  caller.

Please double-check I did not break anything.

Joerg Wunsch <joerg_wunsch>
Group administrator
Thu 25 Aug 2011 01:38:25 PM UTC, comment #12: 

I've figured out why you are getting the pin_no>11, it is because you are using a C/D device but 2232HIO is for a H device. C/D do not have as many pins available on each port, but the debug messages don't say which part it is (other than 0x500). 

So I've added debug text and moved the init that used pin_direction down below where pin_direction is set. Technically, I'm not sure it makes a difference, but this will eliminate any potential bugs. I've decided to just add absolute patches each time, so this patch includes and supersedes all others.  I presume it works against r952, though did not test.

(file #23868)

Doug S <rickyrockrat>
Thu 25 Aug 2011 05:21:39 AM UTC, comment #11: 

Hmm, so I don't know what happened. I've taken my patches and applied them against SVN, both 952 and the latest 978, and I get:

avrdude -c 2232HIO -p t13 -U flash:r:x.out:i
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9007
avrdude: reading flash memory:
Reading | ################################################## | 100% 0.24s
avrdude: writing output file "x.out"
avrdude: safemode: Fuses OK
avrdude done.  Thank you.

So something is off somewhere. I've attached the latest patch that should work against the latest (978) SVN. I included Jason's fix in this last one. avrdude-add2232CDHR5-r978.patch should work against 952 also.

So try a clean checkout of SVN, apply the patch, and try again.

(file #23866)

Doug S <rickyrockrat>
Thu 25 Aug 2011 01:32:27 AM UTC, comment #10: 

Jason Hecker said:> avrftdi.c:96 avrftdi_flush() ftdi_read_data(&ftdic, buf, 1) != 1: Device busy (16)

I too ran into this problem and fixed it by deleting the function
avr_flush() and replacing the only call to avr_flush() with:

E(ftdi_usb_purge_buffers(&ftdic));

Worked like a charm.

(Disclaimer - 'worked like a charm' with the development
libftdi/libusb-1.0 but should work with the older version).

Can you check to see if this works for you, Joerg?  I'll verify it doesn't break anything here with my devices.

If it all checks out, I propose I submit a new patch file that includes includes all updates to this point.

Doug S <rickyrockrat>
Wed 24 Aug 2011 08:08:16 PM UTC, comment #9: 

OK, I finally had a chance to try this on my FreeBSD machine
(the Linux machines I've got access to don't allow me to
access an unknown FTDI device).

I've got an OpenOCD-USB:

http://www2.embedded-projects.net/index.php?page_id=256

which I believed were compatible with the "avrftdi" wiring.

All I get is:

% ./avrdude -p m128 -c avrftdi -C avrdude.conf -B10

avrftdi.c:96 avrftdi_flush() ftdi_read_data(&ftdic, buf, 1) != 1: Device busy (16)
        all fine
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

(See attachment for full -vvvv log.)

When I try the 2232HIO programmer, I get:

% ./avrdude -p m128 -c 2232HIO -C avrdude.conf -B10
avrdude failure: invalid pin definition (pin no > 11) in config file
pin function no 7, pin no: 0xc

avrdude done.  Thank you.


(file #23864)

Joerg Wunsch <joerg_wunsch>
Group administrator
Thu 17 Mar 2011 09:06:22 PM UTC, comment #8: 

According to my research, a lot of people in Poland, would feel happy, if this patch will be applied into official version of AVRDUDE comming with WinAVR. Quite a lof of us, have FTDI based boards.

Mad Bekon <madbekon>
Tue 01 Mar 2011 02:56:23 PM UTC, comment #7: 

I missed one of the documentation changes I had made in doc/avrdude.texi. This is an additional patch, so File 22817 should be appended to 22812.

Doug S <rickyrockrat>
Mon 28 Feb 2011 09:52:18 PM UTC, comment #6: 

File 22812 supersedes 22809. i.e. it should be used instead of 22809.
22812 has been tested with two parts, a 2232H and a 2232D plugged in at the same time to the usb bus, both with VID 0403 and 6010, and the serial number selector works as it should.


Doug S <rickyrockrat>
Mon 28 Feb 2011 09:47:46 PM UTC, comment #5: 

Actually avrftdi is a device type, like the parallel port driver. Any number of 2232 based programmers can be implemented off of this, just like the myriad parallel port drivers - all have to go through the parallel port & drivers.

avrftdi is the generic form, and I've implemented a 2232HIO based on the avrftdi.

Doug S <rickyrockrat>
Mon 28 Feb 2011 07:06:14 PM UTC, comment #4: 

Just a comment about naming of programmers like this that repurpose general interfaces (bitbang or otherwise): there's more than one wire-level protocol used for programming AVRs, so the name of the interface should reflect that.  In particular, I hope at some point to implement a FT2232/4232 module for the PDI interface (Xmega).

I haven't kept up on these, but it looks like avrftdi is an existing module and this extends it to the 2232 etc, so it's probably too late to change its name, but it's something to consider in the future.

Erik Walthinsen <omega>
Mon 28 Feb 2011 06:35:27 PM UTC, comment #3: 

Links in the docs is fine, maybe also in the patched
portion of avrdude.conf.in, as this is what people easily
do have at their hands.  I think one link per site would
be enough (assuming you could always navigate from there
to other devices on the same site).

A separate patch for the docs is fine, but I don't mind
much which form.  Pick whatever is easier for you to do.

Joerg Wunsch <joerg_wunsch>
Group administrator
Mon 28 Feb 2011 06:31:46 PM UTC, comment #2: 
Doug S <rickyrockrat>
Mon 28 Feb 2011 06:12:10 PM UTC, comment #1: 


> What do I need to do to get this into AvrDude?


Document it. ;-)  Both, avrdude.1 and doc/avrdude.texi should
be updated.

Otherwise, at a quick glance, it looks fine to me.  Please
also indicate one (or more) URLs of example programmers
that could be used with this patch.  I've got a generic
FT2232 board around, and would like to give it a try.

Joerg Wunsch <joerg_wunsch>
Group administrator
Mon 28 Feb 2011 06:04:12 PM UTC, original submission:  

I recently designed a programmer based on the FT2232H part from FTDI, and I came across hannes_weisbach's patch, then contacted him. He had made some changes to the patch to apply against SVN 952.

This supersedes Patch #7062. I would have submitted this patch there, but I got a 'This form has already been submitted' error. 

I then took his updated patch, applied against 952, then spent several days flushing bugs and verifying it works with my FT2232H programmer.

I asked if he minded that I try to get this patch into AvrDude, and he told me to go right ahead.

I can be contacted at gpib at rickyrockrat net for any questions or comments. Hannes has a FT4232H that he can test with, and I have both FT2232D and FT2232H parts to test against.

What do I need to do to get this into AvrDude?

Thanks,
Doug

Doug S <rickyrockrat>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #23868:  avrdude-add2232CDHR6-r978.patch added by rickyrockrat (38KiB - text/x-patch - This includes and superceeds all others. Apply to SVN 978. Should work with SVN 952 also.)
file #23866:  avrdude-add2232CDHR5-r978.patch added by rickyrockrat (38KiB - text/x-patch - This patch superseeds all others. It is encompasses all the others and adds the flush fix above. Works with 952 and 978 SVN versions)
file #23864:  avrftdi.log added by joerg_wunsch (7KiB - application/octet-stream - -vvvv log)
file #22817:  avrdude-avrdude.texi-r952.patch added by rickyrockrat (1KiB - text/x-patch - Documentation changes to avrdude.texi for avrftdi patch.)
file #22812:  avrdude-add2232CDHR3-r952.patch added by rickyrockrat (38KiB - text/x-patch - Patch that adds usb serial to the config, and adds documentation.)
file #22809:  avrdude-add2232CDHR2-r952.patch added by rickyrockrat (33KiB - text/x-patch - This is an updated patch that adds a usbdev to the config that allows interface selection. It also supports 2232C/D 2232H, and 4232H parts.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by madbekon (Posted a comment)
  • -email is unavailable- added by omega (Posted a comment)
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by rickyrockrat (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-08-25 joerg_wunsch StatusNone Done
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed
    2011-08-25 rickyrockrat Attached File- Added avrdude-add2232CDHR6-r978.patch, #23868
    2011-08-25 rickyrockrat Attached File- Added avrdude-add2232CDHR5-r978.patch, #23866
    2011-08-24 joerg_wunsch Attached File- Added avrftdi.log, #23864
    2011-03-01 rickyrockrat Attached File- Added avrdude-avrdude.texi-r952.patch, #22817
    2011-02-28 rickyrockrat Attached File- Added avrdude-add2232CDHR3-r952.patch, #22812
    2011-02-28 rickyrockrat Carbon-CopyRemoved -email is unavailable- -
    2011-02-28 rickyrockrat Carbon-CopyRemoved -email is unavailable- -
    2011-02-28 rickyrockrat Attached File- Added avrdude-add2232CDHR2-r952.patch, #22809
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code