FTDI programmer device name space--suggestions?
2005-09-24 by Johnathan Corgan
I am continuing my work to add an inboard FTDI USB<->serial converter-based bit bang programming mode to avrdude. This allows one to wire MOSI/MISO/SCLK/RESET to the FTDI bit-bang bus and have USB based in-circuit programming of an AVR. So, one could use an FT232BM or similar part to not only provide a simple USB interface to an AVR project for normal communications, but also to reuse this same set up for in-circuit programming. I've had this working for several weeks now in experimental form, using FTDI's FTD2XX driver library on Windows and libftdi under Linux. My own project is a USB-powered peripheral device with an FT232BM and an ATmega8, and flash updates over the USB are pretty convenient. Anyway, I'm trying to formalize this functionality and make it ready for general inclusion in avrdude (potentially as part of the 5.1 release), and I'm struggling with what "name space" I should use to designate the "port" (-P command line parameter.) Under Windows, using FTD2XX, the open call to access an FTDI device on the bus takes an integer device number, which corresponds to the order the bus scan finds FTDI chips. Alternatively, one can specify a USB device name string or serial number string. Under Linux, using libftdi, the open call takes an integer vendor ID/product ID pair, optionally qualifying them with a device name string or serial number string. The ID pair is required; the strings are simply used to further restrict the device selection if they are supplied. Finally, certain FTDI parts are dual-interface, and one must choose which interface. Under the FTD2XX library in Windows, these enumerate as separate devices during bus scan so one would just use a different integer in the open call. Under libftdi, one has to select the interface once opened with a different call, passing a 0 or a 1. So, what's a good way to supply this to -P in avrdude? I can see something like: -P <vendor ID>:<product ID>:<desc>:<serial>:<interface> or -P <devnum> with suitable defaults for blank fields. But this seems overly complicated, and which one to use is platform dependent. (It's also a lot of work to program and debug :-) I know the FTDI/AVR combination is a (relatively) small subset of the AVR community, but I'm sure there are others besides myself who would benefit from this and I want to get it right. Comments? -Johnathan