Deprecate mosi/miso in favour of sdo/sdi
See https://www.oshwa.org/a-resolution-to-redefine-spi-signal-names/
This commit is contained in:
parent
883d9494c8
commit
adc333ea54
|
@ -75,9 +75,9 @@ so, for the
|
||||||
based programmer, the MCU signals
|
based programmer, the MCU signals
|
||||||
.Ql /RESET ,
|
.Ql /RESET ,
|
||||||
.Ql SCK ,
|
.Ql SCK ,
|
||||||
.Ql MISO
|
.Ql SDI
|
||||||
and
|
and
|
||||||
.Ql MOSI
|
.Ql SDO
|
||||||
need to be connected to the parallel port. Optionally, some otherwise
|
need to be connected to the parallel port. Optionally, some otherwise
|
||||||
unused output pins of the parallel port can be used to supply power
|
unused output pins of the parallel port can be used to supply power
|
||||||
for the MCU part, so it is also possible to construct a passive
|
for the MCU part, so it is also possible to construct a passive
|
||||||
|
@ -98,7 +98,7 @@ work at all, or to work abysmally slow.
|
||||||
.Pp
|
.Pp
|
||||||
If you happen to have a Linux system with at least 4 hardware GPIOs
|
If you happen to have a Linux system with at least 4 hardware GPIOs
|
||||||
available (like almost all embedded Linux boards) you can do without
|
available (like almost all embedded Linux boards) you can do without
|
||||||
any additional hardware - just connect them to the MOSI, MISO, RESET
|
any additional hardware - just connect them to the SDO, SDI, RESET
|
||||||
and SCK pins on the AVR and use the linuxgpio programmer type. It bitbangs
|
and SCK pins on the AVR and use the linuxgpio programmer type. It bitbangs
|
||||||
the lines using the Linux sysfs GPIO interface. Of course, care should
|
the lines using the Linux sysfs GPIO interface. Of course, care should
|
||||||
be taken about voltage level compatibility. Also, although not strictly
|
be taken about voltage level compatibility. Also, although not strictly
|
||||||
|
@ -217,7 +217,7 @@ has been compiled in
|
||||||
.Nm avrdude ,
|
.Nm avrdude ,
|
||||||
the avrftdi device adds support for many programmers using FTDI's 2232C/D/H
|
the avrftdi device adds support for many programmers using FTDI's 2232C/D/H
|
||||||
and 4232H parts running in MPSSE mode, which hard-codes (in the chip)
|
and 4232H parts running in MPSSE mode, which hard-codes (in the chip)
|
||||||
SCK to bit 1, MOSI to bit 2, and MISO to bit 3. Reset is usually bit 4.
|
SCK to bit 1, SDO to bit 2, and SDI to bit 3. Reset is usually bit 4.
|
||||||
.Pp
|
.Pp
|
||||||
The Atmel DFU bootloader is supported in both, FLIP protocol version 1
|
The Atmel DFU bootloader is supported in both, FLIP protocol version 1
|
||||||
(AT90USB* and ATmega*U* devices), as well as version 2 (Xmega devices).
|
(AT90USB* and ATmega*U* devices), as well as version 2 (Xmega devices).
|
||||||
|
@ -1025,8 +1025,8 @@ ll.
|
||||||
2-5 Vcc (optional power supply to MCU)
|
2-5 Vcc (optional power supply to MCU)
|
||||||
7 /RESET (to MCU)
|
7 /RESET (to MCU)
|
||||||
8 SCK (to MCU)
|
8 SCK (to MCU)
|
||||||
9 MOSI (to MCU)
|
9 SDO (to MCU)
|
||||||
10 MISO (from MCU)
|
10 SDI (from MCU)
|
||||||
18-25 GND
|
18-25 GND
|
||||||
.TE
|
.TE
|
||||||
.Ss debugWire limitations
|
.Ss debugWire limitations
|
||||||
|
@ -1258,7 +1258,7 @@ Show this help menu and exit
|
||||||
.It Ar reset={cs,aux,aux2}
|
.It Ar reset={cs,aux,aux2}
|
||||||
The default setup assumes the BusPirate's CS output pin connected to
|
The default setup assumes the BusPirate's CS output pin connected to
|
||||||
the RESET pin on AVR side. It is however possible to have multiple AVRs
|
the RESET pin on AVR side. It is however possible to have multiple AVRs
|
||||||
connected to the same BP with MISO, MOSI and SCK lines common for all of them.
|
connected to the same BP with SDI, SDO and SCK lines common for all of them.
|
||||||
In such a case one AVR should have its RESET connected to BusPirate's
|
In such a case one AVR should have its RESET connected to BusPirate's
|
||||||
.Pa CS
|
.Pa CS
|
||||||
pin, second AVR's RESET connected to BusPirate's
|
pin, second AVR's RESET connected to BusPirate's
|
||||||
|
@ -1371,9 +1371,9 @@ Connection to the PICkit2 programmer:
|
||||||
RST - VPP/MCLR (1)
|
RST - VPP/MCLR (1)
|
||||||
VDD - VDD Target (2) -- possibly optional if AVR self powered
|
VDD - VDD Target (2) -- possibly optional if AVR self powered
|
||||||
GND - GND (3)
|
GND - GND (3)
|
||||||
MISO - PGD (4)
|
SDI - PGD (4)
|
||||||
SCLK - PDC (5)
|
SCLK - PDC (5)
|
||||||
MOSI - AUX (6)
|
SDO - AUX (6)
|
||||||
|
|
||||||
.Ed
|
.Ed
|
||||||
Extended commandline parameters:
|
Extended commandline parameters:
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
# buff = <pin1> [, <pin2> ... ] ; # pin number(s)
|
# buff = <pin1> [, <pin2> ... ] ; # pin number(s)
|
||||||
# reset = <pin> ; # pin number
|
# reset = <pin> ; # pin number
|
||||||
# sck = <pin> ; # pin number
|
# sck = <pin> ; # pin number
|
||||||
# mosi = <pin> ; # pin number
|
# sdo = <pin> ; # pin number
|
||||||
# miso = <pin> ; # pin number
|
# sdi = <pin> ; # pin number
|
||||||
# errled = <pin> ; # pin number
|
# errled = <pin> ; # pin number
|
||||||
# rdyled = <pin> ; # pin number
|
# rdyled = <pin> ; # pin number
|
||||||
# pgmled = <pin> ; # pin number
|
# pgmled = <pin> ; # pin number
|
||||||
|
@ -411,8 +411,8 @@ programmer
|
||||||
vcc = 2, 3, 4, 5;
|
vcc = 2, 3, 4, 5;
|
||||||
reset = 7;
|
reset = 7;
|
||||||
sck = 8;
|
sck = 8;
|
||||||
mosi = 9;
|
sdo = 9;
|
||||||
miso = 10;
|
sdi = 10;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -427,8 +427,8 @@ programmer
|
||||||
buff = 4, 5;
|
buff = 4, 5;
|
||||||
reset = 9;
|
reset = 9;
|
||||||
sck = 6;
|
sck = 6;
|
||||||
mosi = 7;
|
sdo = 7;
|
||||||
miso = 10;
|
sdi = 10;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -457,8 +457,8 @@ programmer
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
reset = 4;
|
reset = 4;
|
||||||
sck = 5;
|
sck = 5;
|
||||||
mosi = 2;
|
sdo = 2;
|
||||||
miso = 11;
|
sdi = 11;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -483,8 +483,8 @@ programmer
|
||||||
buff = 6;
|
buff = 6;
|
||||||
reset = 7;
|
reset = 7;
|
||||||
sck = 8;
|
sck = 8;
|
||||||
mosi = 9;
|
sdo = 9;
|
||||||
miso = 10;
|
sdi = 10;
|
||||||
errled = 1;
|
errled = 1;
|
||||||
rdyled = 14;
|
rdyled = 14;
|
||||||
pgmled = 16;
|
pgmled = 16;
|
||||||
|
@ -503,8 +503,8 @@ programmer
|
||||||
vcc = 4, 5, 6, 7, 8;
|
vcc = 4, 5, 6, 7, 8;
|
||||||
reset = 3;
|
reset = 3;
|
||||||
sck = 2;
|
sck = 2;
|
||||||
mosi = 9;
|
sdo = 9;
|
||||||
miso = 11;
|
sdi = 11;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -518,8 +518,8 @@ programmer
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
reset = 2;
|
reset = 2;
|
||||||
sck = 3;
|
sck = 3;
|
||||||
mosi = 4;
|
sdo = 4;
|
||||||
miso = 13;
|
sdi = 13;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -533,8 +533,8 @@ programmer
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
reset = 4;
|
reset = 4;
|
||||||
sck = 3;
|
sck = 3;
|
||||||
mosi = 2;
|
sdo = 2;
|
||||||
miso = 10;
|
sdi = 10;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -548,8 +548,8 @@ programmer
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
reset = 3;
|
reset = 3;
|
||||||
sck = 2;
|
sck = 2;
|
||||||
mosi = 1;
|
sdo = 1;
|
||||||
miso = 10;
|
sdi = 10;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -561,7 +561,7 @@ programmer
|
||||||
# the programming circuit) but is necessary to switch one of the
|
# the programming circuit) but is necessary to switch one of the
|
||||||
# buffer lines (trying to add it to the "buff" lines doesn't work in
|
# buffer lines (trying to add it to the "buff" lines doesn't work in
|
||||||
# avrdude versions before 5.5j).
|
# avrdude versions before 5.5j).
|
||||||
# With this, TMS connects to RESET, TDI to MOSI, TDO to MISO and TCK
|
# With this, TMS connects to RESET, TDI to SDO, TDO to SDI and TCK
|
||||||
# to SCK (plus vcc/gnd of course)
|
# to SCK (plus vcc/gnd of course)
|
||||||
|
|
||||||
programmer
|
programmer
|
||||||
|
@ -573,8 +573,8 @@ programmer
|
||||||
buff = 5;
|
buff = 5;
|
||||||
reset = 4;
|
reset = 4;
|
||||||
sck = 3;
|
sck = 3;
|
||||||
mosi = 2;
|
sdo = 2;
|
||||||
miso = 13;
|
sdi = 13;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -589,8 +589,8 @@ programmer
|
||||||
vcc = 3;
|
vcc = 3;
|
||||||
reset = 16;
|
reset = 16;
|
||||||
sck = 1;
|
sck = 1;
|
||||||
mosi = 2;
|
sdo = 2;
|
||||||
miso = 11;
|
sdi = 11;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -604,8 +604,8 @@ programmer
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
reset = ~6;
|
reset = ~6;
|
||||||
sck = ~8;
|
sck = ~8;
|
||||||
mosi = ~7;
|
sdo = ~7;
|
||||||
miso = ~10;
|
sdi = ~10;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -619,8 +619,8 @@ programmer
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
reset = ~4;
|
reset = ~4;
|
||||||
sck = 3;
|
sck = 3;
|
||||||
mosi = 2;
|
sdo = 2;
|
||||||
miso = 10;
|
sdi = 10;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -635,8 +635,8 @@ programmer
|
||||||
buff = 14;
|
buff = 14;
|
||||||
reset = 3;
|
reset = 3;
|
||||||
sck = 2;
|
sck = 2;
|
||||||
mosi = 8;
|
sdo = 8;
|
||||||
miso = 11;
|
sdi = 11;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -667,8 +667,8 @@ programmer
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
reset = 17;
|
reset = 17;
|
||||||
sck = 1;
|
sck = 1;
|
||||||
mosi = 2;
|
sdo = 2;
|
||||||
miso = 10;
|
sdi = 10;
|
||||||
;
|
;
|
||||||
@HAVE_PARPORT_END@
|
@HAVE_PARPORT_END@
|
||||||
|
|
||||||
|
@ -699,8 +699,8 @@ programmer
|
||||||
# prog_modes = PM_ISP;
|
# prog_modes = PM_ISP;
|
||||||
# reset = ?;
|
# reset = ?;
|
||||||
# sck = ?;
|
# sck = ?;
|
||||||
# mosi = ?;
|
# sdo = ?;
|
||||||
# miso = ?;
|
# sdi = ?;
|
||||||
# ;
|
# ;
|
||||||
@HAVE_LINUXGPIO_END@
|
@HAVE_LINUXGPIO_END@
|
||||||
|
|
||||||
|
@ -801,7 +801,7 @@ programmer
|
||||||
# And fill that in here.
|
# And fill that in here.
|
||||||
#
|
#
|
||||||
# Note that the pin numbers for the main ISP signals (reset, sck,
|
# Note that the pin numbers for the main ISP signals (reset, sck,
|
||||||
# mosi, miso) are fixed and cannot be changed, since they must match
|
# sdo, sdi) are fixed and cannot be changed, since they must match
|
||||||
# the way the Multi-Protocol Synchronous Serial Engine (MPSSE) of
|
# the way the Multi-Protocol Synchronous Serial Engine (MPSSE) of
|
||||||
# these FTDI ICs has been designed.
|
# these FTDI ICs has been designed.
|
||||||
|
|
||||||
|
@ -817,8 +817,8 @@ programmer
|
||||||
# ISP-signals - lower ADBUS-Nibble (default)
|
# ISP-signals - lower ADBUS-Nibble (default)
|
||||||
reset = 3;
|
reset = 3;
|
||||||
sck = 0;
|
sck = 0;
|
||||||
mosi = 1;
|
sdo = 1;
|
||||||
miso = 2;
|
sdi = 2;
|
||||||
# LED SIGNALs - higher ADBUS-Nibble
|
# LED SIGNALs - higher ADBUS-Nibble
|
||||||
# errled = 4;
|
# errled = 4;
|
||||||
# rdyled = 5;
|
# rdyled = 5;
|
||||||
|
@ -851,8 +851,8 @@ programmer
|
||||||
#ISP-signals
|
#ISP-signals
|
||||||
reset = 3;
|
reset = 3;
|
||||||
sck = 0;
|
sck = 0;
|
||||||
mosi = 1;
|
sdo = 1;
|
||||||
miso = 2;
|
sdi = 2;
|
||||||
#LED SIGNALs
|
#LED SIGNALs
|
||||||
errled = ~11;
|
errled = ~11;
|
||||||
rdyled = ~14;
|
rdyled = ~14;
|
||||||
|
@ -891,8 +891,8 @@ programmer
|
||||||
# ISP-signals => 20 - Pin connector on JTAGKey
|
# ISP-signals => 20 - Pin connector on JTAGKey
|
||||||
reset = 3; # TMS 7 violet
|
reset = 3; # TMS 7 violet
|
||||||
sck = 0; # TCK 9 white
|
sck = 0; # TCK 9 white
|
||||||
mosi = 1; # TDI 5 green
|
sdo = 1; # TDI 5 green
|
||||||
miso = 2; # TDO 13 orange
|
sdi = 2; # TDO 13 orange
|
||||||
# VTG VREF 1 brown with red tip
|
# VTG VREF 1 brown with red tip
|
||||||
# GND GND 20 black
|
# GND GND 20 black
|
||||||
# The colors are on the 20 pin breakout cable from Amontec
|
# The colors are on the 20 pin breakout cable from Amontec
|
||||||
|
@ -914,8 +914,8 @@ programmer
|
||||||
#ISP-signals
|
#ISP-signals
|
||||||
reset = 3; # AD3 (TMS)
|
reset = 3; # AD3 (TMS)
|
||||||
sck = 0; # AD0 (TCK)
|
sck = 0; # AD0 (TCK)
|
||||||
mosi = 1; # AD1 (TDI)
|
sdo = 1; # AD1 (TDI)
|
||||||
miso = 2; # AD2 (TDO)
|
sdi = 2; # AD2 (TDO)
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -923,8 +923,8 @@ programmer
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
# Pin J2-7 (AD0) is SCK
|
# Pin J2-7 (AD0) is SCK
|
||||||
# Pin J2-8 (AD1) is MOSI
|
# Pin J2-8 (AD1) is SDO
|
||||||
# Pin J2-9 (AD2) is MISO
|
# Pin J2-9 (AD2) is SDI
|
||||||
# Pin J2-10 (AD3) is RESET
|
# Pin J2-10 (AD3) is RESET
|
||||||
# Pin J2-6 is GND
|
# Pin J2-6 is GND
|
||||||
# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get
|
# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get
|
||||||
|
@ -941,8 +941,8 @@ programmer parent "ft232h"
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
# Orange (Pin 2) is SCK
|
# Orange (Pin 2) is SCK
|
||||||
# Yellow (Pin 3) is MOSI
|
# Yellow (Pin 3) is SDO
|
||||||
# Green (Pin 4) is MISO
|
# Green (Pin 4) is SDI
|
||||||
# Brown (Pin 5) is RESET
|
# Brown (Pin 5) is RESET
|
||||||
# Black (Pin 10) is GND
|
# Black (Pin 10) is GND
|
||||||
# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get
|
# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get
|
||||||
|
@ -997,8 +997,8 @@ programmer
|
||||||
usbdev = "A";
|
usbdev = "A";
|
||||||
reset = 3; # TMS 7
|
reset = 3; # TMS 7
|
||||||
sck = 0; # TCK 9
|
sck = 0; # TCK 9
|
||||||
mosi = 1; # TDI 5
|
sdo = 1; # TDI 5
|
||||||
miso = 2; # TDO 13
|
sdi = 2; # TDO 13
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1024,8 +1024,8 @@ programmer
|
||||||
#ISP-signals - lower ACBUS-Nibble (default)
|
#ISP-signals - lower ACBUS-Nibble (default)
|
||||||
reset = 3;
|
reset = 3;
|
||||||
sck = 0;
|
sck = 0;
|
||||||
mosi = 1;
|
sdo = 1;
|
||||||
miso = 2;
|
sdi = 2;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1046,8 +1046,8 @@ programmer
|
||||||
usbvendor = "TIAO";
|
usbvendor = "TIAO";
|
||||||
reset = 3; # TMS 7
|
reset = 3; # TMS 7
|
||||||
sck = 0; # TCK 9
|
sck = 0; # TCK 9
|
||||||
mosi = 1; # TDI 5
|
sdo = 1; # TDI 5
|
||||||
miso = 2; # TDO 13
|
sdi = 2; # TDO 13
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1063,7 +1063,7 @@ programmer
|
||||||
# KT-LINK JTAG CONN:
|
# KT-LINK JTAG CONN:
|
||||||
# 1=Vsense(->EXT13), 19=5V(EXT1->EXT3), 20=GND, 3=TPIRST, 9=TPICLK, 7=TPIDATA.
|
# 1=Vsense(->EXT13), 19=5V(EXT1->EXT3), 20=GND, 3=TPIRST, 9=TPICLK, 7=TPIDATA.
|
||||||
# INTERNALS CONFIGURATION ("~" MEANS ACTIVE LOW):
|
# INTERNALS CONFIGURATION ("~" MEANS ACTIVE LOW):
|
||||||
# ~TRST_EN=10(ACBUS2), ~CLK_EN=14(ACBUS6), ~MOSI_EN=13(ACBUS5),
|
# ~TRST_EN=10(ACBUS2), ~CLK_EN=14(ACBUS6), ~SDO_EN=13(ACBUS5),
|
||||||
# TMS_SEL=5(ADBUS5), ~TMS_EN=12(ACBUS4), LED=~15(ACBUS7).
|
# TMS_SEL=5(ADBUS5), ~TMS_EN=12(ACBUS4), LED=~15(ACBUS7).
|
||||||
# CONNECTION NOTES:
|
# CONNECTION NOTES:
|
||||||
# * Connect EXT connector pin 1 with 3 to get 5V on JTAG connector pin 19.
|
# * Connect EXT connector pin 1 with 3 to get 5V on JTAG connector pin 19.
|
||||||
|
@ -1083,8 +1083,8 @@ programmer
|
||||||
buff = 5, ~10, ~13, ~14;
|
buff = 5, ~10, ~13, ~14;
|
||||||
reset = 8;
|
reset = 8;
|
||||||
sck = 0;
|
sck = 0;
|
||||||
mosi = 1;
|
sdo = 1;
|
||||||
miso = 2;
|
sdi = 2;
|
||||||
rdyled = ~15;
|
rdyled = ~15;
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1106,8 +1106,8 @@ programmer
|
||||||
buff = 5, 6, 7;
|
buff = 5, 6, 7;
|
||||||
reset = 3;
|
reset = 3;
|
||||||
sck = 0;
|
sck = 0;
|
||||||
mosi = 1;
|
sdo = 1;
|
||||||
miso = 2;
|
sdi = 2;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1190,11 +1190,11 @@ programmer
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
connection_type = serial;
|
connection_type = serial;
|
||||||
# pins are bits in bitbang byte (numbers are 87654321)
|
# pins are bits in bitbang byte (numbers are 87654321)
|
||||||
# 1|POWER|PULLUP|AUX|MOSI|CLK|MISO|CS
|
# 1|POWER|PULLUP|AUX|SDO|CLK|SDI|CS
|
||||||
reset = 1;
|
reset = 1;
|
||||||
sck = 3;
|
sck = 3;
|
||||||
mosi = 4;
|
sdo = 4;
|
||||||
miso = 2;
|
sdi = 2;
|
||||||
# vcc = 7; # Internally set independent of this setting
|
# vcc = 7; # Internally set independent of this setting
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1335,8 +1335,8 @@ programmer
|
||||||
connection_type = usb;
|
connection_type = usb;
|
||||||
reset = 4; # D4
|
reset = 4; # D4
|
||||||
sck = 0; # D0
|
sck = 0; # D0
|
||||||
mosi = 2; # D2
|
sdo = 2; # D2
|
||||||
miso = 1; # D1
|
sdi = 1; # D1
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1351,8 +1351,8 @@ programmer
|
||||||
connection_type = usb;
|
connection_type = usb;
|
||||||
reset = 4; # DTR
|
reset = 4; # DTR
|
||||||
sck = 0; # TxD
|
sck = 0; # TxD
|
||||||
mosi = 2; # RTS
|
sdo = 2; # RTS
|
||||||
miso = 1; # RxD
|
sdi = 1; # RxD
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1369,8 +1369,8 @@ programmer
|
||||||
connection_type = usb;
|
connection_type = usb;
|
||||||
reset = 7; # RI
|
reset = 7; # RI
|
||||||
sck = 6; # DCD
|
sck = 6; # DCD
|
||||||
mosi = 3; # CTS
|
sdo = 3; # CTS
|
||||||
miso = 5; # DSR
|
sdi = 5; # DSR
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1388,8 +1388,8 @@ programmer
|
||||||
connection_type = usb;
|
connection_type = usb;
|
||||||
reset = 7; # RI X3(4)
|
reset = 7; # RI X3(4)
|
||||||
sck = 5; # DSR X3(2)
|
sck = 5; # DSR X3(2)
|
||||||
mosi = 6; # DCD X3(3)
|
sdo = 6; # DCD X3(3)
|
||||||
miso = 3; # CTS X3(1)
|
sdi = 3; # CTS X3(1)
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1405,8 +1405,8 @@ programmer
|
||||||
# FOR TPI devices:
|
# FOR TPI devices:
|
||||||
reset = 3; # CTS = D3 (wire to ~RESET)
|
reset = 3; # CTS = D3 (wire to ~RESET)
|
||||||
sck = 2; # RTS = D2 (wire to SCK)
|
sck = 2; # RTS = D2 (wire to SCK)
|
||||||
mosi = 0; # TxD = D0 (wire to TPIDATA via 1k resistor)
|
sdo = 0; # TxD = D0 (wire to TPIDATA via 1k resistor)
|
||||||
miso = 1; # RxD = D1 (wire to TPIDATA directly)
|
sdi = 1; # RxD = D1 (wire to TPIDATA directly)
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1439,8 +1439,8 @@ programmer
|
||||||
connection_type = usb;
|
connection_type = usb;
|
||||||
reset = 7; # ri
|
reset = 7; # ri
|
||||||
sck = 5; # dsr
|
sck = 5; # dsr
|
||||||
mosi = 6; # dcd
|
sdo = 6; # dcd
|
||||||
miso = 3; # cts
|
sdi = 3; # cts
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1453,11 +1453,11 @@ programmer
|
||||||
# For ICSP pinout see for example http://www.atmel.com/images/doc2562.pdf
|
# For ICSP pinout see for example http://www.atmel.com/images/doc2562.pdf
|
||||||
# (Figure 1. ISP6PIN header pinout and Table 1. Connections required for ISP ...)
|
# (Figure 1. ISP6PIN header pinout and Table 1. Connections required for ISP ...)
|
||||||
# TTL-232R GND 1 Black -> ICPS GND (pin 6)
|
# TTL-232R GND 1 Black -> ICPS GND (pin 6)
|
||||||
# TTL-232R CTS 2 Brown -> ICPS MOSI (pin 4)
|
# TTL-232R CTS 2 Brown -> ICPS SDO (pin 4)
|
||||||
# TTL-232R VCC 3 Red -> ICPS VCC (pin 2)
|
# TTL-232R VCC 3 Red -> ICPS VCC (pin 2)
|
||||||
# TTL-232R TXD 4 Orange -> ICPS RESET (pin 5)
|
# TTL-232R TXD 4 Orange -> ICPS RESET (pin 5)
|
||||||
# TTL-232R RXD 5 Yellow -> ICPS SCK (pin 3)
|
# TTL-232R RXD 5 Yellow -> ICPS SCK (pin 3)
|
||||||
# TTL-232R RTS 6 Green -> ICPS MISO (pin 1)
|
# TTL-232R RTS 6 Green -> ICPS SDI (pin 1)
|
||||||
# Except for VCC and GND, you can connect arbitual pairs as long as
|
# Except for VCC and GND, you can connect arbitual pairs as long as
|
||||||
# the following table is adjusted.
|
# the following table is adjusted.
|
||||||
|
|
||||||
|
@ -1469,8 +1469,8 @@ programmer
|
||||||
connection_type = usb;
|
connection_type = usb;
|
||||||
reset = 0; # txd
|
reset = 0; # txd
|
||||||
sck = 1; # rxd
|
sck = 1; # rxd
|
||||||
mosi = 3; # cts
|
sdo = 3; # cts
|
||||||
miso = 2; # rts
|
sdi = 2; # rts
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -1537,8 +1537,8 @@ programmer
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
# USBtiny can also be used for TPI programming.
|
# USBtiny can also be used for TPI programming.
|
||||||
# In that case, a resistor of 1 kOhm is needed between MISO and MOSI
|
# In that case, a resistor of 1 kOhm is needed between SDI and SDO
|
||||||
# pins of the connector, and MISO (pin 1 of the 6-pin connector)
|
# pins of the connector, and SDI (pin 1 of the 6-pin connector)
|
||||||
# connects to TPIDATA.
|
# connects to TPIDATA.
|
||||||
|
|
||||||
programmer
|
programmer
|
||||||
|
@ -2421,18 +2421,18 @@ programmer
|
||||||
# Using RI is not supported under Win32 but is supported under Posix.
|
# Using RI is not supported under Win32 but is supported under Posix.
|
||||||
|
|
||||||
# serial ponyprog design (dasa2 in uisp)
|
# serial ponyprog design (dasa2 in uisp)
|
||||||
# reset=!txd sck=rts mosi=dtr miso=cts
|
# reset=!txd sck=rts sdo=dtr sdi=cts
|
||||||
|
|
||||||
programmer
|
programmer
|
||||||
id = "ponyser";
|
id = "ponyser";
|
||||||
desc = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts";
|
desc = "design ponyprog serial, reset=!txd sck=rts sdo=dtr sdi=cts";
|
||||||
type = "serbb";
|
type = "serbb";
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
connection_type = serial;
|
connection_type = serial;
|
||||||
reset = ~3;
|
reset = ~3;
|
||||||
sck = 7;
|
sck = 7;
|
||||||
mosi = 4;
|
sdo = 4;
|
||||||
miso = 8;
|
sdi = 8;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -2440,7 +2440,7 @@ programmer
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
# Same as above, different name
|
# Same as above, different name
|
||||||
# reset=!txd sck=rts mosi=dtr miso=cts
|
# reset=!txd sck=rts sdo=dtr sdi=cts
|
||||||
|
|
||||||
programmer parent "ponyser"
|
programmer parent "ponyser"
|
||||||
id = "siprog";
|
id = "siprog";
|
||||||
|
@ -2452,18 +2452,18 @@ programmer parent "ponyser"
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
# unknown (dasa in uisp)
|
# unknown (dasa in uisp)
|
||||||
# reset=rts sck=dtr mosi=txd miso=cts
|
# reset=rts sck=dtr sdo=txd sdi=cts
|
||||||
|
|
||||||
programmer
|
programmer
|
||||||
id = "dasa";
|
id = "dasa";
|
||||||
desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts";
|
desc = "serial port banging, reset=rts sck=dtr sdo=txd sdi=cts";
|
||||||
type = "serbb";
|
type = "serbb";
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
connection_type = serial;
|
connection_type = serial;
|
||||||
reset = 7;
|
reset = 7;
|
||||||
sck = 4;
|
sck = 4;
|
||||||
mosi = 3;
|
sdo = 3;
|
||||||
miso = 8;
|
sdi = 8;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -2471,18 +2471,18 @@ programmer
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
# unknown (dasa3 in uisp)
|
# unknown (dasa3 in uisp)
|
||||||
# reset=!dtr sck=rts mosi=txd miso=cts
|
# reset=!dtr sck=rts sdo=txd sdi=cts
|
||||||
|
|
||||||
programmer
|
programmer
|
||||||
id = "dasa3";
|
id = "dasa3";
|
||||||
desc = "serial port banging, reset=!dtr sck=rts mosi=txd miso=cts";
|
desc = "serial port banging, reset=!dtr sck=rts sdo=txd sdi=cts";
|
||||||
type = "serbb";
|
type = "serbb";
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
connection_type = serial;
|
connection_type = serial;
|
||||||
reset = ~4;
|
reset = ~4;
|
||||||
sck = 7;
|
sck = 7;
|
||||||
mosi = 3;
|
sdo = 3;
|
||||||
miso = 8;
|
sdi = 8;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
@ -2490,18 +2490,18 @@ programmer
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
# C2N232i (jumper configuration "auto")
|
# C2N232i (jumper configuration "auto")
|
||||||
# reset=dtr sck=!rts mosi=!txd miso=!cts
|
# reset=dtr sck=!rts sdo=!txd sdi=!cts
|
||||||
|
|
||||||
programmer
|
programmer
|
||||||
id = "c2n232i";
|
id = "c2n232i";
|
||||||
desc = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts";
|
desc = "serial port banging, reset=dtr sck=!rts sdo=!txd sdi=!cts";
|
||||||
type = "serbb";
|
type = "serbb";
|
||||||
prog_modes = PM_TPI | PM_ISP;
|
prog_modes = PM_TPI | PM_ISP;
|
||||||
connection_type = serial;
|
connection_type = serial;
|
||||||
reset = 4;
|
reset = 4;
|
||||||
sck = ~7;
|
sck = ~7;
|
||||||
mosi = ~3;
|
sdo = ~3;
|
||||||
miso = ~8;
|
sdi = ~8;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
|
@ -62,7 +62,7 @@ void avrftdi_initpgm(PROGRAMMER *pgm) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
enum { FTDI_SCK = 0, FTDI_MOSI, FTDI_MISO, FTDI_RESET };
|
enum { FTDI_SCK = 0, FTDI_SDO, FTDI_SDI, FTDI_RESET };
|
||||||
|
|
||||||
static int write_flush(avrftdi_t *);
|
static int write_flush(avrftdi_t *);
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ static int set_frequency(avrftdi_t* ftdi, uint32_t freq)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function sets or clears any pin, except SCK, MISO and MOSI. Depending
|
* This function sets or clears any pin, except SCK, SDI and SDO. Depending
|
||||||
* on the pin configuration, a non-zero value sets the pin in the 'active'
|
* on the pin configuration, a non-zero value sets the pin in the 'active'
|
||||||
* state (high active, low active) and a zero value sets the pin in the
|
* state (high active, low active) and a zero value sets the pin in the
|
||||||
* inactive state.
|
* inactive state.
|
||||||
|
@ -288,7 +288,7 @@ static inline int set_data(const PROGRAMMER *pgm, unsigned char *buf, unsigned c
|
||||||
avrftdi_t* pdata = to_pdata(pgm);
|
avrftdi_t* pdata = to_pdata(pgm);
|
||||||
|
|
||||||
for (j=0; j<8; j++) {
|
for (j=0; j<8; j++) {
|
||||||
pdata->pin_value = SET_BITS_0(pdata->pin_value,pgm,PIN_AVR_MOSI,data & bit);
|
pdata->pin_value = SET_BITS_0(pdata->pin_value,pgm,PIN_AVR_SDO,data & bit);
|
||||||
pdata->pin_value = SET_BITS_0(pdata->pin_value,pgm,PIN_AVR_SCK,0);
|
pdata->pin_value = SET_BITS_0(pdata->pin_value,pgm,PIN_AVR_SCK,0);
|
||||||
buf[buf_pos++] = SET_BITS_LOW;
|
buf[buf_pos++] = SET_BITS_LOW;
|
||||||
buf[buf_pos++] = (pdata->pin_value) & 0xff;
|
buf[buf_pos++] = (pdata->pin_value) & 0xff;
|
||||||
|
@ -323,7 +323,7 @@ static inline unsigned char extract_data(const PROGRAMMER *pgm, unsigned char *b
|
||||||
buf += offset * 16; // 2 bytes per bit, 8 bits
|
buf += offset * 16; // 2 bytes per bit, 8 bits
|
||||||
for (j=0; j<8; j++) {
|
for (j=0; j<8; j++) {
|
||||||
uint16_t in = buf[0] | (buf[1] << 8);
|
uint16_t in = buf[0] | (buf[1] << 8);
|
||||||
if (GET_BITS_0(in,pgm,PIN_AVR_MISO)) {
|
if (GET_BITS_0(in,pgm,PIN_AVR_SDI)) {
|
||||||
r |= bit;
|
r |= bit;
|
||||||
}
|
}
|
||||||
buf += 2; // 2 bytes per input
|
buf += 2; // 2 bytes per input
|
||||||
|
@ -545,16 +545,16 @@ static int avrftdi_check_pins_mpsse(const PROGRAMMER *pgm, bool output) {
|
||||||
|
|
||||||
avrftdi_t* pdata = to_pdata(pgm);
|
avrftdi_t* pdata = to_pdata(pgm);
|
||||||
|
|
||||||
/* SCK/MOSI/MISO are fixed and not invertible?*/
|
/* SCK/SDO/SDI are fixed and not invertible? */
|
||||||
/* TODO: inverted SCK/MISO/MOSI */
|
/* TODO: inverted SCK/SDI/SDO */
|
||||||
static const struct pindef_t valid_pins_SCK = {{0x01},{0x00}};
|
static const struct pindef_t valid_pins_SCK = {{0x01},{0x00}};
|
||||||
static const struct pindef_t valid_pins_MOSI = {{0x02},{0x00}} ;
|
static const struct pindef_t valid_pins_SDO = {{0x02},{0x00}};
|
||||||
static const struct pindef_t valid_pins_MISO = {{0x04},{0x00}} ;
|
static const struct pindef_t valid_pins_SDI = {{0x04},{0x00}};
|
||||||
|
|
||||||
/* value for 8/12/16 bit wide interface for other pins */
|
/* value for 8/12/16 bit wide interface for other pins */
|
||||||
int valid_mask = ((1 << pdata->pin_limit) - 1);
|
int valid_mask = ((1 << pdata->pin_limit) - 1);
|
||||||
/* mask out SCK/MISO/MOSI */
|
/* mask out SCK/SDI/SDO */
|
||||||
valid_mask &= ~((1 << FTDI_SCK) | (1 << FTDI_MOSI) | (1 << FTDI_MISO));
|
valid_mask &= ~((1 << FTDI_SCK) | (1 << FTDI_SDO) | (1 << FTDI_SDI));
|
||||||
|
|
||||||
log_debug("Using valid mask mpsse: 0x%08x\n", valid_mask);
|
log_debug("Using valid mask mpsse: 0x%08x\n", valid_mask);
|
||||||
static struct pindef_t valid_pins_others;
|
static struct pindef_t valid_pins_others;
|
||||||
|
@ -571,10 +571,10 @@ static int avrftdi_check_pins_mpsse(const PROGRAMMER *pgm, bool output) {
|
||||||
/* now set mpsse specific pins */
|
/* now set mpsse specific pins */
|
||||||
pin_checklist[PIN_AVR_SCK].mandatory = 1;
|
pin_checklist[PIN_AVR_SCK].mandatory = 1;
|
||||||
pin_checklist[PIN_AVR_SCK].valid_pins = &valid_pins_SCK;
|
pin_checklist[PIN_AVR_SCK].valid_pins = &valid_pins_SCK;
|
||||||
pin_checklist[PIN_AVR_MOSI].mandatory = 1;
|
pin_checklist[PIN_AVR_SDO].mandatory = 1;
|
||||||
pin_checklist[PIN_AVR_MOSI].valid_pins = &valid_pins_MOSI;
|
pin_checklist[PIN_AVR_SDO].valid_pins = &valid_pins_SDO;
|
||||||
pin_checklist[PIN_AVR_MISO].mandatory = 1;
|
pin_checklist[PIN_AVR_SDI].mandatory = 1;
|
||||||
pin_checklist[PIN_AVR_MISO].valid_pins = &valid_pins_MISO;
|
pin_checklist[PIN_AVR_SDI].valid_pins = &valid_pins_SDI;
|
||||||
pin_checklist[PIN_AVR_RESET].mandatory = 1;
|
pin_checklist[PIN_AVR_RESET].mandatory = 1;
|
||||||
|
|
||||||
/* assumes all checklists above have same number of entries */
|
/* assumes all checklists above have same number of entries */
|
||||||
|
@ -599,10 +599,10 @@ static int avrftdi_pin_setup(const PROGRAMMER *pgm) {
|
||||||
avrftdi_check_pins_bb(pgm, true);
|
avrftdi_check_pins_bb(pgm, true);
|
||||||
log_err("Pin configuration for FTDI MPSSE must be:\n");
|
log_err("Pin configuration for FTDI MPSSE must be:\n");
|
||||||
log_err("%s: 0, %s: 1, %s: 2 (is: %s, %s, %s)\n", avr_pin_name(PIN_AVR_SCK),
|
log_err("%s: 0, %s: 1, %s: 2 (is: %s, %s, %s)\n", avr_pin_name(PIN_AVR_SCK),
|
||||||
avr_pin_name(PIN_AVR_MOSI), avr_pin_name(PIN_AVR_MISO),
|
avr_pin_name(PIN_AVR_SDO), avr_pin_name(PIN_AVR_SDI),
|
||||||
pins_to_str(&pgm->pin[PIN_AVR_SCK]),
|
pins_to_str(&pgm->pin[PIN_AVR_SCK]),
|
||||||
pins_to_str(&pgm->pin[PIN_AVR_MOSI]),
|
pins_to_str(&pgm->pin[PIN_AVR_SDO]),
|
||||||
pins_to_str(&pgm->pin[PIN_AVR_MISO]));
|
pins_to_str(&pgm->pin[PIN_AVR_SDI]));
|
||||||
log_err("If other pin configuration is used, fallback to slower bitbanging mode is used.\n");
|
log_err("If other pin configuration is used, fallback to slower bitbanging mode is used.\n");
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -614,16 +614,16 @@ static int avrftdi_pin_setup(const PROGRAMMER *pgm) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: No need to fail for a wrongly configured led or something.
|
* TODO: No need to fail for a wrongly configured led or something.
|
||||||
* Maybe we should only fail for SCK; MISO, MOSI, RST (and probably
|
* Maybe we should only fail for SCK; SDI, SDO, RST (and probably
|
||||||
* VCC and BUFF).
|
* VCC and BUFF).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* everything is an output, except MISO */
|
/* everything is an output, except SDI */
|
||||||
for(pin = 0; pin < N_PINS; ++pin) {
|
for(pin = 0; pin < N_PINS; ++pin) {
|
||||||
pdata->pin_direction |= pgm->pin[pin].mask[0];
|
pdata->pin_direction |= pgm->pin[pin].mask[0];
|
||||||
pdata->pin_value = SET_BITS_0(pdata->pin_value, pgm, pin, OFF);
|
pdata->pin_value = SET_BITS_0(pdata->pin_value, pgm, pin, OFF);
|
||||||
}
|
}
|
||||||
pdata->pin_direction &= ~pgm->pin[PIN_AVR_MISO].mask[0];
|
pdata->pin_direction &= ~pgm->pin[PIN_AVR_SDI].mask[0];
|
||||||
|
|
||||||
for(pin = PIN_LED_ERR; pin < N_PINS; ++pin) {
|
for(pin = PIN_LED_ERR; pin < N_PINS; ++pin) {
|
||||||
pdata->led_mask |= pgm->pin[pin].mask[0];
|
pdata->led_mask |= pgm->pin[pin].mask[0];
|
||||||
|
|
|
@ -72,7 +72,7 @@ avrftdi_tpi_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
log_info("Setting /Reset pin low\n");
|
log_info("Setting /Reset pin low\n");
|
||||||
pgm->setpin(pgm, PIN_AVR_RESET, OFF);
|
pgm->setpin(pgm, PIN_AVR_RESET, OFF);
|
||||||
pgm->setpin(pgm, PIN_AVR_SCK, OFF);
|
pgm->setpin(pgm, PIN_AVR_SCK, OFF);
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, ON);
|
pgm->setpin(pgm, PIN_AVR_SDO, ON);
|
||||||
usleep(20 * 1000);
|
usleep(20 * 1000);
|
||||||
|
|
||||||
pgm->setpin(pgm, PIN_AVR_RESET, ON);
|
pgm->setpin(pgm, PIN_AVR_RESET, ON);
|
||||||
|
|
|
@ -172,9 +172,9 @@ static unsigned char bitbang_txrx(const PROGRAMMER *pgm, unsigned char byte) {
|
||||||
* one pgm->setpin()-call resp. par clrpin()-call, then
|
* one pgm->setpin()-call resp. par clrpin()-call, then
|
||||||
* - SCK is high for 2T
|
* - SCK is high for 2T
|
||||||
* - SCK is low for 2T
|
* - SCK is low for 2T
|
||||||
* - MOSI setuptime is 1T
|
* - SDO setuptime is 1T
|
||||||
* - MOSI holdtime is 3T
|
* - SDO holdtime is 3T
|
||||||
* - SCK low to MISO read is 2T to 3T
|
* - SCK low to SDI read is 2T to 3T
|
||||||
* So we are within programming specs (expect for AT90S1200),
|
* So we are within programming specs (expect for AT90S1200),
|
||||||
* if and only if T>t_CLCL (t_CLCL=clock period of target system).
|
* if and only if T>t_CLCL (t_CLCL=clock period of target system).
|
||||||
*
|
*
|
||||||
|
@ -186,7 +186,7 @@ static unsigned char bitbang_txrx(const PROGRAMMER *pgm, unsigned char byte) {
|
||||||
b = (byte >> i) & 0x01;
|
b = (byte >> i) & 0x01;
|
||||||
|
|
||||||
/* set the data input line as desired */
|
/* set the data input line as desired */
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, b);
|
pgm->setpin(pgm, PIN_AVR_SDO, b);
|
||||||
|
|
||||||
pgm->setpin(pgm, PIN_AVR_SCK, 1);
|
pgm->setpin(pgm, PIN_AVR_SCK, 1);
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ static unsigned char bitbang_txrx(const PROGRAMMER *pgm, unsigned char byte) {
|
||||||
* read the result bit (it is either valid from a previous falling
|
* read the result bit (it is either valid from a previous falling
|
||||||
* edge or it is ignored in the current context)
|
* edge or it is ignored in the current context)
|
||||||
*/
|
*/
|
||||||
r = pgm->getpin(pgm, PIN_AVR_MISO);
|
r = pgm->getpin(pgm, PIN_AVR_SDI);
|
||||||
|
|
||||||
pgm->setpin(pgm, PIN_AVR_SCK, 0);
|
pgm->setpin(pgm, PIN_AVR_SCK, 0);
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ static int bitbang_tpi_clk(const PROGRAMMER *pgm) {
|
||||||
unsigned char r = 0;
|
unsigned char r = 0;
|
||||||
pgm->setpin(pgm, PIN_AVR_SCK, 1);
|
pgm->setpin(pgm, PIN_AVR_SCK, 1);
|
||||||
|
|
||||||
r = pgm->getpin(pgm, PIN_AVR_MISO);
|
r = pgm->getpin(pgm, PIN_AVR_SDI);
|
||||||
|
|
||||||
pgm->setpin(pgm, PIN_AVR_SCK, 0);
|
pgm->setpin(pgm, PIN_AVR_SCK, 0);
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ void bitbang_tpi_tx(const PROGRAMMER *pgm, unsigned char byte) {
|
||||||
unsigned char b, parity;
|
unsigned char b, parity;
|
||||||
|
|
||||||
/* start bit */
|
/* start bit */
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, 0);
|
pgm->setpin(pgm, PIN_AVR_SDO, 0);
|
||||||
bitbang_tpi_clk(pgm);
|
bitbang_tpi_clk(pgm);
|
||||||
|
|
||||||
parity = 0;
|
parity = 0;
|
||||||
|
@ -229,16 +229,16 @@ void bitbang_tpi_tx(const PROGRAMMER *pgm, unsigned char byte) {
|
||||||
parity ^= b;
|
parity ^= b;
|
||||||
|
|
||||||
/* set the data input line as desired */
|
/* set the data input line as desired */
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, b);
|
pgm->setpin(pgm, PIN_AVR_SDO, b);
|
||||||
bitbang_tpi_clk(pgm);
|
bitbang_tpi_clk(pgm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parity bit */
|
/* parity bit */
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, parity);
|
pgm->setpin(pgm, PIN_AVR_SDO, parity);
|
||||||
bitbang_tpi_clk(pgm);
|
bitbang_tpi_clk(pgm);
|
||||||
|
|
||||||
/* 2 stop bits */
|
/* 2 stop bits */
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, 1);
|
pgm->setpin(pgm, PIN_AVR_SDO, 1);
|
||||||
bitbang_tpi_clk(pgm);
|
bitbang_tpi_clk(pgm);
|
||||||
bitbang_tpi_clk(pgm);
|
bitbang_tpi_clk(pgm);
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ int bitbang_tpi_rx(const PROGRAMMER *pgm) {
|
||||||
unsigned char b, rbyte, parity;
|
unsigned char b, rbyte, parity;
|
||||||
|
|
||||||
/* make sure pin is on for "pullup" */
|
/* make sure pin is on for "pullup" */
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, 1);
|
pgm->setpin(pgm, PIN_AVR_SDO, 1);
|
||||||
|
|
||||||
/* wait for start bit (up to 10 bits) */
|
/* wait for start bit (up to 10 bits) */
|
||||||
b = 1;
|
b = 1;
|
||||||
|
@ -517,7 +517,7 @@ int bitbang_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
pgm->powerup(pgm);
|
pgm->powerup(pgm);
|
||||||
usleep(20000);
|
usleep(20000);
|
||||||
|
|
||||||
/* TPIDATA is a single line, so MISO & MOSI should be connected */
|
/* TPIDATA is a single line, so SDI & SDO should be connected */
|
||||||
if (p->prog_modes & PM_TPI) {
|
if (p->prog_modes & PM_TPI) {
|
||||||
/* make sure cmd_tpi() is defined */
|
/* make sure cmd_tpi() is defined */
|
||||||
if (pgm->cmd_tpi == NULL) {
|
if (pgm->cmd_tpi == NULL) {
|
||||||
|
@ -532,20 +532,20 @@ int bitbang_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
/* RESET must be LOW in case the existing code is driving the TPI pins: */
|
/* RESET must be LOW in case the existing code is driving the TPI pins: */
|
||||||
pgm->setpin(pgm, PIN_AVR_RESET, 0);
|
pgm->setpin(pgm, PIN_AVR_RESET, 0);
|
||||||
|
|
||||||
msg_notice2("doing MOSI-MISO link check\n");
|
msg_notice2("doing SDO-SDI link check\n");
|
||||||
|
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, 0);
|
pgm->setpin(pgm, PIN_AVR_SDO, 0);
|
||||||
if (pgm->getpin(pgm, PIN_AVR_MISO) != 0) {
|
if (pgm->getpin(pgm, PIN_AVR_SDI) != 0) {
|
||||||
pmsg_error("MOSI->MISO 0 failed\n");
|
pmsg_error("SDO->SDI 0 failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, 1);
|
pgm->setpin(pgm, PIN_AVR_SDO, 1);
|
||||||
if (pgm->getpin(pgm, PIN_AVR_MISO) != 1) {
|
if (pgm->getpin(pgm, PIN_AVR_SDI) != 1) {
|
||||||
pmsg_error("MOSI->MISO 1 failed\n");
|
pmsg_error("SDO->SDI 1 failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_notice2("MOSI-MISO link present\n");
|
msg_notice2("SDO-SDI link present\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
pgm->setpin(pgm, PIN_AVR_SCK, 0);
|
pgm->setpin(pgm, PIN_AVR_SCK, 0);
|
||||||
|
@ -554,7 +554,7 @@ int bitbang_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
|
|
||||||
if (p->prog_modes & PM_TPI) {
|
if (p->prog_modes & PM_TPI) {
|
||||||
/* keep TPIDATA high for 16 clock cycles */
|
/* keep TPIDATA high for 16 clock cycles */
|
||||||
pgm->setpin(pgm, PIN_AVR_MOSI, 1);
|
pgm->setpin(pgm, PIN_AVR_SDO, 1);
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
pgm->highpulsepin(pgm, PIN_AVR_SCK);
|
pgm->highpulsepin(pgm, PIN_AVR_SCK);
|
||||||
|
|
||||||
|
@ -626,9 +626,9 @@ int bitbang_check_prerequisites(const PROGRAMMER *pgm) {
|
||||||
return -1;
|
return -1;
|
||||||
if (verify_pin_assigned(pgm, PIN_AVR_SCK, "AVR SCK") < 0)
|
if (verify_pin_assigned(pgm, PIN_AVR_SCK, "AVR SCK") < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (verify_pin_assigned(pgm, PIN_AVR_MISO, "AVR MISO") < 0)
|
if (verify_pin_assigned(pgm, PIN_AVR_SDI, "AVR SDI") < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (verify_pin_assigned(pgm, PIN_AVR_MOSI, "AVR MOSI") < 0)
|
if (verify_pin_assigned(pgm, PIN_AVR_SDO, "AVR SDO") < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (pgm->cmd == NULL) {
|
if (pgm->cmd == NULL) {
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
* GND <-> GND
|
* GND <-> GND
|
||||||
* +5V <-> Vcc
|
* +5V <-> Vcc
|
||||||
* CS <-> RESET
|
* CS <-> RESET
|
||||||
* MOSI <-> MOSI
|
* SDO <-> SDO
|
||||||
* MISO <-> MISO
|
* SDI <-> SDI
|
||||||
* SCL/CLK <-> SCK
|
* SCL/CLK <-> SCK
|
||||||
* ( AUX <-> XTAL1 )
|
* ( AUX <-> XTAL1 )
|
||||||
*
|
*
|
||||||
|
@ -1168,12 +1168,12 @@ static void buspirate_bb_enable(PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
PDATA(pgm)->flag |= BP_FLAG_IN_BINMODE;
|
PDATA(pgm)->flag |= BP_FLAG_IN_BINMODE;
|
||||||
|
|
||||||
/* Set pin directions and an initial pin status (all high) */
|
/* Set pin directions and an initial pin status (all high) */
|
||||||
PDATA(pgm)->pin_dir = 0x12; /* AUX, MISO input; everything else output */
|
PDATA(pgm)->pin_dir = 0x12; /* AUX, SDI input; everything else output */
|
||||||
buf[0] = PDATA(pgm)->pin_dir | 0x40;
|
buf[0] = PDATA(pgm)->pin_dir | 0x40;
|
||||||
buspirate_send_bin(pgm, buf, 1);
|
buspirate_send_bin(pgm, buf, 1);
|
||||||
buspirate_recv_bin(pgm, buf, 1);
|
buspirate_recv_bin(pgm, buf, 1);
|
||||||
|
|
||||||
PDATA(pgm)->pin_val = 0x3f; /* PULLUP, AUX, MOSI, CLK, MISO, CS high */
|
PDATA(pgm)->pin_val = 0x3f; /* PULLUP, AUX, SDO, CLK, SDI, CS high */
|
||||||
buf[0] = PDATA(pgm)->pin_val | 0x80;
|
buf[0] = PDATA(pgm)->pin_val | 0x80;
|
||||||
buspirate_send_bin(pgm, buf, 1);
|
buspirate_send_bin(pgm, buf, 1);
|
||||||
buspirate_recv_bin(pgm, buf, 1);
|
buspirate_recv_bin(pgm, buf, 1);
|
||||||
|
@ -1186,15 +1186,15 @@ static void buspirate_bb_enable(PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
Direction:
|
Direction:
|
||||||
010xxxxx
|
010xxxxx
|
||||||
Input (1) or output (0):
|
Input (1) or output (0):
|
||||||
AUX|MOSI|CLK|MISO|CS
|
AUX|SDO|CLK|SDI|CS
|
||||||
|
|
||||||
Output value:
|
Output value:
|
||||||
1xxxxxxx
|
1xxxxxxx
|
||||||
High (1) or low(0):
|
High (1) or low(0):
|
||||||
1|POWER|PULLUP|AUX|MOSI|CLK|MISO|CS
|
1|POWER|PULLUP|AUX|SDO|CLK|SDI|CS
|
||||||
|
|
||||||
Both respond with a byte with current status:
|
Both respond with a byte with current status:
|
||||||
0|POWER|PULLUP|AUX|MOSI|CLK|MISO|CS
|
0|POWER|PULLUP|AUX|SDO|CLK|SDI|CS
|
||||||
*/
|
*/
|
||||||
static int buspirate_bb_getpin(const PROGRAMMER *pgm, int pinfunc) {
|
static int buspirate_bb_getpin(const PROGRAMMER *pgm, int pinfunc) {
|
||||||
unsigned char buf[10];
|
unsigned char buf[10];
|
||||||
|
|
|
@ -100,8 +100,8 @@ static int pin_name;
|
||||||
%token K_MAX_WRITE_DELAY
|
%token K_MAX_WRITE_DELAY
|
||||||
%token K_MCU_BASE
|
%token K_MCU_BASE
|
||||||
%token K_MIN_WRITE_DELAY
|
%token K_MIN_WRITE_DELAY
|
||||||
%token K_MISO
|
%token K_SDI
|
||||||
%token K_MOSI
|
%token K_SDO
|
||||||
%token K_NUM_PAGES
|
%token K_NUM_PAGES
|
||||||
%token K_NVM_BASE
|
%token K_NVM_BASE
|
||||||
%token K_OCD_BASE
|
%token K_OCD_BASE
|
||||||
|
@ -662,8 +662,8 @@ prog_parm_pins:
|
||||||
K_BUFF TKN_EQUAL {pin_name = PPI_AVR_BUFF; } pin_list |
|
K_BUFF TKN_EQUAL {pin_name = PPI_AVR_BUFF; } pin_list |
|
||||||
K_RESET TKN_EQUAL {pin_name = PIN_AVR_RESET;} pin_number { free_token($1); } |
|
K_RESET TKN_EQUAL {pin_name = PIN_AVR_RESET;} pin_number { free_token($1); } |
|
||||||
K_SCK TKN_EQUAL {pin_name = PIN_AVR_SCK; } pin_number { free_token($1); } |
|
K_SCK TKN_EQUAL {pin_name = PIN_AVR_SCK; } pin_number { free_token($1); } |
|
||||||
K_MOSI TKN_EQUAL {pin_name = PIN_AVR_MOSI; } pin_number |
|
K_SDO TKN_EQUAL {pin_name = PIN_AVR_SDO; } pin_number |
|
||||||
K_MISO TKN_EQUAL {pin_name = PIN_AVR_MISO; } pin_number |
|
K_SDI TKN_EQUAL {pin_name = PIN_AVR_SDI; } pin_number |
|
||||||
K_ERRLED TKN_EQUAL {pin_name = PIN_LED_ERR; } pin_number |
|
K_ERRLED TKN_EQUAL {pin_name = PIN_LED_ERR; } pin_number |
|
||||||
K_RDYLED TKN_EQUAL {pin_name = PIN_LED_RDY; } pin_number |
|
K_RDYLED TKN_EQUAL {pin_name = PIN_LED_RDY; } pin_number |
|
||||||
K_PGMLED TKN_EQUAL {pin_name = PIN_LED_PGM; } pin_number |
|
K_PGMLED TKN_EQUAL {pin_name = PIN_LED_PGM; } pin_number |
|
||||||
|
|
|
@ -164,7 +164,7 @@ abysmally slow.
|
||||||
|
|
||||||
If you happen to have a Linux system with at least 4 hardware GPIOs
|
If you happen to have a Linux system with at least 4 hardware GPIOs
|
||||||
available (like almost all embedded Linux boards) you can do without
|
available (like almost all embedded Linux boards) you can do without
|
||||||
any additional hardware - just connect them to the MOSI, MISO, RESET
|
any additional hardware - just connect them to the SDO, SDI, RESET
|
||||||
and SCK pins on the AVR and use the linuxgpio programmer type. It bitbangs
|
and SCK pins on the AVR and use the linuxgpio programmer type. It bitbangs
|
||||||
the lines using the Linux sysfs GPIO interface. Of course, care should
|
the lines using the Linux sysfs GPIO interface. Of course, care should
|
||||||
be taken about voltage level compatibility. Also, although not strictly
|
be taken about voltage level compatibility. Also, although not strictly
|
||||||
|
@ -195,7 +195,7 @@ the level translator to protect the hardware from damage.
|
||||||
On a Raspberry Pi, header J8 provides access to the SPI and GPIO
|
On a Raspberry Pi, header J8 provides access to the SPI and GPIO
|
||||||
lines.
|
lines.
|
||||||
|
|
||||||
Typically, pins 19, 21, and 23 are SPI MOSI, MISO, and SCK, while
|
Typically, pins 19, 21, and 23 are SPI SDO, SDI, and SCK, while
|
||||||
pins 24 and 26 would serve as CE outputs. So, close to these pins
|
pins 24 and 26 would serve as CE outputs. So, close to these pins
|
||||||
is pin 22 as GPIO25 which can be used as /RESET, and pin 25 can
|
is pin 22 as GPIO25 which can be used as /RESET, and pin 25 can
|
||||||
be used as GND.
|
be used as GND.
|
||||||
|
@ -204,10 +204,10 @@ A typical programming cable would then look like:
|
||||||
|
|
||||||
@multitable @columnfractions .15 .15 .3
|
@multitable @columnfractions .15 .15 .3
|
||||||
@item @code{J8 pin} @tab @code{ISP pin} @tab @code{Name}
|
@item @code{J8 pin} @tab @code{ISP pin} @tab @code{Name}
|
||||||
@item @code{21} @tab @code{1} @tab @code{MISO}
|
@item @code{21} @tab @code{1} @tab @code{SDI}
|
||||||
@item @code{-} @tab @code{2} @tab @code{Vcc - leave open}
|
@item @code{-} @tab @code{2} @tab @code{Vcc - leave open}
|
||||||
@item @code{23} @tab @code{3} @tab @code{SCK}
|
@item @code{23} @tab @code{3} @tab @code{SCK}
|
||||||
@item @code{19} @tab @code{4} @tab @code{MOSI}
|
@item @code{19} @tab @code{4} @tab @code{SDO}
|
||||||
@item @code{22} @tab @code{5} @tab @code{/RESET}
|
@item @code{22} @tab @code{5} @tab @code{/RESET}
|
||||||
@item @code{25} @tab @code{6} @tab @code{GND}
|
@item @code{25} @tab @code{6} @tab @code{GND}
|
||||||
@end multitable
|
@end multitable
|
||||||
|
@ -223,7 +223,7 @@ programmers communicate through the USB, using @code{libusb} as a
|
||||||
platform abstraction layer.
|
platform abstraction layer.
|
||||||
The avrftdi adds support for the FT2232C/D, FT2232H, and FT4232H devices. These all use
|
The avrftdi adds support for the FT2232C/D, FT2232H, and FT4232H devices. These all use
|
||||||
the MPSSE mode, which has a specific pin mapping. Bit 1 (the lsb of the byte in the config
|
the MPSSE mode, which has a specific pin mapping. Bit 1 (the lsb of the byte in the config
|
||||||
file) is SCK. Bit 2 is MOSI, and Bit 3 is MISO. Bit 4 usually reset. The 2232C/D parts
|
file) is SCK. Bit 2 is SDO, and Bit 3 is SDI. Bit 4 usually reset. The 2232C/D parts
|
||||||
are only supported on interface A, but the H parts can be either A or B (specified by the
|
are only supported on interface A, but the H parts can be either A or B (specified by the
|
||||||
usbdev config parameter).
|
usbdev config parameter).
|
||||||
The STK500, STK600, JTAG ICE, and avr910 contain on-board logic to control the programming of the target
|
The STK500, STK600, JTAG ICE, and avr910 contain on-board logic to control the programming of the target
|
||||||
|
@ -947,7 +947,7 @@ The BusPirate programmer type accepts the following extended parameters:
|
||||||
@item @samp{reset=cs,aux,aux2}
|
@item @samp{reset=cs,aux,aux2}
|
||||||
The default setup assumes the BusPirate's CS output pin connected to
|
The default setup assumes the BusPirate's CS output pin connected to
|
||||||
the RESET pin on AVR side. It is however possible to have multiple AVRs
|
the RESET pin on AVR side. It is however possible to have multiple AVRs
|
||||||
connected to the same BP with MISO, MOSI and SCK lines common for all of them.
|
connected to the same BP with SDI, SDO and SCK lines common for all of them.
|
||||||
In such a case one AVR should have its RESET connected to BusPirate's
|
In such a case one AVR should have its RESET connected to BusPirate's
|
||||||
@emph{CS}
|
@emph{CS}
|
||||||
pin, second AVR's RESET connected to BusPirate's
|
pin, second AVR's RESET connected to BusPirate's
|
||||||
|
@ -1075,7 +1075,7 @@ Connection to the PICkit2 programmer:
|
||||||
@item @code{RST} @tab @code{VPP/MCLR (1) }
|
@item @code{RST} @tab @code{VPP/MCLR (1) }
|
||||||
@item @code{VDD} @tab @code{VDD Target (2) -- possibly optional if AVR self powered }
|
@item @code{VDD} @tab @code{VDD Target (2) -- possibly optional if AVR self powered }
|
||||||
@item @code{GND} @tab @code{GND (3) }
|
@item @code{GND} @tab @code{GND (3) }
|
||||||
@item @code{MISO} @tab @code{PGD (4) }
|
@item @code{SDI} @tab @code{PGD (4) }
|
||||||
@item @code{SCLK} @tab @code{PDC (5) }
|
@item @code{SCLK} @tab @code{PDC (5) }
|
||||||
@item @code{OSI} @tab @code{AUX (6) }
|
@item @code{OSI} @tab @code{AUX (6) }
|
||||||
@end multitable
|
@end multitable
|
||||||
|
@ -1799,8 +1799,8 @@ programmer
|
||||||
buff = <pin1> [, <pin2> ... ] ; # pin number(s)
|
buff = <pin1> [, <pin2> ... ] ; # pin number(s)
|
||||||
reset = <pin> ; # pin number
|
reset = <pin> ; # pin number
|
||||||
sck = <pin> ; # pin number
|
sck = <pin> ; # pin number
|
||||||
mosi = <pin> ; # pin number
|
sdo = <pin> ; # pin number
|
||||||
miso = <pin> ; # pin number
|
sdi = <pin> ; # pin number
|
||||||
errled = <pin> ; # pin number
|
errled = <pin> ; # pin number
|
||||||
rdyled = <pin> ; # pin number
|
rdyled = <pin> ; # pin number
|
||||||
pgmled = <pin> ; # pin number
|
pgmled = <pin> ; # pin number
|
||||||
|
@ -2957,10 +2957,10 @@ Solution: Use the 6 pin ISP header on the Dragon and the following pin mapping:
|
||||||
@multitable @columnfractions .2 .2
|
@multitable @columnfractions .2 .2
|
||||||
@item @strong{Dragon} @tab @strong{Target}
|
@item @strong{Dragon} @tab @strong{Target}
|
||||||
@item @strong{ISP Header} @tab @strong{pins}
|
@item @strong{ISP Header} @tab @strong{pins}
|
||||||
@item 1 (MISO) @tab PDI_DATA
|
@item 1 (SDI) @tab PDI_DATA
|
||||||
@item 2 (VCC) @tab VCC
|
@item 2 (VCC) @tab VCC
|
||||||
@item 3 (SCK) @tab
|
@item 3 (SCK) @tab
|
||||||
@item 4 (MOSI) @tab
|
@item 4 (SDO) @tab
|
||||||
@item 5 (RESET) @tab PDI_CLK / RST
|
@item 5 (RESET) @tab PDI_CLK / RST
|
||||||
@item 6 (GND) @tab GND
|
@item 6 (GND) @tab GND
|
||||||
@end multitable
|
@end multitable
|
||||||
|
@ -2974,10 +2974,10 @@ Solution: Use the following pin mapping:
|
||||||
@multitable @columnfractions .2 .2 .2
|
@multitable @columnfractions .2 .2 .2
|
||||||
@item @strong{AVRISP} @tab @strong{Target} @tab @strong{ATtiny}
|
@item @strong{AVRISP} @tab @strong{Target} @tab @strong{ATtiny}
|
||||||
@item @strong{connector} @tab @strong{pins} @tab @strong{pin #}
|
@item @strong{connector} @tab @strong{pins} @tab @strong{pin #}
|
||||||
@item 1 (MISO) @tab TPIDATA @tab 1
|
@item 1 (SDI) @tab TPIDATA @tab 1
|
||||||
@item 2 (VTref) @tab Vcc @tab 5
|
@item 2 (VTref) @tab Vcc @tab 5
|
||||||
@item 3 (SCK) @tab TPICLK @tab 3
|
@item 3 (SCK) @tab TPICLK @tab 3
|
||||||
@item 4 (MOSI) @tab @tab
|
@item 4 (SDO) @tab @tab
|
||||||
@item 5 (RESET) @tab /RESET @tab 6
|
@item 5 (RESET) @tab /RESET @tab 6
|
||||||
@item 6 (GND) @tab GND @tab 2
|
@item 6 (GND) @tab GND @tab 2
|
||||||
@end multitable
|
@end multitable
|
||||||
|
@ -2987,10 +2987,10 @@ Problem: I want to program an ATtiny4/5/9/10 device using a serial/parallel
|
||||||
bitbang programmer. How to connect the pins?
|
bitbang programmer. How to connect the pins?
|
||||||
|
|
||||||
Solution: Since TPI has only 1 pin for bi-directional data transfer, both
|
Solution: Since TPI has only 1 pin for bi-directional data transfer, both
|
||||||
@var{MISO} and @var{MOSI} pins should be connected to the @var{TPIDATA} pin
|
@var{SDI} and @var{SDO} pins should be connected to the @var{TPIDATA} pin
|
||||||
on the ATtiny device.
|
on the ATtiny device.
|
||||||
However, a 1K resistor should be placed between the @var{MOSI} and @var{TPIDATA}.
|
However, a 1K resistor should be placed between the @var{SDO} and @var{TPIDATA}.
|
||||||
The @var{MISO} pin connects to @var{TPIDATA} directly.
|
The @var{SDI} pin connects to @var{TPIDATA} directly.
|
||||||
The @var{SCK} pin is connected to @var{TPICLK}.
|
The @var{SCK} pin is connected to @var{TPICLK}.
|
||||||
|
|
||||||
In addition, the @var{Vcc}, @var{/RESET} and @var{GND} pins should
|
In addition, the @var{Vcc}, @var{/RESET} and @var{GND} pins should
|
||||||
|
@ -3008,12 +3008,12 @@ front of pins 7, 4, 3 and 8):
|
||||||
@example
|
@example
|
||||||
programmer
|
programmer
|
||||||
id = "dasa_ftdi";
|
id = "dasa_ftdi";
|
||||||
desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts";
|
desc = "serial port banging, reset=rts sck=dtr sdo=txd sdi=cts";
|
||||||
type = serbb;
|
type = serbb;
|
||||||
reset = ~7;
|
reset = ~7;
|
||||||
sck = ~4;
|
sck = ~4;
|
||||||
mosi = ~3;
|
sdo = ~3;
|
||||||
miso = ~8;
|
sdi = ~8;
|
||||||
;
|
;
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
|
50
src/ft245r.c
50
src/ft245r.c
|
@ -25,9 +25,9 @@
|
||||||
/* ft245r -- FT245R/FT232R Synchronous BitBangMode Programmer
|
/* ft245r -- FT245R/FT232R Synchronous BitBangMode Programmer
|
||||||
default pin assign
|
default pin assign
|
||||||
FT232R / FT245R
|
FT232R / FT245R
|
||||||
miso = 1; # RxD / D1
|
sdi = 1; # RxD / D1
|
||||||
sck = 0; # RTS / D0
|
sck = 0; # RTS / D0
|
||||||
mosi = 2; # TxD / D2
|
sdo = 2; # TxD / D2
|
||||||
reset = 4; # DTR / D4
|
reset = 4; # DTR / D4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ static int ft245r_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
set_reset(pgm, OFF);
|
set_reset(pgm, OFF);
|
||||||
|
|
||||||
/* Wait for at least 20 ms and enable serial programming by sending the Programming
|
/* Wait for at least 20 ms and enable serial programming by sending the Programming
|
||||||
* Enable serial instruction to pin MOSI.
|
* Enable serial instruction to pin SDO.
|
||||||
*/
|
*/
|
||||||
ft245r_usleep(pgm, 20000); // 20ms
|
ft245r_usleep(pgm, 20000); // 20ms
|
||||||
|
|
||||||
|
@ -557,35 +557,35 @@ static int ft245r_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
uint8_t byte;
|
uint8_t byte;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Since there is a single TPIDATA line, MOSI and MISO must be
|
/* Since there is a single TPIDATA line, SDO and SDI must be
|
||||||
linked together through a 1kOhm resistor. Verify that
|
linked together through a 1kOhm resistor. Verify that
|
||||||
everything we send on MOSI gets mirrored back on MISO. */
|
everything we send on SDO gets mirrored back on SDI. */
|
||||||
set_pin(pgm, PIN_AVR_MOSI, 0);
|
set_pin(pgm, PIN_AVR_SDO, 0);
|
||||||
if (get_pin(pgm, PIN_AVR_MISO) != 0) {
|
if (get_pin(pgm, PIN_AVR_SDI) != 0) {
|
||||||
io_link_ok = false;
|
io_link_ok = false;
|
||||||
if(ovsigck) {
|
if(ovsigck) {
|
||||||
pmsg_warning("MOSI->MISO 0 failed\n");
|
pmsg_warning("SDO->SDI 0 failed\n");
|
||||||
} else {
|
} else {
|
||||||
pmsg_error("MOSI->MISO 0 failed\n");
|
pmsg_error("SDO->SDI 0 failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set_pin(pgm, PIN_AVR_MOSI, 1);
|
set_pin(pgm, PIN_AVR_SDO, 1);
|
||||||
if (get_pin(pgm, PIN_AVR_MISO) != 1) {
|
if (get_pin(pgm, PIN_AVR_SDI) != 1) {
|
||||||
io_link_ok = false;
|
io_link_ok = false;
|
||||||
if(ovsigck) {
|
if(ovsigck) {
|
||||||
pmsg_warning("MOSI->MISO 1 failed\n");
|
pmsg_warning("SDO->SDI 1 failed\n");
|
||||||
} else {
|
} else {
|
||||||
pmsg_error("MOSI->MISO 1 failed\n");
|
pmsg_error("SDO->SDI 1 failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (io_link_ok)
|
if (io_link_ok)
|
||||||
msg_notice2("MOSI-MISO link present\n");
|
msg_notice2("SDO-SDI link present\n");
|
||||||
|
|
||||||
/* keep TPIDATA high for 16 clock cycles */
|
/* keep TPIDATA high for 16 clock cycles */
|
||||||
set_pin(pgm, PIN_AVR_MOSI, 1);
|
set_pin(pgm, PIN_AVR_SDO, 1);
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
set_sck(pgm, 1);
|
set_sck(pgm, 1);
|
||||||
set_sck(pgm, 0);
|
set_sck(pgm, 0);
|
||||||
|
@ -608,7 +608,7 @@ static int ft245r_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
|
|
||||||
static inline void add_bit(const PROGRAMMER *pgm, unsigned char *buf, int *buf_pos,
|
static inline void add_bit(const PROGRAMMER *pgm, unsigned char *buf, int *buf_pos,
|
||||||
uint8_t bit) {
|
uint8_t bit) {
|
||||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_MOSI, bit);
|
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SDO, bit);
|
||||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0);
|
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0);
|
||||||
buf[*buf_pos] = ft245r_out;
|
buf[*buf_pos] = ft245r_out;
|
||||||
(*buf_pos)++;
|
(*buf_pos)++;
|
||||||
|
@ -632,14 +632,14 @@ static inline int set_data(const PROGRAMMER *pgm, unsigned char *buf, unsigned c
|
||||||
|
|
||||||
static inline unsigned char extract_data(const PROGRAMMER *pgm, unsigned char *buf, int offset) {
|
static inline unsigned char extract_data(const PROGRAMMER *pgm, unsigned char *buf, int offset) {
|
||||||
int j;
|
int j;
|
||||||
int buf_pos = FT245R_CYCLES; /* MISO data is valid AFTER rising SCK edge,
|
int buf_pos = FT245R_CYCLES; /* SDI data is valid AFTER rising SCK edge,
|
||||||
i.e. in next clock cycle */
|
i.e. in next clock cycle */
|
||||||
unsigned char bit = 0x80;
|
unsigned char bit = 0x80;
|
||||||
unsigned char r = 0;
|
unsigned char r = 0;
|
||||||
|
|
||||||
buf += offset * (8 * FT245R_CYCLES);
|
buf += offset * (8 * FT245R_CYCLES);
|
||||||
for (j=0; j<8; j++) {
|
for (j=0; j<8; j++) {
|
||||||
if (GET_BITS_0(buf[buf_pos],pgm,PIN_AVR_MISO)) {
|
if (GET_BITS_0(buf[buf_pos],pgm,PIN_AVR_SDI)) {
|
||||||
r |= bit;
|
r |= bit;
|
||||||
}
|
}
|
||||||
buf_pos += FT245R_CYCLES;
|
buf_pos += FT245R_CYCLES;
|
||||||
|
@ -658,7 +658,7 @@ static inline unsigned char extract_data_out(const PROGRAMMER *pgm, unsigned cha
|
||||||
|
|
||||||
buf += offset * (8 * FT245R_CYCLES);
|
buf += offset * (8 * FT245R_CYCLES);
|
||||||
for (j=0; j<8; j++) {
|
for (j=0; j<8; j++) {
|
||||||
if (GET_BITS_0(buf[buf_pos],pgm,PIN_AVR_MOSI)) {
|
if (GET_BITS_0(buf[buf_pos],pgm,PIN_AVR_SDO)) {
|
||||||
r |= bit;
|
r |= bit;
|
||||||
}
|
}
|
||||||
buf_pos += FT245R_CYCLES;
|
buf_pos += FT245R_CYCLES;
|
||||||
|
@ -702,7 +702,7 @@ static inline uint8_t extract_tpi_data(const PROGRAMMER *pgm, unsigned char *buf
|
||||||
|
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
(*buf_pos)++; // skip over falling clock edge
|
(*buf_pos)++; // skip over falling clock edge
|
||||||
if (GET_BITS_0(buf[(*buf_pos)++], pgm, PIN_AVR_MISO))
|
if (GET_BITS_0(buf[(*buf_pos)++], pgm, PIN_AVR_SDI))
|
||||||
byte |= bit;
|
byte |= bit;
|
||||||
bit <<= 1;
|
bit <<= 1;
|
||||||
}
|
}
|
||||||
|
@ -747,7 +747,7 @@ static int ft245r_tpi_rx(const PROGRAMMER *pgm, uint8_t *bytep) {
|
||||||
uint32_t res, m, byte;
|
uint32_t res, m, byte;
|
||||||
|
|
||||||
/* Allow for up to 4 bits before we must see start bit; during
|
/* Allow for up to 4 bits before we must see start bit; during
|
||||||
that time, we must keep the MOSI line high. */
|
that time, we must keep the SDO line high. */
|
||||||
for (i = 0; i < 2; ++i)
|
for (i = 0; i < 2; ++i)
|
||||||
len += set_data(pgm, &buf[len], 0xff);
|
len += set_data(pgm, &buf[len], 0xff);
|
||||||
|
|
||||||
|
@ -815,8 +815,8 @@ static const struct pindef_t valid_pins = {{0xff},{0xff}} ;
|
||||||
|
|
||||||
static const struct pin_checklist_t pin_checklist[] = {
|
static const struct pin_checklist_t pin_checklist[] = {
|
||||||
{ PIN_AVR_SCK, 1, &valid_pins},
|
{ PIN_AVR_SCK, 1, &valid_pins},
|
||||||
{ PIN_AVR_MOSI, 1, &valid_pins},
|
{ PIN_AVR_SDO, 1, &valid_pins},
|
||||||
{ PIN_AVR_MISO, 1, &valid_pins},
|
{ PIN_AVR_SDI, 1, &valid_pins},
|
||||||
{ PIN_AVR_RESET,1, &valid_pins},
|
{ PIN_AVR_RESET,1, &valid_pins},
|
||||||
{ PPI_AVR_BUFF, 0, &valid_pins},
|
{ PPI_AVR_BUFF, 0, &valid_pins},
|
||||||
};
|
};
|
||||||
|
@ -889,7 +889,7 @@ static int ft245r_open(PROGRAMMER *pgm, const char *port) {
|
||||||
|
|
||||||
ft245r_ddr =
|
ft245r_ddr =
|
||||||
pgm->pin[PIN_AVR_SCK].mask[0]
|
pgm->pin[PIN_AVR_SCK].mask[0]
|
||||||
| pgm->pin[PIN_AVR_MOSI].mask[0]
|
| pgm->pin[PIN_AVR_SDO].mask[0]
|
||||||
| pgm->pin[PIN_AVR_RESET].mask[0]
|
| pgm->pin[PIN_AVR_RESET].mask[0]
|
||||||
| pgm->pin[PPI_AVR_BUFF].mask[0]
|
| pgm->pin[PPI_AVR_BUFF].mask[0]
|
||||||
| pgm->pin[PPI_AVR_VCC].mask[0]
|
| pgm->pin[PPI_AVR_VCC].mask[0]
|
||||||
|
@ -902,7 +902,7 @@ static int ft245r_open(PROGRAMMER *pgm, const char *port) {
|
||||||
ft245r_out = 0;
|
ft245r_out = 0;
|
||||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_RESET,1);
|
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_RESET,1);
|
||||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0);
|
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0);
|
||||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_MOSI,0);
|
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SDO,0);
|
||||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PPI_AVR_BUFF,0);
|
ft245r_out = SET_BITS_0(ft245r_out,pgm,PPI_AVR_BUFF,0);
|
||||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PPI_AVR_VCC,0);
|
ft245r_out = SET_BITS_0(ft245r_out,pgm,PPI_AVR_VCC,0);
|
||||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_LED_ERR,0);
|
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_LED_ERR,0);
|
||||||
|
|
|
@ -196,9 +196,9 @@ max_write_delay { yylval=NULL; ccap(); return K_MAX_WRITE_DELAY; }
|
||||||
mcu_base { yylval=NULL; ccap(); return K_MCU_BASE; }
|
mcu_base { yylval=NULL; ccap(); return K_MCU_BASE; }
|
||||||
memory { yylval=NULL; ccap(); return K_MEMORY; }
|
memory { yylval=NULL; ccap(); return K_MEMORY; }
|
||||||
min_write_delay { yylval=NULL; ccap(); return K_MIN_WRITE_DELAY; }
|
min_write_delay { yylval=NULL; ccap(); return K_MIN_WRITE_DELAY; }
|
||||||
miso { yylval=NULL; ccap(); return K_MISO; }
|
miso { yylval=NULL; ccap(); return K_SDI; } // Deprecated
|
||||||
mode { yylval=NULL; ccap(); return K_MODE; }
|
mode { yylval=NULL; ccap(); return K_MODE; }
|
||||||
mosi { yylval=NULL; ccap(); return K_MOSI; }
|
mosi { yylval=NULL; ccap(); return K_SDO; } // Deprecated
|
||||||
no { yylval=new_token(K_NO); return K_NO; }
|
no { yylval=new_token(K_NO); return K_NO; }
|
||||||
NULL { yylval=NULL; return K_NULL; }
|
NULL { yylval=NULL; return K_NULL; }
|
||||||
num_banks { yylval=NULL; return K_NUM_PAGES; }
|
num_banks { yylval=NULL; return K_NUM_PAGES; }
|
||||||
|
@ -245,6 +245,8 @@ resetdelayms { yylval=NULL; ccap(); return K_RESETDELAYMS; }
|
||||||
resetdelayus { yylval=NULL; ccap(); return K_RESETDELAYUS; }
|
resetdelayus { yylval=NULL; ccap(); return K_RESETDELAYUS; }
|
||||||
retry_pulse { yylval=NULL; ccap(); return K_RETRY_PULSE; }
|
retry_pulse { yylval=NULL; ccap(); return K_RETRY_PULSE; }
|
||||||
sck { yylval=new_token(K_SCK); ccap(); return K_SCK; }
|
sck { yylval=new_token(K_SCK); ccap(); return K_SCK; }
|
||||||
|
sdi { yylval=NULL; ccap(); return K_SDI; }
|
||||||
|
sdo { yylval=NULL; ccap(); return K_SDO; }
|
||||||
serial { yylval=NULL; ccap(); return K_SERIAL; }
|
serial { yylval=NULL; ccap(); return K_SERIAL; }
|
||||||
signature { yylval=NULL; ccap(); return K_SIGNATURE; }
|
signature { yylval=NULL; ccap(); return K_SIGNATURE; }
|
||||||
size { yylval=NULL; ccap(); return K_SIZE; }
|
size { yylval=NULL; ccap(); return K_SIZE; }
|
||||||
|
|
|
@ -401,8 +401,8 @@ enum {
|
||||||
PPI_AVR_BUFF,
|
PPI_AVR_BUFF,
|
||||||
PIN_AVR_RESET,
|
PIN_AVR_RESET,
|
||||||
PIN_AVR_SCK,
|
PIN_AVR_SCK,
|
||||||
PIN_AVR_MOSI,
|
PIN_AVR_SDO,
|
||||||
PIN_AVR_MISO,
|
PIN_AVR_SDI,
|
||||||
PIN_LED_ERR,
|
PIN_LED_ERR,
|
||||||
PIN_LED_RDY,
|
PIN_LED_RDY,
|
||||||
PIN_LED_PGM,
|
PIN_LED_PGM,
|
||||||
|
@ -830,10 +830,10 @@ void pgm_free(PROGRAMMER *p);
|
||||||
|
|
||||||
void programmer_display(PROGRAMMER * pgm, const char * p);
|
void programmer_display(PROGRAMMER * pgm, const char * p);
|
||||||
|
|
||||||
/* show is a mask like this (1<<PIN_AVR_SCK)|(1<<PIN_AVR_MOSI)| ... */
|
/* show is a mask like this (1<<PIN_AVR_SCK)|(1<<PIN_AVR_SDO)| ... */
|
||||||
#define SHOW_ALL_PINS (~0u)
|
#define SHOW_ALL_PINS (~0u)
|
||||||
#define SHOW_PPI_PINS ((1<<PPI_AVR_VCC)|(1<<PPI_AVR_BUFF))
|
#define SHOW_PPI_PINS ((1<<PPI_AVR_VCC)|(1<<PPI_AVR_BUFF))
|
||||||
#define SHOW_AVR_PINS ((1<<PIN_AVR_RESET)|(1<<PIN_AVR_SCK)|(1<<PIN_AVR_MOSI)|(1<<PIN_AVR_MISO))
|
#define SHOW_AVR_PINS ((1<<PIN_AVR_RESET)|(1<<PIN_AVR_SCK)|(1<<PIN_AVR_SDO)|(1<<PIN_AVR_SDI))
|
||||||
#define SHOW_LED_PINS ((1<<PIN_LED_ERR)|(1<<PIN_LED_RDY)|(1<<PIN_LED_PGM)|(1<<PIN_LED_VFY))
|
#define SHOW_LED_PINS ((1<<PIN_LED_ERR)|(1<<PIN_LED_RDY)|(1<<PIN_LED_PGM)|(1<<PIN_LED_VFY))
|
||||||
void pgm_display_generic_mask(const PROGRAMMER *pgm, const char *p, unsigned int show);
|
void pgm_display_generic_mask(const PROGRAMMER *pgm, const char *p, unsigned int show);
|
||||||
void pgm_display_generic(const PROGRAMMER *pgm, const char *p);
|
void pgm_display_generic(const PROGRAMMER *pgm, const char *p);
|
||||||
|
|
|
@ -252,7 +252,7 @@ static int linuxgpio_open(PROGRAMMER *pgm, const char *port) {
|
||||||
linuxgpio_fds[i] = -1;
|
linuxgpio_fds[i] = -1;
|
||||||
//Avrdude assumes that if a pin number is 0 it means not used/available
|
//Avrdude assumes that if a pin number is 0 it means not used/available
|
||||||
//this causes a problem because 0 is a valid GPIO number in Linux sysfs.
|
//this causes a problem because 0 is a valid GPIO number in Linux sysfs.
|
||||||
//To avoid annoying off by one pin numbering we assume SCK, MOSI, MISO
|
//To avoid annoying off by one pin numbering we assume SCK, SDO, SDI
|
||||||
//and RESET pins are always defined in avrdude.conf, even as 0. If they're
|
//and RESET pins are always defined in avrdude.conf, even as 0. If they're
|
||||||
//not programming will not work anyway. The drawbacks of this approach are
|
//not programming will not work anyway. The drawbacks of this approach are
|
||||||
//that unwanted toggling of GPIO0 can occur and that other optional pins
|
//that unwanted toggling of GPIO0 can occur and that other optional pins
|
||||||
|
@ -262,8 +262,8 @@ static int linuxgpio_open(PROGRAMMER *pgm, const char *port) {
|
||||||
if ( (pgm->pinno[i] & PIN_MASK) != 0 ||
|
if ( (pgm->pinno[i] & PIN_MASK) != 0 ||
|
||||||
i == PIN_AVR_RESET ||
|
i == PIN_AVR_RESET ||
|
||||||
i == PIN_AVR_SCK ||
|
i == PIN_AVR_SCK ||
|
||||||
i == PIN_AVR_MOSI ||
|
i == PIN_AVR_SDO ||
|
||||||
i == PIN_AVR_MISO ) {
|
i == PIN_AVR_SDI ) {
|
||||||
pin = pgm->pinno[i] & PIN_MASK;
|
pin = pgm->pinno[i] & PIN_MASK;
|
||||||
if ((r=linuxgpio_export(pin)) < 0) {
|
if ((r=linuxgpio_export(pin)) < 0) {
|
||||||
pmsg_ext_error("cannot export GPIO %d, already exported/busy?: %s",
|
pmsg_ext_error("cannot export GPIO %d, already exported/busy?: %s",
|
||||||
|
@ -290,7 +290,7 @@ static int linuxgpio_open(PROGRAMMER *pgm, const char *port) {
|
||||||
* udev permission rule application after export */
|
* udev permission rule application after export */
|
||||||
for (retry_count = 0; retry_count < GPIO_SYSFS_OPEN_RETRIES; retry_count++) {
|
for (retry_count = 0; retry_count < GPIO_SYSFS_OPEN_RETRIES; retry_count++) {
|
||||||
usleep(GPIO_SYSFS_OPEN_DELAY);
|
usleep(GPIO_SYSFS_OPEN_DELAY);
|
||||||
if (i == PIN_AVR_MISO)
|
if (i == PIN_AVR_SDI)
|
||||||
r=linuxgpio_dir_in(pin);
|
r=linuxgpio_dir_in(pin);
|
||||||
else
|
else
|
||||||
r=linuxgpio_dir_out(pin);
|
r=linuxgpio_dir_out(pin);
|
||||||
|
@ -307,7 +307,7 @@ static int linuxgpio_open(PROGRAMMER *pgm, const char *port) {
|
||||||
if (retry_count)
|
if (retry_count)
|
||||||
pmsg_notice2("needed %d retr%s for linuxgpio_dir_%s(%s)\n",
|
pmsg_notice2("needed %d retr%s for linuxgpio_dir_%s(%s)\n",
|
||||||
retry_count, retry_count > 1? "ies": "y",
|
retry_count, retry_count > 1? "ies": "y",
|
||||||
i == PIN_AVR_MISO? "in": "out", avr_pin_name(pin));
|
i == PIN_AVR_SDI? "in": "out", avr_pin_name(pin));
|
||||||
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
linuxgpio_unexport(pin);
|
linuxgpio_unexport(pin);
|
||||||
|
|
|
@ -335,7 +335,7 @@ static int linuxspi_program_enable(const PROGRAMMER *pgm, const AVRPART *p) {
|
||||||
* plus two CPU clock cycles. See Table 25-5 on page 240 for definition of
|
* plus two CPU clock cycles. See Table 25-5 on page 240 for definition of
|
||||||
* minimum pulse width on RESET pin, t RST
|
* minimum pulse width on RESET pin, t RST
|
||||||
* 2. Wait for at least 20 ms and then enable serial programming by sending
|
* 2. Wait for at least 20 ms and then enable serial programming by sending
|
||||||
* the Programming Enable serial instruction to the MOSI pin
|
* the Programming Enable serial instruction to the SDO pin
|
||||||
* 3. The serial programming instructions will not work if the communication
|
* 3. The serial programming instructions will not work if the communication
|
||||||
* is out of synchronization. When in sync, the second byte (0x53) will echo
|
* is out of synchronization. When in sync, the second byte (0x53) will echo
|
||||||
* back when issuing the third byte of the Programming Enable instruction
|
* back when issuing the third byte of the Programming Enable instruction
|
||||||
|
|
|
@ -270,10 +270,10 @@ void pgm_display_generic_mask(const PROGRAMMER *pgm, const char *p, unsigned int
|
||||||
msg_info("%s RESET = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_RESET]));
|
msg_info("%s RESET = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_RESET]));
|
||||||
if(show & (1<<PIN_AVR_SCK))
|
if(show & (1<<PIN_AVR_SCK))
|
||||||
msg_info("%s SCK = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_SCK]));
|
msg_info("%s SCK = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_SCK]));
|
||||||
if(show & (1<<PIN_AVR_MOSI))
|
if(show & (1<<PIN_AVR_SDO))
|
||||||
msg_info("%s MOSI = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MOSI]));
|
msg_info("%s SDO = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_SDO]));
|
||||||
if(show & (1<<PIN_AVR_MISO))
|
if(show & (1<<PIN_AVR_SDI))
|
||||||
msg_info("%s MISO = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MISO]));
|
msg_info("%s SDI = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_SDI]));
|
||||||
if(show & (1<<PIN_LED_ERR))
|
if(show & (1<<PIN_LED_ERR))
|
||||||
msg_info("%s ERR LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_ERR]));
|
msg_info("%s ERR LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_ERR]));
|
||||||
if(show & (1<<PIN_LED_RDY))
|
if(show & (1<<PIN_LED_RDY))
|
||||||
|
|
|
@ -38,9 +38,9 @@
|
||||||
* RST - VPP/MCLR (1)
|
* RST - VPP/MCLR (1)
|
||||||
* VDD - VDD Target (2) -- possibly optional if AVR self powered
|
* VDD - VDD Target (2) -- possibly optional if AVR self powered
|
||||||
* GND - GND (3)
|
* GND - GND (3)
|
||||||
* MISO - PGD (4)
|
* SDI - PGD (4)
|
||||||
* SCLK - PDC (5)
|
* SCLK - PDC (5)
|
||||||
* MOSI - AUX (6)
|
* SDO - AUX (6)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ac_cfg.h"
|
#include "ac_cfg.h"
|
||||||
|
|
|
@ -128,9 +128,9 @@ int pgm_fill_old_pins(PROGRAMMER * const pgm) {
|
||||||
return -1;
|
return -1;
|
||||||
if (pin_fill_old_pinno(&(pgm->pin[PIN_AVR_SCK]), &(pgm->pinno[PIN_AVR_SCK])) < 0)
|
if (pin_fill_old_pinno(&(pgm->pin[PIN_AVR_SCK]), &(pgm->pinno[PIN_AVR_SCK])) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (pin_fill_old_pinno(&(pgm->pin[PIN_AVR_MOSI]), &(pgm->pinno[PIN_AVR_MOSI])) < 0)
|
if (pin_fill_old_pinno(&(pgm->pin[PIN_AVR_SDO]), &(pgm->pinno[PIN_AVR_SDO])) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (pin_fill_old_pinno(&(pgm->pin[PIN_AVR_MISO]), &(pgm->pinno[PIN_AVR_MISO])) < 0)
|
if (pin_fill_old_pinno(&(pgm->pin[PIN_AVR_SDI]), &(pgm->pinno[PIN_AVR_SDI])) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (pin_fill_old_pinno(&(pgm->pin[PIN_LED_ERR]), &(pgm->pinno[PIN_LED_ERR])) < 0)
|
if (pin_fill_old_pinno(&(pgm->pin[PIN_LED_ERR]), &(pgm->pinno[PIN_LED_ERR])) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -378,8 +378,8 @@ const char * avr_pin_name(int pinname) {
|
||||||
case PPI_AVR_BUFF : return "BUFF";
|
case PPI_AVR_BUFF : return "BUFF";
|
||||||
case PIN_AVR_RESET : return "RESET";
|
case PIN_AVR_RESET : return "RESET";
|
||||||
case PIN_AVR_SCK : return "SCK";
|
case PIN_AVR_SCK : return "SCK";
|
||||||
case PIN_AVR_MOSI : return "MOSI";
|
case PIN_AVR_SDO : return "SDO";
|
||||||
case PIN_AVR_MISO : return "MISO";
|
case PIN_AVR_SDI : return "SDI";
|
||||||
case PIN_LED_ERR : return "ERRLED";
|
case PIN_LED_ERR : return "ERRLED";
|
||||||
case PIN_LED_RDY : return "RDYLED";
|
case PIN_LED_RDY : return "RDYLED";
|
||||||
case PIN_LED_PGM : return "PGMLED";
|
case PIN_LED_PGM : return "PGMLED";
|
||||||
|
@ -401,8 +401,8 @@ const char * avr_pin_lcname(int pinname) {
|
||||||
case PPI_AVR_BUFF : return "buff";
|
case PPI_AVR_BUFF : return "buff";
|
||||||
case PIN_AVR_RESET : return "reset";
|
case PIN_AVR_RESET : return "reset";
|
||||||
case PIN_AVR_SCK : return "sck";
|
case PIN_AVR_SCK : return "sck";
|
||||||
case PIN_AVR_MOSI : return "mosi";
|
case PIN_AVR_SDO : return "sdo";
|
||||||
case PIN_AVR_MISO : return "miso";
|
case PIN_AVR_SDI : return "sdi";
|
||||||
case PIN_LED_ERR : return "errled";
|
case PIN_LED_ERR : return "errled";
|
||||||
case PIN_LED_RDY : return "rdyled";
|
case PIN_LED_RDY : return "rdyled";
|
||||||
case PIN_LED_PGM : return "pgmled";
|
case PIN_LED_PGM : return "pgmled";
|
||||||
|
|
|
@ -1005,7 +1005,7 @@ static struct
|
||||||
const char *description;
|
const char *description;
|
||||||
} connection_status[] =
|
} connection_status[] =
|
||||||
{
|
{
|
||||||
{ STATUS_CONN_FAIL_MOSI, "MOSI fail" },
|
{ STATUS_CONN_FAIL_SDO, "SDO fail" },
|
||||||
{ STATUS_CONN_FAIL_RST, "RST fail" },
|
{ STATUS_CONN_FAIL_RST, "RST fail" },
|
||||||
{ STATUS_CONN_FAIL_SCK, "SCK fail" },
|
{ STATUS_CONN_FAIL_SCK, "SCK fail" },
|
||||||
{ STATUS_TGT_NOT_DETECTED, "Target not detected" },
|
{ STATUS_TGT_NOT_DETECTED, "Target not detected" },
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
#define STATUS_ISP_READY 0x00
|
#define STATUS_ISP_READY 0x00
|
||||||
#define STATUS_CONN_FAIL_MOSI 0x01
|
#define STATUS_CONN_FAIL_SDO 0x01
|
||||||
#define STATUS_CONN_FAIL_RST 0x02
|
#define STATUS_CONN_FAIL_RST 0x02
|
||||||
#define STATUS_CONN_FAIL_SCK 0x04
|
#define STATUS_CONN_FAIL_SCK 0x04
|
||||||
#define STATUS_TGT_NOT_DETECTED 0x10
|
#define STATUS_TGT_NOT_DETECTED 0x10
|
||||||
|
|
|
@ -445,10 +445,10 @@ static int usbtiny_initialize (const PROGRAMMER *pgm, const AVRPART *p ) {
|
||||||
usleep(50000);
|
usleep(50000);
|
||||||
|
|
||||||
if (p->prog_modes & PM_TPI) {
|
if (p->prog_modes & PM_TPI) {
|
||||||
/* Since there is a single TPIDATA line, MOSI and MISO must be
|
/* Since there is a single TPIDATA line, SDO and SDI must be
|
||||||
linked together through a 1kOhm resistor. Verify that
|
linked together through a 1kOhm resistor. Verify that
|
||||||
everything we send on MOSI gets mirrored back on MISO. */
|
everything we send on SDO gets mirrored back on SDI. */
|
||||||
msg_notice2("doing MOSI-MISO link check\n");
|
msg_notice2("doing SDO-SDI link check\n");
|
||||||
|
|
||||||
memset(res, 0xaa, sizeof(res));
|
memset(res, 0xaa, sizeof(res));
|
||||||
if (usb_in(pgm, USBTINY_SPI, LITTLE_TO_BIG_16(0x1234), LITTLE_TO_BIG_16(0x5678),
|
if (usb_in(pgm, USBTINY_SPI, LITTLE_TO_BIG_16(0x1234), LITTLE_TO_BIG_16(0x5678),
|
||||||
|
@ -457,9 +457,9 @@ static int usbtiny_initialize (const PROGRAMMER *pgm, const AVRPART *p ) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (res[0] != 0x12 || res[1] != 0x34 || res[2] != 0x56 || res[3] != 0x78) {
|
if (res[0] != 0x12 || res[1] != 0x34 || res[2] != 0x56 || res[3] != 0x78) {
|
||||||
pmsg_error("MOSI->MISO check failed (got 0x%02x 0x%02x 0x%02x 0x%02x)\n"
|
pmsg_error("SDO->SDI check failed (got 0x%02x 0x%02x 0x%02x 0x%02x)\n"
|
||||||
"\tplease verify that MISO is connected directly to TPIDATA and\n"
|
"\tplease verify that SDI is connected directly to TPIDATA and\n"
|
||||||
"\tMOSI is connected to TPIDATA through a 1kOhm resistor\n",
|
"\tSDO is connected to TPIDATA through a 1kOhm resistor\n",
|
||||||
res[0], res[1], res[2], res[3]);
|
res[0], res[1], res[2], res[3]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue