Tiny Programming Interface (TPI)

The Atmel® Tiny Programming Interface (TPI) is featured on selected low-end Atmel AVR® microcontrollers, and allows external programmers to access the nonvolatile memory (NVM) of the device. The interface provides access to device lock bits, the program flash memory, and the signature, configuration, and calibration sections.

The TPI can be accessed via three pins:

  • RESET: TPI enable input
  • TPICLK: TPI clock input
  • TPIDATA: TPI data input/output

Therefore, it is only a small subset of AVR ATtiny microcontrollers that actually use TPI programming. They are listed here

  • ATtiny4
  • ATtiny5
  • ATtiny9
  • ATtiny10
  • ATtiny102
  • ATtiny104
  • ATtiny20
  • ATtiny40

These AVR ATtiny devices can be programmed using tools from ATMEL or simply using USBASP which mostly uses ATMEGA8A.

Both ATMEL STUDIO and MPLAB X supports ATtiny controller program development and programming the device.

We can use both AVRISP MKII or USBasp for programming device. There are other third party vendor IDE and compilers are available. Similarly there are other tools available from MICROCHIP or other vendors.

In this project we will see how to program the ATtiny chips using TPI protocol using ATMEL STUDIO, MPLAB X development environment along with AVRISP MKII and USBasp programmer. The scope of the project limited to ATtiny4/5/9/10 controllers only.

ATMEL STUDIO with AVRISP MKII:

This is one of the easiest and straight forward method to develop and program the ATtiny chips. Just write the code in C or assembly and program using many tools which includes AVRISP MKII.

ATtiny4/5/9/10 ICs comes in 2 package style. The easier one to handle is SOT23-6 package. We can have a small adapter board which converts SOT23-6 to DIP6 300mil. We can easily get 6 pin IC Base with machined round pins. We can find the similar board from HERE which is also having Sch and Layout files.

SOT23 to DIP6
ATtiny4/5/9/10 SOT23-6 to DIP6 300mil adapter board
T4
ATtiny4 SOT23-6 to DIP6 300mil adapter

To use a machined 6 pin IC base, we also need to have round pins in the adapter.

Adapter board, IC and machined pins

These round pins are useful for handling the ICs with a 6 pin IC base.

Most of the other designs for the same purpose uses square pins with square pin compatible header. We can use those square pins for programming, breadboard development and using male or female jumper wires. But we can not fit that into a normal IC base. Since 6 pin DIP IC base is commonly used for Optocouplers, it is readily available and directly mounts on the board.

PINS
Machined pins with 2.54mm pitch and 0.8mm thick
SOT23
Assembled ATtiny4, ATtiny9 and ATtiny10 ICs

Now we have the devices mounted on DIP6 formfactor IC adapter boards. The device marking on silk screen is optional. It is just easy to read and handle. There is a marking for pin 1 as white dot.

Now we have to make some arrangement for holding these devices between the programmer and the target ICs.

USBasp programmer uses 10 pin FRC connector and AVRISP MKII uses 6 pin connector. Depends on the programmer in hand, we need to decide which target board is useful.

ISP 10pin and TPI 6 pin connection details

10 pin target connector:

USBasp
10 pin target board used with USBasp programmer

The above board uses 10 pin connector similar to USPasp programmer. Many pins are unused or connected to VSS. The advantage is we can directly insert the IC and programmer connector into this board for programming. There is NO additional target POWER is required. 

The fully assembled board will look like below image

Assembled 10 pin target board used with USBasp

D3 and R1 and just power indicator. D2 and R2 are connected to the Target IC's RB2 port pin which is not used for programming. Both the feature are optional and not required for regular operation. U4 is 6 pin target holder. U3 is for direct soldering of SOT23-6 ATtiny IC without the adapter or IC base. Pay attention while inserting the target IC for pin number 1. Both...

Read more »