Micro beginner ==> 1. ISP
Lecture 1: A ISP programming interface
To understand microprocessors one needs to access the processor's internal components
via a programming interface. With that, one can
- Components and mounting
Without this programming interface nothing goes, the processor sleeps and does absolutely
- transfer program code to the processor, or
- delete this program code,
- select the clock source for clocking the device,
- transfer data to the EEPROM inside,
- read internal program code and EEPROM content, and
- protect the chip against reading of its content.
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:
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.
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
1.2.2 The programming hardware
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.
The rechargeable battery pack
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.
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
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
This here is such a capacitor.
The 8 pin socket
Into this socket the microprocessor can be plugged in.
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.
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).
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 goes as follows:
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
- Place the ISP6 plugin and the IC socket on the board.
- Wire supply and direct connections.
- Place and wire all other components (resistor, capacitor).
- Check all connections between the ISP plugin and the IC socket using a multimeter
in resistor measurement mode.
- Connect the supply (rechargeable battery pack) with the supply lines of the
- 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.
- 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.
The following pictures show the stages of mounting.
So the mounting of all components looks like. The supply and the ATtiny13 are not yet
in place to do the testing.
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
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.
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".
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.
We select the simulator as platform and as device an ATtiny13.
For the exploration of the internals the tools menue is decisive.
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
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".
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.
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.
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.
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).
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.
©2017 by http://www.avr-asm-tutorial.net