Am 03.07.2012 um 16:10 schrieb Darell Tan: > Hi Hannes, > > I took a quick look at the avrftdi code and realised it re-implemented > a lot of the pgm functions. In theory, it should have been enough to > implement just the cmd() function to "buffer" the op itself, to tell > the serial engine to generate the CLK and MOSI signals. And of course > the setpin() function to turn off/on LEDs or the RESET line. Yes. In fact, that is what my first prototype did. However, without paged read/write it would is rather slow. Especially with the old USB1.1-devices. I tie the /RESET line to TMS, so you could even leave that out - it is changed automagically. And who needs LEDs? :) > > If I had the time, I would implement TPI over avrftdi too, but it > seems like I need to copy/paste (or re-implement) the TPI logic into > avrftdi, which is not an elegant solution. If the code in avr.c could > be re-used, then it would have been really simple to get TPI working > for avrftdi. I've had only looked at the TPI protocol definition, not what is already available. But I agree that implementing TPI with avrdude would be rather hack-ish. My current approach would be to transmit 2 bytes with the lower 12 bits as the TPI-frame and the higher 4 bits as '1' ("idle"). For reading, I would read in 2 bytes, with the TPI-frame in the upper 12 bits. Of course, it would be possible to transmit one byte and 4 bits (since MPSSE can clock single bits). But I think this could incur more overhead (shifting bits around, more control information than data). Luckily, PDI is very similar (without the /RESET line), so we could possibly get away with implementing the "physical" layer once.
Best regards, Hannes _______________________________________________ avrdude-dev mailing list avrdude-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avrdude-dev