Home ==> Micro beginner ==> 1. ISP
ATtiny13

Lecture 1: A ISP programming interface


1.0 Overview

  1. Introduction
  2. Hardware
  3. Components and mounting
  4. Operation

1.1 Introduction

To understand microprocessors one needs to access the processor's internal components via a programming interface. With that, one can Without this programming interface nothing goes, the processor sleeps and does absolutely nothing.

In these lectures programming is performed within the readily mounted electronic systems. This is called "In-System Programming" or ISP. This shows what is needed:

Programming
This has immense advantages: the final electronic system works immediately after programming, no further and unnecessary interfaces or systems are between you and the microprofessor and limit or modify your connection with the processor. Bye bye complicated cable orgies, such as with an STK500 or an Arduino. The current supply of the electronic system is not affected at all.

The ISP interface of the AVR works in all device types in the same manner, no matter if the device has six oder 96 pins. If your application system does not allow to access the three portpins used for the ISP interface just switch to the next larger device, change a few lines of your software to adapt to the new type and program this into the new device in your electronic system.

If you built in the six pin ISP plugin into your system, you can easily re-program the device. No need to unmount the processor or to solder new connections.

In this chapture we are learning to access the processor within the system and to read its device identifier. The other possibilities to change the chip's properties are demonstrated in brief.
Home Top Einführung Mounting Operation

1.2 Hardware

1.2.1 The programming device

Many different programming devices can be used. I use an ancient AVR-ISPmkII of ATMEL. This is a handy device, provides the desired six pin ISP connector and works perfectly with ATMEL's Studio. The following examples were all prepared with that. It is not available in ATMEL's store any more, so you'll have to switch to one of the many clones available.

1.2.2 The programming hardware

Programming Interface The necessary hardware to access the AVR is shown here.

The supply of the system is performed by an AA four-pack rechargeable battery, with 1.2 V each. As AVRs are optimized to require very low current, a power supply would be overdone.

Via the three pins MOSI, MISO and SCK the communication between the programming device and the AVR is done. The AVR enters programming mode if the RESET pin (pin 1 of the ATtiny13) goes to low (which the programming device initiates via the RST line of the 6-pin ISP). Without active programming this pin is tied to the positive operating voltage with a resistor of 10 k, allowing the processor to do his work.

Between the positive and negative supply voltage, near to the processor's supply pins, a ceramic capacitor of 100 nF blocks high-frequency peaks that result from the processor's rectangle switching internals.

The pins of the processor are named with the active function that is used here. Each pin has additional names, depending from its use and function. Pins can change their function only if programmed to do so.

With this simple hardware we can communicate with the AVR and can access its internals.
Home Top Introduction Hardware operation

1.3 Components and mounting

1.3.1 Components

The rechargeable battery pack

LEFT RIGHT

This is the rechargable battery pack used. If you use batteries that are not rechargeable, use only three of those. You can use anything that provides between four and five Volts.

The ISP6 plug

The ISP plug is a two-row by three pins each male connector. For the use on a breadboard an adapter is necessary.

ISP6 plug 2 ISP6 plug 3 This adapter has to be self-mounted. For this a 3-by-4 wide piece of a printed circuit board with isolated eyes is cutted. On the soldering side a 2-by-3 plug connector is attached and soldered (with plugs only as deep in the whole as necessary so that soldering is still enabled). On the other side of the board two 3-pin plug connectors are soldered in and the neighboring eyes are soldered together as shown.

The 10k resistor

Resistor 10k Those here are two different types of resistors. In the upper part a carbon film, in the lower part a metal film resistor with 10 k is shown. The color coding of the rings is demonstrated.

The 100 nF ceramic capacitor

Ceramic capacitor 100nF This here is such a capacitor.

The 8 pin socket

DIP8 socket Into this socket the microprocessor can be plugged in.

The ATtiny13

ATtiny13-20PU ATtiny13-20PU This is the microprofessor, even though it does not look alike. In the package many hardware is sleeping and can be attached to its eight legs, which are numbered in an unconventional way (left picture). At least pin 1 can be found easily, because it has several markings. First of all a small triangle is printed near this leg. Second, a small pit can be seen there. And third a small notch is on the side of the chip that holds leg #1. With those characteristics it is nearly impossible to plug in the chip the wrong way.

Of course, the processor does not fit into the socket above. His legs do not exactly point downwards but a little bit to the side. To correct this one can correct the four legs by pressing the chip cautiously on a hard surface and to move the four pins of each side slightly inwards. If you do not do that the risk is high that the legs are bent during pressing the chip into the socket. That means danger to the life of Mr. Professor and it is very funny to staighten those legs without loosing parts or all of them and then to move the whole chip to the recycling bin.

1.3.2 Mounting

The breadboard

Breadboard This is a part of the breadboard. A breadboard is an experimental or devellopper system. Pins of components can directly be plugged into the holes and are contacted. The board allows to test electronic systems and the software before the whole goes into mass production (which is never the case with the systems we build in the upcoming lectures).

Breadboard connections The green lines show which holes are interconnected (in the lower part of the picture only five connections are shown. The upper two rows are for the supply voltage, the lower columns for components. From that it is clear why the ISP6 plugin had to be altered: the separation line in the middle of the board lines is two rows from each side and in the component area such a two-row plug would be short-circuited.

Mounting

Mounting goes as follows:
  1. Place the ISP6 plugin and the IC socket on the board.
  2. Wire supply and direct connections.
  3. Place and wire all other components (resistor, capacitor).
  4. Check all connections between the ISP plugin and the IC socket using a multimeter in resistor measurement mode.
  5. Connect the supply (rechargeable battery pack) with the supply lines of the board.
  6. With the multimeter in DC measurement mode check that pin 4 of the IC socket is connected to GND or Minus of the battery pack und pin 8 with VCC or plus. Similiary check that on the ISP6 plugin on pins 6 (GND, Minus) und 2 (VTG, Plus). Check that voltage and polarity is correct.
  7. Then push the ATtiny13 into the socket. Now plug the the programmer into the USB (check that the JUNGO driver is loaded correct) and connect with ISP6. The control lamp of the programmer should turn to green if the voltage is correct.
Leaving out single steps in that row (especially steps 4 and 6) ends in error messages. To debug those errors you will have to redo those steps, so why not doing those from the early beginning?

The following pictures show the stages of mounting.

Mounting components So the mounting of all components looks like. The supply and the ATtiny13 are not yet in place to do the testing.

Supply The rechargeable battery pack adds voltage, but still without the tiny and the programmer. Now check polarities and voltages to not kill the Tiny with over-voltage or reverse polarity.

Programmer Now anything is complete and the AVR-ISPmkII is plugged in. The green LED signals that he is correctly connected to the USB plug and that the voltage on the ISP6 plugin is correct. A red LED would signal that something is wrong.

Now one can start the experiments and the access to the interior of Mister Professor.
Home Top Introduction Hardware Mounting

1.4 Operation

To access the interior of the professor we need some software. One gets this for free from ATMEL if we search there in the 8-bit section for "Studio", but only under Windows. Check that your harddisk has lots of free space, because the software elephant requires well over one Gigabyte.

The following examples were produced using version 4 of the studio, an older version of that. It works similar to versions 5, 6 or 7 (at least for our purposes). Right at the beginning of a project select "Assembler".

Studio project So the Studio looks right after start: it requests to generate a new project. We select an assembler project, select a meaningful name for that, let the Studio generate a source file with the same name in the selected folder and go to the Next button.

Device selection We select the simulator as platform and as device an ATtiny13.

Studio start For the exploration of the internals the tools menue is decisive.

Tools autoconnect After plugging the programmer to an USB jack we select within the tools menue "Program AVR" und "Auto Connect" and hope the programmer is identified automatically.

The tools window If the USB jack is correctly identified and the programmer has told the Studio that he is an AVR-ISPmkII, the tools window opens. In that window we select the tab "Main".

Properties Here several selections have to be made. In the field "Device and Signature Bytes" we select ATtiny13, but do not yet press the button "Read Signature". First we read in the result field what the software tells us about its result.

Then we ensure that in the "Programming Mode and Target Settings" the ISP mode is selected and that the ISP frequency is below 300 kcs/s (if not: press button "Settings" and adjust the frequency. The we can read the signature bytes of the chip.

Signature This is the report of the programmer. It has read the signature, compared the result with the ATtiny13 and comes to the conclusion that the signature is correct. Anything works well and all functions correct.

Error If not then this or a similar error message comes up. We then enter error message debug mode and measure voltages, connections and act like described above.

Fuses To just have a view on the fuses of Mister Professor, we select the tab "Fuses". We should not change something here because unwanted changes can have the consequence that nothing goes any more and any access to the chip vanishes. Who wants to already know at this point what the fuses do takes a view into the Device Databook of the ATtiny13 (to download under this address, 176 pages).

Lockbits This here hides behind the tab "Lockbits": the switches to disable reading out the flash storage. Those can only be overwritten if the whole storage is cleared (using the button in tab "Main"). Perfect software protection.

So far the internals of Mister Professor. More later on.
Home Top Introduction Hardware Mounting Operation

©2017 by http://www.avr-asm-tutorial.net