Close
0%
0%

PIC10f200 Tiny TPI programmer

A successful attempt to create a programmer for the Atmel Tiny 4-10 using a Microchip PIC10f200 and few discretes

Similar projects worth following
Take a 6 pin minimlistic PIC procesor, some discrete components, assembler software stir wel and lo we have a programmer for the so called "brain dead" Attiny 4-10 processors.
Ok it needs a serial device which can talk / listen at 9600 baud but that could be a dumb terminal or more llikely a PC with a USB to serila plug ...

Why ? because I wanted to do something other than just flash LEDs with the PIC and also the Atttinys.

The primary aim was to create a useful project to stretch the 256 word flash memory and limited IO (3 output and 1 input lines) of the PIC10F200 processor. Due to the limited flash space it became obvious that the code would need to be created in assembly language.

Initially testing was perfomed with the slighty larger 12F509 which has 6 IO pins and 1k words of flash, using using a Pickit2 with the low pin count board which allows testing bit banger serial IO via the Pickit2 UART tool.

After sorting the serial IO code was added to control the TPI connections to an Attiny 10 processor.

This involved the usual reading and re reading the data sheet for the Attiny after which it became apparent that the following routines would be required:

A routine to enable/disable the Attiny via the reset pin and hence enter/exit programming mode.

A TPI send byte routine which serially transmits to the Attiny

A TPI receive byte routine to get data from the Attiny

After that it was just -:) a case of tieing the above routines together to enable the Attiny by sending the appropriate 9 byte program enable key and send various access layer commands to read or write the flash.

Two problems then had to be solved before moving the code to the 10F200:

1. There were not enough pins available to handle 3 TPI control and 2 serial IO pins.

One pin was saved by using a technique found on Ralph Doncasters Blog to handle serail IO via one pin, take a look at http://nerdralph.blogspot.co.uk/2014/11/se8r01-24ghz-wireless-modules.html . I took his hardware idea ( thanks Ralph for the idea) and created PIC version of the assembler routines

But I was still short of 1 output pin for the TPI stuff ... again One of Ralphs ideas came to my assistance, http://nerdralph.blogspot.co.uk/2014/01/nrf24l01-control-with-3-attiny85-pins.html, which made it possible to use one pin to handle both the TPI clock and the Attiny reset pin.

2. The code was just TOO big ....

The only answer to this was to find areas that could be removed/compressed and to re think what was the absolute minimum required to program the destination Attiny. It came down to the following:

1 A command to enable and disable the chip

2 Method of setting the desired chip word address

3 A command to read one word from the chip

4 A command to write a word to flash

5 A command to Erase the flash

The programmer prompts with a newline followed by '#' symbol and waits for a character and treats that character as follows

N.B. All commands and hex alpha characters MUST be upper case.

The serial port command interface uses 8 commands A - H

A = "Address" sets the programmers address pointer needs to be followed by 4 hex digits 0-9 A-F

(ignores all non valid characters)

B = "Begin" enters programming mode

C = not used

D = "Disconnect" which exits programming mode and start the target Attiny running

E = not used

F = "Format" erase the flash of the target

G = "Get" reads the data form the current address and increments the address pointer and outputs it as 4 hex digits to the serial port

H = "Hexedit" waits for 4 hex digits and then immediately writes them to the current address , it also increments the local address pointer.

All other values just return to the prompt.

So it is possible using the above to program a target Attiny chip diretcly from a terminal e.g. teraterm

but not a lot of fun!!!!!

Simple Serial

A simple application was written to use the above commans to read a hex file, write it to the target and then starts the target chip:

On startup the application looks for USB serial ports and if it find them it opens an displays a list, if no serial ports are found it just exist silently.Once loaded select the port that it is connected to an click start. Click on the lower text box and hit the space bar ( an invalid command) it should then display a # prompt . At this point the above commands can be used.

As a test hit B it should echo the character and return the # prompt , then hit A3FC0 again it should echo and return the prompt. Press G it should...

Read more »

ReadMe.txt

Describes the files included in the source zip

plain - 904.00 bytes - 01/06/2017 at 00:53

Download

Samples.zip

contains sample files for testing the target Attiny

Zip Archive - 3.38 kB - 01/06/2017 at 00:51

Download

PICTPI.zip

source files plus simple loader program for Windows 10

Zip Archive - 389.42 kB - 01/06/2017 at 00:20

Download

  • 1 × PIC10F200 Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 3 × 10k resistor
  • 1 × 33k resistor
  • 1 × 1k resistor
  • 2 × 100 nF capacitor

View all 7 components

  • 1
    Step 1

    Use mpasmwin to build T10f200ProgCap2.asm it will create a new hex file

    Then program the hex file to a PIC10f200

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates