mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-16 18:44:17 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb61d895a5 | ||
|
|
2afd3d882e | ||
|
|
a566b4a888 | ||
|
|
9693e039cb | ||
|
|
7f188d48db | ||
|
|
477f1f1049 | ||
|
|
15d320cbfe | ||
|
|
83334a1794 | ||
|
|
122f2e8ec6 | ||
|
|
9858495500 | ||
|
|
007f4b378d | ||
|
|
f721cc0d53 | ||
|
|
ff700a8f1a | ||
|
|
4f47c560ac | ||
|
|
4f4497f94e | ||
|
|
e79a210517 |
@@ -1,3 +1,86 @@
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.5.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <bikenomad@gmail.com>:
|
||||
patch #5007: Patch for line-buffering of stdout and stderr
|
||||
* main.c: call setvbuf() for stdout and stderr.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <graceindustries@gmail.com>:
|
||||
patch #5953: Add AT90CAN64 and AT90CAN32 to avrdude.conf
|
||||
* avrdude.conf.in: Add entry for AT90CAN64 and AT90CAN32.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Wolfgang Moser:
|
||||
patch #6121: ISP support for the C2N232I device (serial port
|
||||
bitbanging)
|
||||
* avrdude.conf.in: Add entry for c2n232i.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <karl.yerkes@gmail.com>:
|
||||
patch #6141: accept binary format immediate values
|
||||
* fileio.c: Detect a 0b prefix, and call strtoul() differently
|
||||
in that case.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #21076: -vvvv serial receive prints are empty in Win32 build
|
||||
* ser_win32.c (ser_recv): Drop the essentially unused variable
|
||||
"len", and use the variable "read" in order to track how many
|
||||
bytes have just been read in.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #21145: atmega329p not recognized
|
||||
* avrdude.conf.in: Add definitions for the ATmega329P/3290P.
|
||||
Same as ATmega329/3290 except of the different signature.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #21152: Unable to program atmega324p with avrdude 5.4 and AVRISP
|
||||
using default configuration file.
|
||||
* avrdude.conf.in: Uncomment the (bogus) stk500_devcode lines for
|
||||
the ATmega164P, ATmega324P, ATmega644, and ATmega644P definitions.
|
||||
This only affects users of STK500v1 firmware.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <ladyada@gmail.com>:
|
||||
Patch #6233: Add support for USBtinyISP programmer
|
||||
* usbtiny.c: New file.
|
||||
* usbtiny.h: (Ditto.)
|
||||
* Makefile.am: Include usbtiny into the build.
|
||||
* avrdude.conf.in: (Ditto.)
|
||||
* config_gram.y: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.1: Document the usbtiny support.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* doc/avrdude.texi: Sort list of supported programmers into
|
||||
alphabetical order, add all missing programmers.
|
||||
|
||||
2007-07-24 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
* usbasp.c: Added long addresses to support devices with more
|
||||
than 64kB flash. Closes bug #20558: Long address problem with
|
||||
USBasp.
|
||||
|
||||
2007-06-27 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add ChangeLog-2004-2006.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version for post-release.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.4.
|
||||
|
||||
@@ -26,6 +26,7 @@ EXTRA_DIST = \
|
||||
ChangeLog-2001 \
|
||||
ChangeLog-2002 \
|
||||
ChangeLog-2003 \
|
||||
ChangeLog-2004-2006 \
|
||||
avrdude.1 \
|
||||
avrdude.spec \
|
||||
bootstrap
|
||||
@@ -137,6 +138,8 @@ libavrdude_a_SOURCES = \
|
||||
usbasp.h \
|
||||
usbdevs.h \
|
||||
usb_libusb.c \
|
||||
usbtiny.h \
|
||||
usbtiny.c \
|
||||
update.h \
|
||||
update.c
|
||||
|
||||
|
||||
@@ -5,6 +5,14 @@ Approximate change log for AVRDUDE by version.
|
||||
(For more detailed changes, see the ChangeLog file.)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Version 5.5:
|
||||
|
||||
* Add support for the USBtinyISP programmer (patch #6233)
|
||||
|
||||
* Add support for the C2N232I serial bitbang programmer (patch #6121)
|
||||
|
||||
* Bugfixes.
|
||||
|
||||
Version 5.4:
|
||||
|
||||
* New devices supported:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\"
|
||||
.\" avrdude - A Downloader/Uploader for AVR device programmers
|
||||
.\" Copyright (C) 2001, 2002, 2003, 2005, 2006 Joerg Wunsch
|
||||
.\" Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 Joerg Wunsch
|
||||
.\"
|
||||
.\" 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
|
||||
@@ -19,7 +19,7 @@
|
||||
.\"
|
||||
.\" $Id$
|
||||
.\"
|
||||
.Dd DATE October 26, 2006
|
||||
.Dd DATE October 29, 2007
|
||||
.Os
|
||||
.Dt AVRDUDE 1
|
||||
.Sh NAME
|
||||
@@ -127,11 +127,11 @@ frequency, so the
|
||||
.Fl B Ar bitclock
|
||||
option might be required to achieve a stable ISP communication.
|
||||
.Pp
|
||||
The USBasp ISP adapter is also supported, provided
|
||||
The USBasp ISP and USBtinyISP adapters are also supported, provided
|
||||
.Nm avrdude
|
||||
has been compiled with libusb support.
|
||||
It features a simple firwmare-only USB implementation, running on
|
||||
an ATmega8 (or ATmega88).
|
||||
They both feature simple firwmare-only USB implementations, running on
|
||||
an ATmega8 (or ATmega88), or ATtiny2313, respectively.
|
||||
.Pp
|
||||
Input files can be provided, and output files can be written in
|
||||
different file formats, such as raw binary files containing the data
|
||||
@@ -817,6 +817,6 @@ option) requires a prior chip erase.
|
||||
This is an inherent feature of the way JTAG EEPROM programming works.
|
||||
This also applies to the STK500 in parallel programming mode.
|
||||
.Pp
|
||||
The USBasp driver does not offer any option to distinguish multiple
|
||||
The USBasp and USBtinyISP drivers do not offer any option to distinguish multiple
|
||||
devices connected simultaneously, so effectively only a single device
|
||||
is supported.
|
||||
|
||||
@@ -229,6 +229,8 @@
|
||||
#define ATMEGA103 0xB1
|
||||
#define ATMEGA128 0xB2
|
||||
#define AT90CAN128 0xB3
|
||||
#define AT90CAN64 0xB3
|
||||
#define AT90CAN32 0xB3
|
||||
|
||||
#define AT86RF401 0xD0
|
||||
|
||||
@@ -377,6 +379,12 @@ programmer
|
||||
type = usbasp;
|
||||
;
|
||||
|
||||
programmer
|
||||
id = "usbtiny";
|
||||
desc = "USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/";
|
||||
type = usbtiny;
|
||||
;
|
||||
|
||||
programmer
|
||||
id = "butterfly";
|
||||
desc = "Atmel Butterfly Development Board";
|
||||
@@ -779,6 +787,19 @@ programmer
|
||||
miso = 8;
|
||||
;
|
||||
|
||||
# C2N232i (jumper configuration "auto")
|
||||
# reset=dtr sck=!rts mosi=!txd miso=!cts
|
||||
|
||||
programmer
|
||||
id = "c2n232i";
|
||||
desc = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts";
|
||||
type = serbb;
|
||||
reset = 4;
|
||||
sck = ~7;
|
||||
mosi = ~3;
|
||||
miso = ~8;
|
||||
;
|
||||
|
||||
#
|
||||
# PART DEFINITIONS
|
||||
#
|
||||
@@ -2969,6 +2990,386 @@ part
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
# AT90CAN64
|
||||
#------------------------------------------------------------
|
||||
|
||||
part
|
||||
id = "c64";
|
||||
desc = "AT90CAN64";
|
||||
has_jtag = yes;
|
||||
stk500_devcode = 0xB3;
|
||||
# avr910_devcode = 0x43;
|
||||
signature = 0x1e 0x96 0x81;
|
||||
chip_erase_delay = 9000;
|
||||
pagel = 0xD7;
|
||||
bs2 = 0xA0;
|
||||
reset = dedicated;
|
||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
|
||||
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
|
||||
timeout = 200;
|
||||
stabdelay = 100;
|
||||
cmdexedelay = 25;
|
||||
synchloops = 32;
|
||||
bytedelay = 0;
|
||||
pollindex = 3;
|
||||
pollvalue = 0x53;
|
||||
predelay = 1;
|
||||
postdelay = 1;
|
||||
pollmethod = 1;
|
||||
|
||||
pp_controlstack =
|
||||
0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
|
||||
0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
|
||||
0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
|
||||
0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01;
|
||||
hventerstabdelay = 100;
|
||||
progmodedelay = 0;
|
||||
latchcycles = 6;
|
||||
togglevtg = 0;
|
||||
poweroffdelay = 0;
|
||||
resetdelayms = 0;
|
||||
resetdelayus = 0;
|
||||
hvleavestabdelay = 15;
|
||||
chiperasepulsewidth = 0;
|
||||
chiperasepolltimeout = 10;
|
||||
programfusepulsewidth = 0;
|
||||
programfusepolltimeout = 5;
|
||||
programlockpulsewidth = 0;
|
||||
programlockpolltimeout = 5;
|
||||
|
||||
idr = 0x31;
|
||||
spmcr = 0x57;
|
||||
rampz = 0x3b;
|
||||
eecr = 0x3f;
|
||||
allowfullpagebitstream = no;
|
||||
|
||||
memory "eeprom"
|
||||
paged = no; /* leave this "no" */
|
||||
page_size = 8; /* for parallel programming */
|
||||
size = 2048;
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read = " 1 0 1 0 0 0 0 0",
|
||||
" 0 0 0 x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
write = " 1 1 0 0 0 0 0 0",
|
||||
" 0 0 0 x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
" 0 0 0 0 0 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 0 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
|
||||
mode = 0x41;
|
||||
delay = 20;
|
||||
blocksize = 8;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "flash"
|
||||
paged = yes;
|
||||
size = 65536;
|
||||
page_size = 256;
|
||||
num_pages = 256;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read_lo = " 0 0 1 0 0 0 0 0",
|
||||
"a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
read_hi = " 0 0 1 0 1 0 0 0",
|
||||
"a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
||||
" 0 0 0 x x x x x",
|
||||
" x a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
||||
" 0 0 0 x x x x x",
|
||||
" x a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
"a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 x x x x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 6;
|
||||
blocksize = 256;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "lfuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "hfuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "efuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
|
||||
"x x x x x x x x x x x x i i i i";
|
||||
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "lock"
|
||||
size = 1;
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x x x o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
|
||||
"x x x x x x x x 1 1 i i i i i i";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "calibration"
|
||||
size = 1;
|
||||
read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
|
||||
"0 0 0 0 0 0 0 0 o o o o o o o o";
|
||||
;
|
||||
|
||||
memory "signature"
|
||||
size = 3;
|
||||
read = "0 0 1 1 0 0 0 0 x x x x x x x x",
|
||||
"x x x x x x a1 a0 o o o o o o o o";
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
# AT90CAN32
|
||||
#------------------------------------------------------------
|
||||
|
||||
part
|
||||
id = "c32";
|
||||
desc = "AT90CAN32";
|
||||
has_jtag = yes;
|
||||
stk500_devcode = 0xB3;
|
||||
# avr910_devcode = 0x43;
|
||||
signature = 0x1e 0x95 0x81;
|
||||
chip_erase_delay = 9000;
|
||||
pagel = 0xD7;
|
||||
bs2 = 0xA0;
|
||||
reset = dedicated;
|
||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
|
||||
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
|
||||
timeout = 200;
|
||||
stabdelay = 100;
|
||||
cmdexedelay = 25;
|
||||
synchloops = 32;
|
||||
bytedelay = 0;
|
||||
pollindex = 3;
|
||||
pollvalue = 0x53;
|
||||
predelay = 1;
|
||||
postdelay = 1;
|
||||
pollmethod = 1;
|
||||
|
||||
pp_controlstack =
|
||||
0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
|
||||
0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
|
||||
0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
|
||||
0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01;
|
||||
hventerstabdelay = 100;
|
||||
progmodedelay = 0;
|
||||
latchcycles = 6;
|
||||
togglevtg = 0;
|
||||
poweroffdelay = 0;
|
||||
resetdelayms = 0;
|
||||
resetdelayus = 0;
|
||||
hvleavestabdelay = 15;
|
||||
chiperasepulsewidth = 0;
|
||||
chiperasepolltimeout = 10;
|
||||
programfusepulsewidth = 0;
|
||||
programfusepolltimeout = 5;
|
||||
programlockpulsewidth = 0;
|
||||
programlockpolltimeout = 5;
|
||||
|
||||
idr = 0x31;
|
||||
spmcr = 0x57;
|
||||
rampz = 0x3b;
|
||||
eecr = 0x3f;
|
||||
allowfullpagebitstream = no;
|
||||
|
||||
memory "eeprom"
|
||||
paged = no; /* leave this "no" */
|
||||
page_size = 8; /* for parallel programming */
|
||||
size = 1024;
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read = " 1 0 1 0 0 0 0 0",
|
||||
" 0 0 0 x x x a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
write = " 1 1 0 0 0 0 0 0",
|
||||
" 0 0 0 x x x a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
" 0 0 0 0 0 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x x a9 a8",
|
||||
" a7 a6 a5 a4 a3 0 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
|
||||
mode = 0x41;
|
||||
delay = 20;
|
||||
blocksize = 8;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "flash"
|
||||
paged = yes;
|
||||
size = 32768;
|
||||
page_size = 256;
|
||||
num_pages = 128;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read_lo = " 0 0 1 0 0 0 0 0",
|
||||
"a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
read_hi = " 0 0 1 0 1 0 0 0",
|
||||
"a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
||||
" 0 0 0 x x x x x",
|
||||
" x a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
||||
" 0 0 0 x x x x x",
|
||||
" x a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
"a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 x x x x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 6;
|
||||
blocksize = 256;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "lfuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "hfuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "efuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
|
||||
"x x x x x x x x x x x x i i i i";
|
||||
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "lock"
|
||||
size = 1;
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x x x o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
|
||||
"x x x x x x x x 1 1 i i i i i i";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "calibration"
|
||||
size = 1;
|
||||
read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
|
||||
"0 0 0 0 0 0 0 0 o o o o o o o o";
|
||||
;
|
||||
|
||||
memory "signature"
|
||||
size = 3;
|
||||
read = "0 0 1 1 0 0 0 0 x x x x x x x x",
|
||||
"x x x x x x a1 a0 o o o o o o o o";
|
||||
;
|
||||
;
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
# ATmega16
|
||||
@@ -3156,8 +3557,7 @@ part
|
||||
id = "m164p";
|
||||
desc = "ATMEGA164P";
|
||||
has_jtag = yes;
|
||||
# stk500_devcode = 0x82; # no STK500v1 support
|
||||
# avr910_devcode = 0x?; # try the ATmega16 one:^
|
||||
stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one
|
||||
avr910_devcode = 0x74;
|
||||
signature = 0x1e 0x94 0x0a;
|
||||
pagel = 0xd7;
|
||||
@@ -3348,8 +3748,7 @@ part
|
||||
id = "m324p";
|
||||
desc = "ATMEGA324P";
|
||||
has_jtag = yes;
|
||||
# stk500_devcode = 0x82; # no STK500v1 support
|
||||
# avr910_devcode = 0x?; # try the ATmega16 one:^
|
||||
stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one
|
||||
avr910_devcode = 0x74;
|
||||
signature = 0x1e 0x95 0x08;
|
||||
pagel = 0xd7;
|
||||
@@ -3540,8 +3939,7 @@ part
|
||||
id = "m644";
|
||||
desc = "ATMEGA644";
|
||||
has_jtag = yes;
|
||||
# stk500_devcode = 0x82; # no STK500v1 support
|
||||
# avr910_devcode = 0x?; # try the ATmega16 one:^
|
||||
stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one
|
||||
avr910_devcode = 0x74;
|
||||
signature = 0x1e 0x96 0x09;
|
||||
pagel = 0xd7;
|
||||
@@ -3731,8 +4129,7 @@ part
|
||||
id = "m644p";
|
||||
desc = "ATMEGA644P";
|
||||
has_jtag = yes;
|
||||
# stk500_devcode = 0x82; # no STK500v1 support
|
||||
# avr910_devcode = 0x?; # try the ATmega16 one:^
|
||||
stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one
|
||||
avr910_devcode = 0x74;
|
||||
signature = 0x1e 0x96 0x0a;
|
||||
pagel = 0xd7;
|
||||
@@ -4616,6 +5013,190 @@ part
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
# ATmega329P
|
||||
#------------------------------------------------------------
|
||||
# Identical to ATmega329 except of the signature
|
||||
|
||||
part
|
||||
id = "m329p";
|
||||
desc = "ATMEGA329P";
|
||||
has_jtag = yes;
|
||||
# stk500_devcode = 0x85; # no STK500 support, only STK500v2
|
||||
# avr910_devcode = 0x?; # try the ATmega169 one:
|
||||
avr910_devcode = 0x75;
|
||||
signature = 0x1e 0x95 0x0b;
|
||||
chip_erase_delay = 9000;
|
||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
|
||||
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
timeout = 200;
|
||||
stabdelay = 100;
|
||||
cmdexedelay = 25;
|
||||
synchloops = 32;
|
||||
bytedelay = 0;
|
||||
pollindex = 3;
|
||||
pollvalue = 0x53;
|
||||
predelay = 1;
|
||||
postdelay = 1;
|
||||
pollmethod = 1;
|
||||
|
||||
pp_controlstack =
|
||||
0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
|
||||
0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
|
||||
0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
|
||||
0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
|
||||
hventerstabdelay = 100;
|
||||
progmodedelay = 0;
|
||||
latchcycles = 5;
|
||||
togglevtg = 1;
|
||||
poweroffdelay = 15;
|
||||
resetdelayms = 1;
|
||||
resetdelayus = 0;
|
||||
hvleavestabdelay = 15;
|
||||
chiperasepulsewidth = 0;
|
||||
chiperasepolltimeout = 10;
|
||||
programfusepulsewidth = 0;
|
||||
programfusepolltimeout = 5;
|
||||
programlockpulsewidth = 0;
|
||||
programlockpolltimeout = 5;
|
||||
|
||||
idr = 0x31;
|
||||
spmcr = 0x57;
|
||||
|
||||
memory "eeprom"
|
||||
paged = no; /* leave this "no" */
|
||||
page_size = 4; /* for parallel programming */
|
||||
size = 1024;
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read = " 1 0 1 0 0 0 0 0",
|
||||
" x x x x x x a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
write = " 1 1 0 0 0 0 0 0",
|
||||
" x x x x x x a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
" 0 0 0 0 0 0 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x x a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 20;
|
||||
blocksize = 8;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "flash"
|
||||
paged = yes;
|
||||
size = 32768;
|
||||
page_size = 128;
|
||||
num_pages = 256;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read_lo = " 0 0 1 0 0 0 0 0",
|
||||
" x a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
read_hi = " 0 0 1 0 1 0 0 0",
|
||||
" x a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
||||
" x x x x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
||||
" x x x x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
" x x x a12 a11 a10 a9 a8",
|
||||
" a7 a6 x x x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 6;
|
||||
blocksize = 256;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "lfuse"
|
||||
size = 1;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
;
|
||||
|
||||
memory "hfuse"
|
||||
size = 1;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
;
|
||||
|
||||
memory "efuse"
|
||||
size = 1;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
|
||||
"x x x x x x x x x x x x x i i i";
|
||||
;
|
||||
|
||||
memory "lock"
|
||||
size = 1;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x x x o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
|
||||
"x x x x x x x x 1 1 i i i i i i";
|
||||
;
|
||||
|
||||
memory "signature"
|
||||
size = 3;
|
||||
read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
|
||||
"x x x x x x a1 a0 o o o o o o o o";
|
||||
;
|
||||
|
||||
memory "calibration"
|
||||
size = 1;
|
||||
read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
|
||||
"0 0 0 0 0 0 0 0 o o o o o o o o";
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
# ATmega3290
|
||||
#------------------------------------------------------------
|
||||
@@ -4801,6 +5382,191 @@ part
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
# ATmega3290P
|
||||
#------------------------------------------------------------
|
||||
|
||||
# identical to ATmega3290 except of the signature
|
||||
|
||||
part
|
||||
id = "m3290p";
|
||||
desc = "ATMEGA3290P";
|
||||
has_jtag = yes;
|
||||
# stk500_devcode = 0x85; # no STK500 support, only STK500v2
|
||||
# avr910_devcode = 0x?; # try the ATmega169 one:
|
||||
avr910_devcode = 0x75;
|
||||
signature = 0x1e 0x95 0x0c;
|
||||
chip_erase_delay = 9000;
|
||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
|
||||
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
timeout = 200;
|
||||
stabdelay = 100;
|
||||
cmdexedelay = 25;
|
||||
synchloops = 32;
|
||||
bytedelay = 0;
|
||||
pollindex = 3;
|
||||
pollvalue = 0x53;
|
||||
predelay = 1;
|
||||
postdelay = 1;
|
||||
pollmethod = 1;
|
||||
|
||||
pp_controlstack =
|
||||
0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
|
||||
0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
|
||||
0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
|
||||
0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
|
||||
hventerstabdelay = 100;
|
||||
progmodedelay = 0;
|
||||
latchcycles = 5;
|
||||
togglevtg = 1;
|
||||
poweroffdelay = 15;
|
||||
resetdelayms = 1;
|
||||
resetdelayus = 0;
|
||||
hvleavestabdelay = 15;
|
||||
chiperasepulsewidth = 0;
|
||||
chiperasepolltimeout = 10;
|
||||
programfusepulsewidth = 0;
|
||||
programfusepolltimeout = 5;
|
||||
programlockpulsewidth = 0;
|
||||
programlockpolltimeout = 5;
|
||||
|
||||
idr = 0x31;
|
||||
spmcr = 0x57;
|
||||
|
||||
memory "eeprom"
|
||||
paged = no; /* leave this "no" */
|
||||
page_size = 4; /* for parallel programming */
|
||||
size = 1024;
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read = " 1 0 1 0 0 0 0 0",
|
||||
" x x x x x x a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
write = " 1 1 0 0 0 0 0 0",
|
||||
" x x x x x x a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
" 0 0 0 0 0 0 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x x a9 a8",
|
||||
" a7 a6 a5 a4 a3 a3 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 20;
|
||||
blocksize = 8;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "flash"
|
||||
paged = yes;
|
||||
size = 32768;
|
||||
page_size = 128;
|
||||
num_pages = 256;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read_lo = " 0 0 1 0 0 0 0 0",
|
||||
" x a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
read_hi = " 0 0 1 0 1 0 0 0",
|
||||
" x a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
||||
" x x x x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
||||
" x x x x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
" x x x a12 a11 a10 a9 a8",
|
||||
" a7 a6 x x x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 6;
|
||||
blocksize = 256;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "lfuse"
|
||||
size = 1;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
;
|
||||
|
||||
memory "hfuse"
|
||||
size = 1;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
;
|
||||
|
||||
memory "efuse"
|
||||
size = 1;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
|
||||
"x x x x x x x x x x x x x i i i";
|
||||
;
|
||||
|
||||
memory "lock"
|
||||
size = 1;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x x x o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
|
||||
"x x x x x x x x 1 1 i i i i i i";
|
||||
;
|
||||
|
||||
memory "signature"
|
||||
size = 3;
|
||||
read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
|
||||
"x x x x x x a1 a0 o o o o o o o o";
|
||||
;
|
||||
|
||||
memory "calibration"
|
||||
size = 1;
|
||||
read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
|
||||
"0 0 0 0 0 0 0 0 o o o o o o o o";
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
# ATmega649
|
||||
#------------------------------------------------------------
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "avr910.h"
|
||||
#include "butterfly.h"
|
||||
#include "usbasp.h"
|
||||
#include "usbtiny.h"
|
||||
#include "avr.h"
|
||||
#include "jtagmkI.h"
|
||||
#include "jtagmkII.h"
|
||||
@@ -136,6 +137,7 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token K_STK500GENERIC
|
||||
%token K_AVR910
|
||||
%token K_USBASP
|
||||
%token K_USBTINY
|
||||
%token K_BUTTERFLY
|
||||
%token K_TYPE
|
||||
%token K_VCC
|
||||
@@ -421,6 +423,12 @@ prog_parm :
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_USBTINY {
|
||||
{
|
||||
usbtiny_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_BUTTERFLY {
|
||||
{
|
||||
butterfly_initpgm(current_prog);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT(avrdude, 5.4, avrdude-dev@nongnu.org)
|
||||
AC_INIT(avrdude, 5.5, avrdude-dev@nongnu.org)
|
||||
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
@@ -30,7 +30,7 @@ For avrdude version @value{VERSION}, @value{UPDATED}.
|
||||
|
||||
Copyright @copyright{} 2003, 2005 Brian Dean
|
||||
|
||||
Copyright @copyright{} 2006 J@"org Wunsch
|
||||
Copyright @copyright{} 2006, 2007 J@"org Wunsch
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
@@ -197,10 +197,10 @@ In particular, the Dragon starts out with a rather fast ISP clock
|
||||
frequency, so the @code{-B @var{bitclock}}
|
||||
option might be required to achieve a stable ISP communication.
|
||||
|
||||
The USBasp ISP adapter is also supported, provided AVRDUDE
|
||||
The USBasp ISP and USBtinyISP adapters are also supported, provided AVRDUDE
|
||||
has been compiled with libusb support.
|
||||
It features a simple firwmare-only USB implementation, running on
|
||||
an ATmega8 (or ATmega88).
|
||||
They both feature simple firwmare-only USB implementations, running on
|
||||
an ATmega8 (or ATmega88), or ATtiny2313, respectively.
|
||||
|
||||
|
||||
@menu
|
||||
@@ -363,6 +363,9 @@ ABCmini Board, aka Dick Smith HOTCHIP
|
||||
@item @code{alf} @tab
|
||||
Nightshade ALF-PgmAVR,@*
|
||||
@url{http://nightshade.homeip.net/}
|
||||
@item @code{atisp} @tab
|
||||
AT-ISP V1.1 programming cable for AVR-SDK1 from,@*
|
||||
@url{http://micro-research.co.th/}
|
||||
@item @code{avr109} @tab
|
||||
Atmel AppNote AVR109 Boot Loader
|
||||
@item @code{avr910} @tab
|
||||
@@ -371,21 +374,30 @@ Atmel Low Cost Serial Programmer
|
||||
Atmel AppNote AVR911 AVROSP (an alias for avr109)
|
||||
@item @code{avrisp} @tab
|
||||
Atmel AVR ISP (an alias for stk500)
|
||||
@item @code{avrispv2} @tab
|
||||
Atmel AVR ISP, running a version 2.x firmware (an alias for stk500v2)
|
||||
@item @code{avrisp2} @tab
|
||||
Atmel AVR ISP mkII (alias for stk500v2)
|
||||
@item @code{avrispmkII} @tab
|
||||
Atmel AVR ISP mkII (alias for stk500v2)
|
||||
@item @code{avrispmk2} @tab
|
||||
Atmel AVR ISP mkII (alias for stk500v2)
|
||||
@item @code{avrispv2} @tab
|
||||
Atmel AVR ISP, running a version 2.x firmware (an alias for stk500v2)
|
||||
@item @code{bascom} @tab
|
||||
Bascom SAMPLE programming cable
|
||||
@item @code{blaster} @tab
|
||||
Altera ByteBlaster
|
||||
@item @code{bsd} @tab
|
||||
Brian Dean's Programmer,@*
|
||||
@url{http://www.bsdhome.com/avrdude/}
|
||||
@item @code{butterfly} @tab
|
||||
Atmel Butterfly Development Board
|
||||
@item @code{dt006} @tab
|
||||
Dontronics DT006
|
||||
@item @code{c2n232i} @tab
|
||||
C2N232I, reset=dtr sck=!rts mosi=!txd miso=!cts,@*
|
||||
@url{http://www.ktverkko.fi/~msmakela/8bit/c2n232/hardware/index.en.html}
|
||||
@item @code{dapa} @tab
|
||||
Direct AVR Parallel Access cable
|
||||
@item @code{dasa} @tab
|
||||
serial port banging, reset=rts sck=dtr mosi=txd miso=cts
|
||||
@item @code{dasa3} @tab
|
||||
serial port banging, reset=!dtr sck=rts mosi=txd miso=cts
|
||||
@item @code{dragon_dw} @tab
|
||||
AVR Dragon in debugWire mode
|
||||
@item @code{dragon_hvsp} @tab
|
||||
@@ -396,26 +408,34 @@ AVR Dragon in ISP mode
|
||||
AVR Dragon in JTAG mode
|
||||
@item @code{dragon_pp} @tab
|
||||
AVR Dragon in (high-voltage) parallel programming mode
|
||||
@item @code{frank-stk200} @tab
|
||||
Frank's STK200 clone, @url{http://electropol.free.fr/spip/spip.php?article15}
|
||||
@item @code{jtagmkI} @tab
|
||||
Atmel JTAG ICE mkI, running at 115200 Bd
|
||||
@item @code{dt006} @tab
|
||||
Dontronics DT006
|
||||
@item @code{ere-isp-avr} @tab
|
||||
ERE ISP-AVR,@*
|
||||
@url{http://www.ere.co.th/download/sch050713.pdf}
|
||||
@item @code{frank-stk200}@tab
|
||||
Frank's STK200 clone,@*
|
||||
@url{http://electropol.free.fr/spip/spip.php?article15}
|
||||
@item @code{futurlec} @tab
|
||||
Futurlec.com programming cable
|
||||
@item @code{jtag1} @tab
|
||||
@emph{Same as before.}
|
||||
Atmel JTAG ICE mkI, running at 115200 Bd
|
||||
@item @code{jtag1slow} @tab
|
||||
Atmel JTAG ICE mkI, running at 19200 Bd
|
||||
@item @code{jtagmkII} @tab
|
||||
Atmel JTAG ICE mkII (default speed 19200 Bd)
|
||||
@item @code{jtag2slow} @tab
|
||||
@emph{Same as before.}
|
||||
Atmel JTAG ICE mkII (default speed 19200 Bd)
|
||||
@item @code{jtag2} @tab
|
||||
Atmel JTAG ICE mkII, running at 115200 Bd
|
||||
@item @code{jtag2fast} @tab
|
||||
Atmel JTAG ICE mkII, running at 115200 Bd
|
||||
@item @code{jtag2} @tab
|
||||
@emph{Same as before.}
|
||||
@item @code{jtag2isp} @tab
|
||||
Atmel JTAG ICE mkII in ISP mode.
|
||||
@item @code{jtag2dw} @tab
|
||||
Atmel JTAG ICE mkII in debugWire mode.
|
||||
@item @code{jtagmkI} @tab
|
||||
Atmel JTAG ICE mkI, running at 115200 Bd
|
||||
@item @code{jtagmkII} @tab
|
||||
Atmel JTAG ICE mkII (default speed 19200 Bd)
|
||||
@item @code{pavr} @tab
|
||||
Jason Kyle's pAVR Serial Programmer
|
||||
@item @code{picoweb} @tab
|
||||
@@ -423,20 +443,33 @@ Picoweb Programming Cable,@*
|
||||
@url{http://www.picoweb.net/}
|
||||
@item @code{pony-stk200} @tab
|
||||
Pony Prog STK200
|
||||
@item @code{ponyser} @tab
|
||||
design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts
|
||||
@item @code{siprog} @tab
|
||||
Lancos SI-Prog,@*
|
||||
@url{http://www.lancos.com/siprogsch.html}
|
||||
@item @code{sp12} @tab
|
||||
Steve Bolt's Programmer
|
||||
@item @code{stk200} @tab
|
||||
STK200
|
||||
@item @code{stk500} @tab
|
||||
Atmel STK500, probing for either version 1.x or 2.x firmware
|
||||
@item @code{stk500v1} @tab
|
||||
Atmel STK500, running a version 1.x firmware
|
||||
@item @code{stk500hvsp} @tab
|
||||
Atmel STK500 in high-voltage serial programming mode(version 2.x firmware only)
|
||||
@item @code{stk500pp} @tab
|
||||
Atmel STK500 in parallel programming mode (version 2.xfirmware only)
|
||||
@item @code{stk500v1} @tab
|
||||
Atmel STK500, running a version 1.x firmware
|
||||
@item @code{stk500v2} @tab
|
||||
Atmel STK500, running a version 2.x firmware
|
||||
@item @code{usbasp} @tab
|
||||
USBasp,@*
|
||||
@url{http://www.fischl.de/usbasp/}
|
||||
@item @code{usbtiny} @tab
|
||||
USBtiny simple USB programmer,@*
|
||||
@url{http://www.ladyada.net/make/usbtinyisp/}
|
||||
@item @code{xil} @tab
|
||||
Xilinx JTAG cable
|
||||
@end multitable
|
||||
|
||||
|
||||
@@ -1932,12 +1965,12 @@ The pin mapping for the JTAG-to-ISP adapter is:
|
||||
@end multitable
|
||||
|
||||
@item
|
||||
Problem: Multiple USBasp programmers connected simultaneously are not
|
||||
Problem: Multiple USBasp or USBtinyISP programmers connected simultaneously are not
|
||||
found.
|
||||
|
||||
Solution: none at this time. The simplicity of the USBasp programmer
|
||||
Solution: none at this time. The simplicity of these programmers
|
||||
doesn't offer a method to distinguish multiple programmers that are
|
||||
connected simultaneously, so effectively only one USBasp is supported.
|
||||
connected simultaneously, so effectively only one of them is supported.
|
||||
|
||||
@item
|
||||
Problem: I cannot do @dots{} when the target is in debugWire mode.
|
||||
|
||||
@@ -743,6 +743,10 @@ static int fileio_imm(struct fioparms * fio,
|
||||
p = strtok(filename, " ,");
|
||||
while (p != NULL && loc < size) {
|
||||
b = strtoul(p, &e, 0);
|
||||
/* check for binary formated (0b10101001) strings */
|
||||
b = (strncmp (p, "0b", 2))?
|
||||
strtoul (p, &e, 0):
|
||||
strtoul (p + 2, &e, 2);
|
||||
if (*e != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: invalid byte value (%s) specified for immediate mode\n",
|
||||
|
||||
@@ -120,6 +120,7 @@ allowfullpagebitstream { yylval=NULL; return K_ALLOWFULLPAGEBITSTREAM; }
|
||||
avr910 { yylval=NULL; return K_AVR910; }
|
||||
avr910_devcode { yylval=NULL; return K_AVR910_DEVCODE; }
|
||||
usbasp { yylval=NULL; return K_USBASP; }
|
||||
usbtiny { yylval=NULL; return K_USBTINY; }
|
||||
bank_size { yylval=NULL; return K_PAGE_SIZE; }
|
||||
banked { yylval=NULL; return K_PAGED; }
|
||||
baudrate { yylval=NULL; return K_BAUDRATE; }
|
||||
|
||||
@@ -272,6 +272,13 @@ int main(int argc, char * argv [])
|
||||
char * homedir;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set line buffering for file descriptors so we see stdout and stderr
|
||||
* properly interleaved.
|
||||
*/
|
||||
setvbuf(stdout, (char*)NULL, _IOLBF, 0);
|
||||
setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
||||
|
||||
progname = strrchr(argv[0],'/');
|
||||
|
||||
#if defined (WIN32NATIVE)
|
||||
|
||||
@@ -245,7 +245,6 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
{
|
||||
unsigned char c;
|
||||
unsigned char * p = buf;
|
||||
size_t len = 0;
|
||||
DWORD read;
|
||||
|
||||
HANDLE hComPort=(HANDLE)fd->pfd;
|
||||
@@ -282,7 +281,7 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
{
|
||||
fprintf(stderr, "%s: Recv: ", progname);
|
||||
|
||||
while (len) {
|
||||
while (read) {
|
||||
c = *p;
|
||||
if (isprint(c)) {
|
||||
fprintf(stderr, "%c ", c);
|
||||
@@ -293,7 +292,7 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
fprintf(stderr, "[%02x] ", c);
|
||||
|
||||
p++;
|
||||
len--;
|
||||
read--;
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
@@ -316,8 +316,22 @@ static int usbasp_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
wbytes = 0;
|
||||
}
|
||||
|
||||
/* set address (new mode) - if firmware on usbasp support newmode, then they use address from this command */
|
||||
unsigned char temp[4];
|
||||
memset(temp, 0, sizeof(temp));
|
||||
cmd[0] = address & 0xFF;
|
||||
cmd[1] = address >> 8;
|
||||
cmd[2] = address >> 16;
|
||||
cmd[3] = address >> 24;
|
||||
usbasp_transmit(1, USBASP_FUNC_SETLONGADDRESS, cmd, temp, sizeof(temp));
|
||||
|
||||
/* send command with address (compatibility mode) - if firmware on
|
||||
usbasp doesn't support newmode, then they use address from this */
|
||||
cmd[0] = address & 0xFF;
|
||||
cmd[1] = address >> 8;
|
||||
// for compatibility - previous version of usbasp.c doesn't initialize this fields (firmware ignore it)
|
||||
cmd[2] = 0;
|
||||
cmd[3] = 0;
|
||||
|
||||
n = usbasp_transmit(1, function, cmd, buffer, blocksize);
|
||||
|
||||
@@ -366,6 +380,19 @@ static int usbasp_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
blockflags |= USBASP_BLOCKFLAG_LAST;
|
||||
}
|
||||
|
||||
/* set address (new mode) - if firmware on usbasp support newmode, then
|
||||
they use address from this command */
|
||||
unsigned char temp[4];
|
||||
memset(temp, 0, sizeof(temp));
|
||||
cmd[0] = address & 0xFF;
|
||||
cmd[1] = address >> 8;
|
||||
cmd[2] = address >> 16;
|
||||
cmd[3] = address >> 24;
|
||||
usbasp_transmit(1, USBASP_FUNC_SETLONGADDRESS, cmd, temp, sizeof(temp));
|
||||
|
||||
/* normal command - firmware what support newmode - use address from previous command,
|
||||
firmware what doesn't support newmode - ignore previous command and use address from this command */
|
||||
|
||||
cmd[0] = address & 0xFF;
|
||||
cmd[1] = address >> 8;
|
||||
cmd[2] = page_size & 0xFF;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#define USBASP_FUNC_WRITEFLASH 6
|
||||
#define USBASP_FUNC_READEEPROM 7
|
||||
#define USBASP_FUNC_WRITEEEPROM 8
|
||||
#define USBASP_FUNC_SETLONGADDRESS 9
|
||||
|
||||
#define USBASP_BLOCKFLAG_FIRST 1
|
||||
#define USBASP_BLOCKFLAG_LAST 2
|
||||
|
||||
484
avrdude/usbtiny.c
Normal file
484
avrdude/usbtiny.c
Normal file
@@ -0,0 +1,484 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2007 Dick Streefland, adapted for 5.4 by Limor Fried
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Driver for "usbtiny"-type programmers
|
||||
* Please see http://www.xs4all.nl/~dicks/avr/usbtiny/
|
||||
* and http://www.ladyada.net/make/usbtinyisp/
|
||||
* For example schematics and detailed documentation
|
||||
*/
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
#include "pgm.h"
|
||||
#include "usbtiny.h"
|
||||
|
||||
#if defined(HAVE_LIBUSB) // we use LIBUSB to talk to the board
|
||||
#include <usb.h>
|
||||
|
||||
typedef unsigned int uint_t;
|
||||
typedef unsigned long ulong_t;
|
||||
|
||||
extern int avr_write_byte_default ( PROGRAMMER* pgm, AVRPART* p,
|
||||
AVRMEM* mem, ulong_t addr,
|
||||
unsigned char data );
|
||||
static usb_dev_handle* usb_handle;
|
||||
static int sck_period;
|
||||
static int chunk_size;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Wrapper for simple usb_control_msg messages
|
||||
static int usb_control (unsigned int requestid, unsigned int val, unsigned int index )
|
||||
{
|
||||
int nbytes;
|
||||
nbytes = usb_control_msg( usb_handle,
|
||||
USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
requestid,
|
||||
val, index, // 2 bytes each of data
|
||||
NULL, 0, // no data buffer in control messge
|
||||
USB_TIMEOUT ); // default timeout
|
||||
if(nbytes < 0){
|
||||
fprintf(stderr, "%s: error: usbtiny_transmit: %s\n", progname, usb_strerror());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
// Wrapper for simple usb_control_msg messages to receive data from programmer
|
||||
static int usb_in (unsigned int requestid, unsigned int val, unsigned int index,
|
||||
unsigned char* buffer, int buflen, int bitclk )
|
||||
{
|
||||
int nbytes;
|
||||
int timeout;
|
||||
|
||||
// calculate the amout of time we expect the process to take by
|
||||
// figuring the bit-clock time and buffer size and adding to the standard USB timeout.
|
||||
timeout = USB_TIMEOUT + (buflen * bitclk) / 1000;
|
||||
|
||||
nbytes = usb_control_msg( usb_handle,
|
||||
USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
requestid,
|
||||
val, index,
|
||||
(char *)buffer, buflen,
|
||||
timeout);
|
||||
if (nbytes != buflen) {
|
||||
fprintf(stderr, "%s: error: usbtiny_receive: %s (expected %d, got %d)\n",
|
||||
progname, usb_strerror(), buflen, nbytes);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
// Wrapper for simple usb_control_msg messages to send data to programmer
|
||||
static int usb_out (unsigned int requestid, unsigned int val, unsigned int index,
|
||||
unsigned char* buffer, int buflen, int bitclk )
|
||||
{
|
||||
int nbytes;
|
||||
int timeout;
|
||||
|
||||
// calculate the amout of time we expect the process to take by
|
||||
// figuring the bit-clock time and buffer size and adding to the standard USB timeout.
|
||||
timeout = USB_TIMEOUT + (buflen * bitclk) / 1000;
|
||||
|
||||
nbytes = usb_control_msg( usb_handle,
|
||||
USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
requestid,
|
||||
val, index,
|
||||
(char *)buffer, buflen,
|
||||
timeout);
|
||||
if (nbytes != buflen) {
|
||||
fprintf(stderr, "%s: error: usbtiny_send: %s (expected %d, got %d)\n",
|
||||
progname, usb_strerror(), buflen, nbytes);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
// Sometimes we just need to know the SPI command for the part to perform
|
||||
// a function. Here we wrap this request for an operation so that we
|
||||
// can just specify the part and operation and it'll do the right stuff
|
||||
// to get the information from AvrDude and send to the USBtiny
|
||||
static int usbtiny_avr_op (PROGRAMMER * pgm, AVRPART * p,
|
||||
int op,
|
||||
unsigned char res[4])
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
|
||||
if (p->op[op] == NULL) {
|
||||
fprintf( stderr, "Operation %d not defined for this chip!\n", op );
|
||||
return -1;
|
||||
}
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
avr_set_bits(p->op[op], cmd);
|
||||
|
||||
return pgm->cmd(pgm, cmd, res);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
/* Find a device with the correct VID/PID match for USBtiny */
|
||||
|
||||
static int usbtiny_open(PROGRAMMER* pgm, char* name)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct usb_device *dev = 0;
|
||||
|
||||
usb_init(); // initialize the libusb system
|
||||
usb_find_busses(); // have libusb scan all the usb busses available
|
||||
usb_find_devices(); // have libusb scan all the usb devices available
|
||||
|
||||
usb_handle = NULL;
|
||||
|
||||
// now we iterate through all the busses and devices
|
||||
for ( bus = usb_busses; bus; bus = bus->next ) {
|
||||
for ( dev = bus->devices; dev; dev = dev->next ) {
|
||||
if (dev->descriptor.idVendor == USBTINY_VENDOR
|
||||
&& dev->descriptor.idProduct == USBTINY_PRODUCT ) { // found match?
|
||||
|
||||
usb_handle = usb_open(dev); // attempt to connect to device
|
||||
|
||||
// wrong permissions or something?
|
||||
if (!usb_handle) {
|
||||
fprintf(stderr, "%s: Warning: cannot open USB device: %s\n",
|
||||
progname, usb_strerror());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!usb_handle) {
|
||||
fprintf( stderr, "%s: Error: Could not find USBtiny device (0x%x/0x%x)\n",
|
||||
progname, USBTINY_VENDOR, USBTINY_PRODUCT );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0; // If we got here, we must have found a good USB device
|
||||
}
|
||||
|
||||
/* Clean up the handle for the usbtiny */
|
||||
static void usbtiny_close ( PROGRAMMER* pgm )
|
||||
{
|
||||
if (! usb_handle) {
|
||||
return; // not a valid handle, bail!
|
||||
}
|
||||
usb_close(usb_handle); // ask libusb to clean up
|
||||
usb_handle = NULL;
|
||||
}
|
||||
|
||||
/* A simple calculator function determines the maximum size of data we can
|
||||
shove through a USB connection without getting errors */
|
||||
static void usbtiny_set_chunk_size (int period)
|
||||
{
|
||||
chunk_size = CHUNK_SIZE; // start with the maximum (default)
|
||||
while (chunk_size > 8 && period > 16) {
|
||||
// Reduce the chunk size for a slow SCK to reduce
|
||||
// the maximum time of a single USB transfer.
|
||||
chunk_size >>= 1;
|
||||
period >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Given a SCK bit-clock speed (in useconds) we verify its an OK speed and tell the
|
||||
USBtiny to update itself to the new frequency */
|
||||
static int usbtiny_set_sck_period (PROGRAMMER *pgm, double v)
|
||||
{
|
||||
sck_period = (int)(v * 1e6 + 0.5); // convert from us to 'int', the 0.5 is for rounding up
|
||||
|
||||
// Make sure its not 0, as that will confuse the usbtiny
|
||||
if (sck_period < SCK_MIN)
|
||||
sck_period = SCK_MIN;
|
||||
|
||||
// We can't go slower, due to the byte-size of the clock variable
|
||||
if (sck_period > SCK_MAX)
|
||||
sck_period = SCK_MAX;
|
||||
|
||||
printf( "%s: Setting SCK period to %d usec\n", progname, sck_period );
|
||||
|
||||
// send the command to the usbtiny device.
|
||||
usb_control(USBTINY_POWERUP, sck_period, RESET_LOW); // MEME: for at90's fix resetstate?
|
||||
|
||||
// with the new speed, we'll have to update how much data we send per usb transfer
|
||||
usbtiny_set_chunk_size(sck_period);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int usbtiny_initialize (PROGRAMMER *pgm, AVRPART *p )
|
||||
{
|
||||
unsigned char res[4]; // store the response from usbtinyisp
|
||||
|
||||
// Check for bit-clock and tell the usbtiny to adjust itself
|
||||
if (pgm->bitclock > 0.0) {
|
||||
// -B option specified: convert to valid range for sck_period
|
||||
usbtiny_set_sck_period(pgm, pgm->bitclock);
|
||||
} else {
|
||||
// -B option not specified: use default
|
||||
sck_period = SCK_DEFAULT;
|
||||
if (verbose) {
|
||||
printf( "%s: Using SCK period of %d usec\n",
|
||||
progname, sck_period );
|
||||
}
|
||||
usb_control( USBTINY_POWERUP, sck_period, RESET_LOW );
|
||||
usbtiny_set_chunk_size(sck_period);
|
||||
}
|
||||
|
||||
// Let the device wake up.
|
||||
usleep(50000);
|
||||
|
||||
// Attempt to use the underlying avrdude methods to connect (MEME: is this kosher?)
|
||||
if (! usbtiny_avr_op(pgm, p, AVR_OP_PGM_ENABLE, res)) {
|
||||
// no response, RESET and try again
|
||||
usb_control(USBTINY_POWERUP, sck_period, RESET_HIGH);
|
||||
usb_control(USBTINY_POWERUP, sck_period, RESET_LOW);
|
||||
usleep(50000);
|
||||
if ( ! usbtiny_avr_op( pgm, p, AVR_OP_PGM_ENABLE, res)) {
|
||||
// give up
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Tell the USBtiny to release the output pins, etc */
|
||||
static void usbtiny_powerdown(PROGRAMMER * pgm)
|
||||
{
|
||||
if (!usb_handle) {
|
||||
return; // wasn't connected in the first place
|
||||
}
|
||||
usb_control(USBTINY_POWERDOWN, 0, 0); // Send USB control command to device
|
||||
}
|
||||
|
||||
/* Send a 4-byte SPI command to the USBtinyISP for execution
|
||||
This procedure is used by higher-level Avrdude procedures */
|
||||
static int usbtiny_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res[4])
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
// Make sure its empty so we don't read previous calls if it fails
|
||||
memset(res, '\0', sizeof(res) );
|
||||
|
||||
nbytes = usb_in( USBTINY_SPI,
|
||||
(cmd[1] << 8) | cmd[0], // convert to 16-bit words
|
||||
(cmd[3] << 8) | cmd[2], // "
|
||||
res, sizeof(res), 8 * sck_period );
|
||||
if (verbose > 1) {
|
||||
// print out the data we sent and received
|
||||
printf( "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n",
|
||||
cmd[0], cmd[1], cmd[2], cmd[3],
|
||||
res[0], res[1], res[2], res[3] );
|
||||
}
|
||||
return ((nbytes == sizeof(res)) && // should have read 4 bytes
|
||||
res[2] == cmd[1]); // AVR's do a delayed-echo thing
|
||||
}
|
||||
|
||||
/* Send the chip-erase command */
|
||||
static int usbtiny_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
unsigned char res[4];
|
||||
|
||||
if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
|
||||
fprintf(stderr, "Chip erase instruction not defined for part \"%s\"\n",
|
||||
p->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// get the command for erasing this chip and transmit to avrdude
|
||||
if (! usbtiny_avr_op( pgm, p, AVR_OP_CHIP_ERASE, res )) {
|
||||
return -1;
|
||||
}
|
||||
usleep( p->chip_erase_delay );
|
||||
|
||||
// prepare for further instruction
|
||||
pgm->initialize(pgm, p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// These are required functions but don't actually do anything
|
||||
static void usbtiny_enable ( PROGRAMMER* pgm ) {}
|
||||
|
||||
static void usbtiny_disable ( PROGRAMMER* pgm ) {}
|
||||
|
||||
|
||||
/* To speed up programming and reading, we do a 'chunked' read.
|
||||
* We request just the data itself and the USBtiny uses the SPI function
|
||||
* given to read in the data. Much faster than sending a 4-byte SPI request
|
||||
* per byte
|
||||
*/
|
||||
static int usbtiny_paged_load (PROGRAMMER * pgm, AVRPART * p, AVRMEM* m,
|
||||
int page_size, int n_bytes )
|
||||
{
|
||||
int i;
|
||||
int chunk;
|
||||
int function;
|
||||
|
||||
|
||||
// First determine what we're doing
|
||||
if (strcmp( m->desc, "flash" ) == 0) {
|
||||
function = USBTINY_FLASH_READ;
|
||||
} else {
|
||||
function = USBTINY_EEPROM_READ;
|
||||
}
|
||||
|
||||
for (i = 0; i < n_bytes; i += chunk) {
|
||||
chunk = chunk_size; // start with the maximum chunk size possible
|
||||
|
||||
// If we want to xmit less than a chunk, thats OK
|
||||
if (chunk > n_bytes-i)
|
||||
chunk = n_bytes - i;
|
||||
|
||||
// Send the chunk of data to the USBtiny with the function we want
|
||||
// to perform
|
||||
usb_in(function, // EEPROM or flash
|
||||
0, // delay between SPI commands
|
||||
i, // index
|
||||
m->buf + i, // pointer to where we store data
|
||||
chunk, // number of bytes
|
||||
32 * sck_period); // each byte gets turned into a 4-byte SPI cmd
|
||||
// usb_in() multiplies this per byte.
|
||||
|
||||
// Tell avrdude how we're doing to provide user feedback
|
||||
report_progress(i + chunk, n_bytes, NULL );
|
||||
}
|
||||
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
/* To speed up programming and reading, we do a 'chunked' write.
|
||||
* We send just the data itself and the USBtiny uses the SPI function
|
||||
* given to write the data. Much faster than sending a 4-byte SPI request
|
||||
* per byte.
|
||||
*/
|
||||
static int usbtiny_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
{
|
||||
int i;
|
||||
int chunk; // Size of data to write at once
|
||||
int next;
|
||||
int function; // which SPI command to use
|
||||
int delay; // delay required between SPI commands
|
||||
|
||||
// First determine what we're doing
|
||||
if (strcmp( m->desc, "flash" ) == 0) {
|
||||
function = USBTINY_FLASH_WRITE;
|
||||
} else {
|
||||
function = USBTINY_EEPROM_WRITE;
|
||||
}
|
||||
|
||||
delay = 0;
|
||||
if (! m->paged) {
|
||||
// Does this chip not support paged writes?
|
||||
i = (m->readback[1] << 8) | m->readback[0];
|
||||
usb_control( USBTINY_POLL_BYTES, i, 0 );
|
||||
delay = m->max_write_delay;
|
||||
}
|
||||
|
||||
for (i=0; i < n_bytes; i=next) {
|
||||
// start with the max chunk size
|
||||
chunk = chunk_size;
|
||||
|
||||
// we can only write a page at a time anyways
|
||||
if (m->paged && chunk > page_size)
|
||||
chunk = page_size;
|
||||
|
||||
// if there's less data remaining than one chunk
|
||||
if (chunk > n_bytes-i)
|
||||
chunk = n_bytes - i;
|
||||
|
||||
usb_out(function, // Flash or EEPROM
|
||||
delay, // How much to wait between each byte
|
||||
i, // Index of data
|
||||
m->buf + i, // Pointer to data
|
||||
chunk, // Number of bytes to write
|
||||
32 * sck_period + delay // each byte gets turned into a
|
||||
// 4-byte SPI cmd usb_in() multiplies
|
||||
// this per byte. Then add the cmd-delay
|
||||
);
|
||||
|
||||
next = i + chunk; // Calculate what address we're at now
|
||||
if (m->paged
|
||||
&& ((next % page_size) == 0 || next == n_bytes) ) {
|
||||
// If we're at a page boundary, send the SPI command to flush it.
|
||||
avr_write_page(pgm, p, m, (unsigned long) i);
|
||||
}
|
||||
|
||||
report_progress( next, n_bytes, NULL );
|
||||
}
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
extern void usbtiny_initpgm ( PROGRAMMER* pgm )
|
||||
{
|
||||
strcpy(pgm->type, "USBtiny");
|
||||
|
||||
/* Mandatory Functions */
|
||||
pgm->initialize = usbtiny_initialize;
|
||||
pgm->enable = usbtiny_enable;
|
||||
pgm->disable = usbtiny_disable;
|
||||
pgm->program_enable = NULL;
|
||||
pgm->chip_erase = usbtiny_chip_erase;
|
||||
pgm->cmd = usbtiny_cmd;
|
||||
pgm->open = usbtiny_open;
|
||||
pgm->close = usbtiny_close;
|
||||
pgm->read_byte = avr_read_byte_default;
|
||||
pgm->write_byte = avr_write_byte_default;
|
||||
|
||||
/* Optional Functions */
|
||||
pgm->powerup = NULL;
|
||||
pgm->powerdown = usbtiny_powerdown;
|
||||
pgm->paged_load = usbtiny_paged_load;
|
||||
pgm->paged_write = usbtiny_paged_write;
|
||||
pgm->set_sck_period = usbtiny_set_sck_period;
|
||||
}
|
||||
|
||||
#else /* !HAVE_LIBUSB */
|
||||
|
||||
// Give a proper error if we were not compiled with libusb
|
||||
|
||||
static int usbtiny_nousb_open(struct programmer_t *pgm, char * name)
|
||||
{
|
||||
fprintf(stderr, "%s: error: no usb support. Please compile again with libusb installed.\n",
|
||||
progname);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void usbtiny_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
strcpy(pgm->type, "usbtiny");
|
||||
|
||||
pgm->open = usbtiny_nousb_open;
|
||||
}
|
||||
|
||||
#endif /* HAVE_LIBUSB */
|
||||
76
avrdude/usbtiny.h
Normal file
76
avrdude/usbtiny.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2007 Limor Fried
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#ifndef usbtiny_h
|
||||
#define usbtiny_h
|
||||
|
||||
#include "avrpart.h"
|
||||
|
||||
// these are specifically assigned to USBtiny,
|
||||
// if you need your own VID and PIDs you can get them for cheap from
|
||||
// www.mecanique.co.uk so please don't reuse these. Thanks!
|
||||
#define USBTINY_VENDOR 0x1781
|
||||
#define USBTINY_PRODUCT 0x0C9F
|
||||
|
||||
// Generic requests to the USBtiny
|
||||
#define USBTINY_ECHO 0 // echo test
|
||||
#define USBTINY_READ 1 // read byte (wIndex:address)
|
||||
#define USBTINY_WRITE 2 // write byte (wIndex:address, wValue:value)
|
||||
#define USBTINY_CLR 3 // clear bit (wIndex:address, wValue:bitno)
|
||||
#define USBTINY_SET 4 // set bit (wIndex:address, wValue:bitno)
|
||||
|
||||
// Programming requests
|
||||
#define USBTINY_POWERUP 5 // apply power (wValue:SCK-period, wIndex:RESET)
|
||||
#define USBTINY_POWERDOWN 6 // remove power from chip
|
||||
#define USBTINY_SPI 7 // issue SPI command (wValue:c1c0, wIndex:c3c2)
|
||||
#define USBTINY_POLL_BYTES 8 // set poll bytes for write (wValue:p1p2)
|
||||
#define USBTINY_FLASH_READ 9 // read flash (wIndex:address)
|
||||
#define USBTINY_FLASH_WRITE 10 // write flash (wIndex:address, wValue:timeout)
|
||||
#define USBTINY_EEPROM_READ 11 // read eeprom (wIndex:address)
|
||||
#define USBTINY_EEPROM_WRITE 12 // write eeprom (wIndex:address, wValue:timeout)
|
||||
|
||||
|
||||
|
||||
// Flags to indicate how to set RESET on power up
|
||||
#define RESET_LOW 0
|
||||
#define RESET_HIGH 1
|
||||
|
||||
// The SCK speed can be set by avrdude, to allow programming of slow-clocked parts
|
||||
#define SCK_MIN 1 // usec delay (target clock >= 4 MHz)
|
||||
#define SCK_MAX 250 // usec (target clock >= 16 KHz)
|
||||
#define SCK_DEFAULT 10 // usec (target clock >= 0.4 MHz)
|
||||
|
||||
// How much data, max, do we want to send in one USB packet?
|
||||
#define CHUNK_SIZE 128 // must be power of 2 less than 256
|
||||
|
||||
// The default USB Timeout
|
||||
#define USB_TIMEOUT 500 // msec
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void usbtiny_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* usbtiny_h */
|
||||
Reference in New Issue
Block a user