avrdudes / avrdude

AVRDUDE is a utility to program AVR microcontrollers
GNU General Public License v2.0
728 stars 137 forks source link

[patch #7244] TPI bitbang implementation #616

Closed avrs-admin closed 2 years ago

avrs-admin commented 2 years ago

Thu 15 Jul 2010 04:30:05 PM UTC

I have implemented the TPI protocol for serial bitbang programmers.

The code requires some work, so I'm posting what I have here. Please do let me know what changes need to be made so I can clean it up.

The first logical step was to implement pgm->cmd_tpi() for the serialbb programmer.

Code added in avr.c should somehow use the OPCODE structs, but I'm not sure what's the best way to change it since the read & write opcode do not contain the address but rely on a separate set-address opcode. Another opcode that's out of place is the SKEY instruction, which requires an operand of 8 bytes. This definitely cannot fit into the 32-bit "instruction format" defined.

The serialbb also does not implement a paged_load function, but TPI is faster when reading in blocks, therefore the code was inserted in avr_read & avr_write.

Constants in tpi.h (there is no tpi.c) should be somehow moved into the AVRPART struct, but TPI has so far been in a single product line, the ATtiny4/5/9/10 which share the same I/O addresses.

file #20985: avrdude-tpi-bb.patch file #23833: updated-tpi-bb.patch

This issue was migrated from https://savannah.nongnu.org/patch/?7244

avrs-admin commented 2 years ago

Joerg Wunsch Wed 17 Aug 2011 02:36:03 PM UTC

Cool!

Curious, shouldn't this also work on parallel bitbang adapters, as the entire bitbanging is abstracted inside AVRDUDE?

Somehow, I think the new feature should be mentioned in the documentation as well.

avrs-admin commented 2 years ago

Darell Tan Thu 18 Aug 2011 03:05:28 AM UTC

Yes it should work on parallel bitbang adapters too, as long as they implement the getpin, setpin, and highpulsepin functions.

Where should I document this? It should work like any other bitbang programmer, except that the MISO and MOSI pins should connect to TPIDATA, with MOSI through a 1k resistor.

The wiring diagram looks something like this: http://irq5.files.wordpress.com/2010/07/attiny10-bitbang-prog.png

avrs-admin commented 2 years ago

Joerg Wunsch Thu 18 Aug 2011 02:27:49 PM UTC

Yes it should work on parallel bitbang adapters too, as long as > they implement the getpin, setpin, and highpulsepin functions.

That's the case, see par.c.  You might want to fill in the

pgm->cmd_tpi        = bitbang_cmd_tpi;

line there as well.

Where should I document this?

In doc/avrdude.texi, somehow in the verbal description of the -P option.

It should work like any other bitbang programmer, except that > the MISO and MOSI pins should connect to TPIDATA, with MOSI through a 1k resistor.

This information could go into the "Troubleshooting" section, which (despit its name) more and more becomes a kind of FAQ.

avrs-admin commented 2 years ago

Joerg Wunsch Tue 23 Aug 2011 09:07:27 PM UTC

Thanks for your great work!  Committed in r976.

I couldn't get my "ponyser" programmer to talk to an ATtiny10, but my (parallel-port based) "bsd" one does, so I think all is fine.