summaryrefslogtreecommitdiff
path: root/readme.win
blob: 477d7b6d319f0dc95eb0e7fd286a39a429478022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

NAME

   SP12: A serial programmer for working with Atmel AVR uCs.
   Copyright (C) 1997-2003 Ken Huntington, Kevin Towers, Pitronics.
 
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation; either version 2
   of the License, or (at your option) any later version.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston,
   MA  02111-1307, USA.
 
   Pitronics can be reached by email: sbolt@xs4all.nl
   Kevin Towers can be reached by email: ktowers@omnexcontrols.com
   Ken Huntington can be reached by email: kenh@compmore.net

URL
     The home page for sp12 is
     http://www.xs4all.nl/~sbolt/e-spider_prog.html

DESCRIPTION

   Sp12 version 2.0 is a serial mode (in-circuit) programmer for the
   AVR family of microcontrollers. When new AVR uCs arrive, you can
   easily add support for them yourself, by adding a plain text entry
   to the runtime configuration file _sp12dev. Editing this file also
   allows you to customize the way sp12 deals with existing uCs.
   
   Customization means, among other things, that you can define the
   write (high, extended) fuses commands so they won't touch the bits
   that can lock you out of your uC. For instance, the Mega8 and the
   Tiny15 both allow serial mode access to RSTDISBL, which can take
   away the resetpin - thus ending serial mode programming access.
   The Tiny15 also permits writing to SPIEN. If you use the _sp12dev
   entries as provided, these fuses will never be altered by user
   errors.
   
   Sp12 is one of the few programmers capable of uploading new
   software to several uCs on a single target, in one go. Yet it is 
   a small and simple command line tool, easy to use in scripts and
   batch files. 

   Depending on your PC and target, the hardware can be as simple as
   a nearly plain cable between your target and a parallel port.
   A special `dongle' design is available to improve the signal
   quality and make the programming lines high-Z unless sp12 is
   active.
   Sp12 can also adapt its use of the paralel port to the
   cable/dongles supplied with the Kanda STK200/300 starter kits.

INSTALLATION

   If you are running Win 3.1/95/98, SP12 will run normally without
   any added device drivers.  If you are running Win NT/2000/XP, you
   will need to install the GIVEIO device driver.

   Installing Giveio:

   To install the device driver you need Dale Roberts' device driver
   giveio.sys and the program instdrv.exe.  Both of these are included
   in the WinNT sub-directory of the sp12-Win32 package. The
   original files and documentation for Giveio can be found at
   (http://www.ddj.com/ftp/1996/1996.05/directio.zip).  Instdrv is 
   from the device driver kit (DDK) for Windows NT.
   
   * Copy the driver giveio.sys from the archive directio.zip into
     %SystemRoot%\system32\drivers. 
   * Use command line to install the driver using instdrv:
           instdrv giveio %SystemRoot%\system32\drivers\giveio.sys

   * In order to start this driver at every reboot automatically,
     change the start up behaviour to automatic:
       * 2000/XP: start regedit and change the value of the key "Start" in
                "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\giveio" to 2. 
       * NT: Control Panel->Devices->giveio->Start Up->Automatic.

   Sp12.exe should be put somewhere in your PATH. It is advisable
   to set the environment variable SP12 by adding a line like
   "Set SP12=C:\SP12\" to your environment. Sp12 looks for two
   files in the directory pointed to by this variable: _sp12dev and
   _sp12rc. Without it, you'll need copies of those files in all
   your project directories.

   Copy _sp12dev into the chosen directory, and run
   
      sp12 -i
   
   To make sp12 create an _sp12rc for your system. Depending on your
   computer it may take a few seconds or somewhat longer to
   calibrate the timing loop.

   Note: If heavy multitasking is going on, the autocalibration will
   produce time constants which are too small. Therefore _sp12rc
   should be created on a lightly loaded system.  When you are
   actually programming an uC, heavy background loads may slow down
   the job, but they won't really hurt; the AVR serial mode
   programming time constraints are minimum values.
   _sp12rc is in plain language and may be edited (with care), for
   instance to make SP12 use a different parallel port (read
   _sp12rc and sp12rc.txt for details). 

   Finally, run
   
      sp12 -t
   
   The command presents a progress bar, which should take about 10
   seconds to complete, counting from the moment when you hit the
   return on the command line. (There may a brief pause before the
   bar appears, which nevertheless is part of the ten seconds.) 
   I wouldn't worry if it's eight or 15 seconds. But the deviation
   is large,  read `bugs & bother' below.

BUGS & BOTHER
   
   Certain time constants necessary for proper upload of flash and
   eeprom data (serial clock sck low & high, write delay) are
   realized by autocalibration based on timing nearly empty loops.
   
   So for starters, you should let sp12 generate its runtime
   configuration file (_sp12rc) while your computer is lightly loaded.
   If heavy multitasking is going on, the autocalibration will produce
   time constants which are too small. When you are actually
   programming an uC, heavy background loads may slow down the job,
   but they won't really hurt; the AVR serial mode programming time
   constraints are minimum values.
   
   There is no obvious alternative for these loops, as for instance
   the usleep() function is often limited by the timer resolution of
   the system (to about 10ms). And this method usually works fine.
   However, trouble may occur when recompiling sp12 with compilers
   other than gcc.
                     
   If all else fails, you might edit the line

      LOOPCOUNT=<a number representing 1 second>

   in your _sp12rc, referring to the command "sp12 -t" and your
   watch to get it right.

PCI Cards

   When SP12 first runs, it will search the legacy addresses for existing
   parallel ports.  Any ports found will be listed in the _sp12rc file.
   PCI parallel cards typically don't get assigned to the legacy addresses
   (i.e. 0x278, 0x378, etc).  Use the Windows device manager to find out
   where your PCI card was assigned.  Then edit _sp12rc to assign this
   address to the PORT variable.

   eg.
   PORT=0xe800