diff --git a/src/avrdude.1 b/src/avrdude.1 index c0ab2bba..3a8953e3 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -75,9 +75,9 @@ so, for the based programmer, the MCU signals .Ql /RESET , .Ql SCK , -.Ql MISO +.Ql SDI and -.Ql MOSI +.Ql SDO need to be connected to the parallel port. Optionally, some otherwise 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 @@ -98,7 +98,7 @@ work at all, or to work abysmally slow. .Pp 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 -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 the lines using the Linux sysfs GPIO interface. Of course, care should be taken about voltage level compatibility. Also, although not strictly @@ -217,7 +217,7 @@ has been compiled in .Nm avrdude , 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) -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 The Atmel DFU bootloader is supported in both, FLIP protocol version 1 (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) 7 /RESET (to MCU) 8 SCK (to MCU) -9 MOSI (to MCU) -10 MISO (from MCU) +9 SDO (to MCU) +10 SDI (from MCU) 18-25 GND .TE .Ss debugWire limitations @@ -1258,7 +1258,7 @@ Show this help menu and exit .It Ar reset={cs,aux,aux2} 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 -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 .Pa CS pin, second AVR's RESET connected to BusPirate's @@ -1371,9 +1371,9 @@ Connection to the PICkit2 programmer: RST - VPP/MCLR (1) VDD - VDD Target (2) -- possibly optional if AVR self powered GND - GND (3) -MISO - PGD (4) +SDI - PGD (4) SCLK - PDC (5) -MOSI - AUX (6) +SDO - AUX (6) .Ed Extended commandline parameters: diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 5d277349..99cafd51 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -29,8 +29,8 @@ # buff = [, ... ] ; # pin number(s) # reset = ; # pin number # sck = ; # pin number -# mosi = ; # pin number -# miso = ; # pin number +# sdo = ; # pin number +# sdi = ; # pin number # errled = ; # pin number # rdyled = ; # pin number # pgmled = ; # pin number @@ -411,8 +411,8 @@ programmer vcc = 2, 3, 4, 5; reset = 7; sck = 8; - mosi = 9; - miso = 10; + sdo = 9; + sdi = 10; ; #------------------------------------------------------------ @@ -427,8 +427,8 @@ programmer buff = 4, 5; reset = 9; sck = 6; - mosi = 7; - miso = 10; + sdo = 7; + sdi = 10; ; #------------------------------------------------------------ @@ -457,8 +457,8 @@ programmer prog_modes = PM_TPI | PM_ISP; reset = 4; sck = 5; - mosi = 2; - miso = 11; + sdo = 2; + sdi = 11; ; #------------------------------------------------------------ @@ -483,8 +483,8 @@ programmer buff = 6; reset = 7; sck = 8; - mosi = 9; - miso = 10; + sdo = 9; + sdi = 10; errled = 1; rdyled = 14; pgmled = 16; @@ -503,8 +503,8 @@ programmer vcc = 4, 5, 6, 7, 8; reset = 3; sck = 2; - mosi = 9; - miso = 11; + sdo = 9; + sdi = 11; ; #------------------------------------------------------------ @@ -518,8 +518,8 @@ programmer prog_modes = PM_TPI | PM_ISP; reset = 2; sck = 3; - mosi = 4; - miso = 13; + sdo = 4; + sdi = 13; ; #------------------------------------------------------------ @@ -533,8 +533,8 @@ programmer prog_modes = PM_TPI | PM_ISP; reset = 4; sck = 3; - mosi = 2; - miso = 10; + sdo = 2; + sdi = 10; ; #------------------------------------------------------------ @@ -548,8 +548,8 @@ programmer prog_modes = PM_TPI | PM_ISP; reset = 3; sck = 2; - mosi = 1; - miso = 10; + sdo = 1; + sdi = 10; ; #------------------------------------------------------------ @@ -561,7 +561,7 @@ programmer # 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 # 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) programmer @@ -573,8 +573,8 @@ programmer buff = 5; reset = 4; sck = 3; - mosi = 2; - miso = 13; + sdo = 2; + sdi = 13; ; #------------------------------------------------------------ @@ -589,8 +589,8 @@ programmer vcc = 3; reset = 16; sck = 1; - mosi = 2; - miso = 11; + sdo = 2; + sdi = 11; ; #------------------------------------------------------------ @@ -604,8 +604,8 @@ programmer prog_modes = PM_TPI | PM_ISP; reset = ~6; sck = ~8; - mosi = ~7; - miso = ~10; + sdo = ~7; + sdi = ~10; ; #------------------------------------------------------------ @@ -619,8 +619,8 @@ programmer prog_modes = PM_TPI | PM_ISP; reset = ~4; sck = 3; - mosi = 2; - miso = 10; + sdo = 2; + sdi = 10; ; #------------------------------------------------------------ @@ -635,8 +635,8 @@ programmer buff = 14; reset = 3; sck = 2; - mosi = 8; - miso = 11; + sdo = 8; + sdi = 11; ; #------------------------------------------------------------ @@ -667,8 +667,8 @@ programmer prog_modes = PM_TPI | PM_ISP; reset = 17; sck = 1; - mosi = 2; - miso = 10; + sdo = 2; + sdi = 10; ; @HAVE_PARPORT_END@ @@ -699,8 +699,8 @@ programmer # prog_modes = PM_ISP; # reset = ?; # sck = ?; -# mosi = ?; -# miso = ?; +# sdo = ?; +# sdi = ?; # ; @HAVE_LINUXGPIO_END@ @@ -801,7 +801,7 @@ programmer # And fill that in here. # # 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 # these FTDI ICs has been designed. @@ -817,8 +817,8 @@ programmer # ISP-signals - lower ADBUS-Nibble (default) reset = 3; sck = 0; - mosi = 1; - miso = 2; + sdo = 1; + sdi = 2; # LED SIGNALs - higher ADBUS-Nibble # errled = 4; # rdyled = 5; @@ -851,8 +851,8 @@ programmer #ISP-signals reset = 3; sck = 0; - mosi = 1; - miso = 2; + sdo = 1; + sdi = 2; #LED SIGNALs errled = ~11; rdyled = ~14; @@ -891,8 +891,8 @@ programmer # ISP-signals => 20 - Pin connector on JTAGKey reset = 3; # TMS 7 violet sck = 0; # TCK 9 white - mosi = 1; # TDI 5 green - miso = 2; # TDO 13 orange + sdo = 1; # TDI 5 green + sdi = 2; # TDO 13 orange # VTG VREF 1 brown with red tip # GND GND 20 black # The colors are on the 20 pin breakout cable from Amontec @@ -914,8 +914,8 @@ programmer #ISP-signals reset = 3; # AD3 (TMS) sck = 0; # AD0 (TCK) - mosi = 1; # AD1 (TDI) - miso = 2; # AD2 (TDO) + sdo = 1; # AD1 (TDI) + sdi = 2; # AD2 (TDO) ; #------------------------------------------------------------ @@ -923,8 +923,8 @@ programmer #------------------------------------------------------------ # Pin J2-7 (AD0) is SCK -# Pin J2-8 (AD1) is MOSI -# Pin J2-9 (AD2) is MISO +# Pin J2-8 (AD1) is SDO +# Pin J2-9 (AD2) is SDI # Pin J2-10 (AD3) is RESET # Pin J2-6 is GND # 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 -# Yellow (Pin 3) is MOSI -# Green (Pin 4) is MISO +# Yellow (Pin 3) is SDO +# Green (Pin 4) is SDI # Brown (Pin 5) is RESET # Black (Pin 10) is GND # 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"; reset = 3; # TMS 7 sck = 0; # TCK 9 - mosi = 1; # TDI 5 - miso = 2; # TDO 13 + sdo = 1; # TDI 5 + sdi = 2; # TDO 13 ; #------------------------------------------------------------ @@ -1024,8 +1024,8 @@ programmer #ISP-signals - lower ACBUS-Nibble (default) reset = 3; sck = 0; - mosi = 1; - miso = 2; + sdo = 1; + sdi = 2; ; #------------------------------------------------------------ @@ -1046,8 +1046,8 @@ programmer usbvendor = "TIAO"; reset = 3; # TMS 7 sck = 0; # TCK 9 - mosi = 1; # TDI 5 - miso = 2; # TDO 13 + sdo = 1; # TDI 5 + sdi = 2; # TDO 13 ; #------------------------------------------------------------ @@ -1063,7 +1063,7 @@ programmer # KT-LINK JTAG CONN: # 1=Vsense(->EXT13), 19=5V(EXT1->EXT3), 20=GND, 3=TPIRST, 9=TPICLK, 7=TPIDATA. # 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). # CONNECTION NOTES: # * 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; reset = 8; sck = 0; - mosi = 1; - miso = 2; + sdo = 1; + sdi = 2; rdyled = ~15; ; @@ -1106,8 +1106,8 @@ programmer buff = 5, 6, 7; reset = 3; sck = 0; - mosi = 1; - miso = 2; + sdo = 1; + sdi = 2; ; #------------------------------------------------------------ @@ -1190,11 +1190,11 @@ programmer prog_modes = PM_TPI | PM_ISP; connection_type = serial; # 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; sck = 3; - mosi = 4; - miso = 2; + sdo = 4; + sdi = 2; # vcc = 7; # Internally set independent of this setting ; @@ -1335,8 +1335,8 @@ programmer connection_type = usb; reset = 4; # D4 sck = 0; # D0 - mosi = 2; # D2 - miso = 1; # D1 + sdo = 2; # D2 + sdi = 1; # D1 ; #------------------------------------------------------------ @@ -1351,8 +1351,8 @@ programmer connection_type = usb; reset = 4; # DTR sck = 0; # TxD - mosi = 2; # RTS - miso = 1; # RxD + sdo = 2; # RTS + sdi = 1; # RxD ; #------------------------------------------------------------ @@ -1369,8 +1369,8 @@ programmer connection_type = usb; reset = 7; # RI sck = 6; # DCD - mosi = 3; # CTS - miso = 5; # DSR + sdo = 3; # CTS + sdi = 5; # DSR ; #------------------------------------------------------------ @@ -1388,8 +1388,8 @@ programmer connection_type = usb; reset = 7; # RI X3(4) sck = 5; # DSR X3(2) - mosi = 6; # DCD X3(3) - miso = 3; # CTS X3(1) + sdo = 6; # DCD X3(3) + sdi = 3; # CTS X3(1) ; #------------------------------------------------------------ @@ -1405,8 +1405,8 @@ programmer # FOR TPI devices: reset = 3; # CTS = D3 (wire to ~RESET) sck = 2; # RTS = D2 (wire to SCK) - mosi = 0; # TxD = D0 (wire to TPIDATA via 1k resistor) - miso = 1; # RxD = D1 (wire to TPIDATA directly) + sdo = 0; # TxD = D0 (wire to TPIDATA via 1k resistor) + sdi = 1; # RxD = D1 (wire to TPIDATA directly) ; #------------------------------------------------------------ @@ -1439,8 +1439,8 @@ programmer connection_type = usb; reset = 7; # ri sck = 5; # dsr - mosi = 6; # dcd - miso = 3; # cts + sdo = 6; # dcd + sdi = 3; # cts ; #------------------------------------------------------------ @@ -1453,11 +1453,11 @@ programmer # 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 ...) # 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 TXD 4 Orange -> ICPS RESET (pin 5) # 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 # the following table is adjusted. @@ -1469,8 +1469,8 @@ programmer connection_type = usb; reset = 0; # txd sck = 1; # rxd - mosi = 3; # cts - miso = 2; # rts + sdo = 3; # cts + sdi = 2; # rts ; #------------------------------------------------------------ @@ -1537,8 +1537,8 @@ programmer #------------------------------------------------------------ # USBtiny can also be used for TPI programming. -# In that case, a resistor of 1 kOhm is needed between MISO and MOSI -# pins of the connector, and MISO (pin 1 of the 6-pin connector) +# In that case, a resistor of 1 kOhm is needed between SDI and SDO +# pins of the connector, and SDI (pin 1 of the 6-pin connector) # connects to TPIDATA. programmer @@ -2421,18 +2421,18 @@ programmer # Using RI is not supported under Win32 but is supported under Posix. # serial ponyprog design (dasa2 in uisp) -# reset=!txd sck=rts mosi=dtr miso=cts +# reset=!txd sck=rts sdo=dtr sdi=cts programmer 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"; prog_modes = PM_TPI | PM_ISP; connection_type = serial; reset = ~3; sck = 7; - mosi = 4; - miso = 8; + sdo = 4; + sdi = 8; ; #------------------------------------------------------------ @@ -2440,7 +2440,7 @@ programmer #------------------------------------------------------------ # Same as above, different name -# reset=!txd sck=rts mosi=dtr miso=cts +# reset=!txd sck=rts sdo=dtr sdi=cts programmer parent "ponyser" id = "siprog"; @@ -2452,18 +2452,18 @@ programmer parent "ponyser" #------------------------------------------------------------ # unknown (dasa in uisp) -# reset=rts sck=dtr mosi=txd miso=cts +# reset=rts sck=dtr sdo=txd sdi=cts programmer 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"; prog_modes = PM_TPI | PM_ISP; connection_type = serial; reset = 7; sck = 4; - mosi = 3; - miso = 8; + sdo = 3; + sdi = 8; ; #------------------------------------------------------------ @@ -2471,18 +2471,18 @@ programmer #------------------------------------------------------------ # unknown (dasa3 in uisp) -# reset=!dtr sck=rts mosi=txd miso=cts +# reset=!dtr sck=rts sdo=txd sdi=cts programmer 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"; prog_modes = PM_TPI | PM_ISP; connection_type = serial; reset = ~4; sck = 7; - mosi = 3; - miso = 8; + sdo = 3; + sdi = 8; ; #------------------------------------------------------------ @@ -2490,18 +2490,18 @@ programmer #------------------------------------------------------------ # C2N232i (jumper configuration "auto") -# reset=dtr sck=!rts mosi=!txd miso=!cts +# reset=dtr sck=!rts sdo=!txd sdi=!cts programmer 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"; prog_modes = PM_TPI | PM_ISP; connection_type = serial; reset = 4; sck = ~7; - mosi = ~3; - miso = ~8; + sdo = ~3; + sdi = ~8; ; #------------------------------------------------------------ diff --git a/src/avrftdi.c b/src/avrftdi.c index 00d04f09..1427743d 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -62,7 +62,7 @@ void avrftdi_initpgm(PROGRAMMER *pgm) { #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 *); @@ -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' * state (high active, low active) and a zero value sets the pin in the * 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); 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); buf[buf_pos++] = SET_BITS_LOW; 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 for (j=0; j<8; j++) { 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; } 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); - /* SCK/MOSI/MISO are fixed and not invertible?*/ - /* TODO: inverted SCK/MISO/MOSI */ - 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_MISO = {{0x04},{0x00}} ; + /* SCK/SDO/SDI are fixed and not invertible? */ + /* TODO: inverted SCK/SDI/SDO */ + static const struct pindef_t valid_pins_SCK = {{0x01},{0x00}}; + static const struct pindef_t valid_pins_SDO = {{0x02},{0x00}}; + static const struct pindef_t valid_pins_SDI = {{0x04},{0x00}}; /* value for 8/12/16 bit wide interface for other pins */ int valid_mask = ((1 << pdata->pin_limit) - 1); - /* mask out SCK/MISO/MOSI */ - valid_mask &= ~((1 << FTDI_SCK) | (1 << FTDI_MOSI) | (1 << FTDI_MISO)); + /* mask out SCK/SDI/SDO */ + valid_mask &= ~((1 << FTDI_SCK) | (1 << FTDI_SDO) | (1 << FTDI_SDI)); log_debug("Using valid mask mpsse: 0x%08x\n", valid_mask); 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 */ pin_checklist[PIN_AVR_SCK].mandatory = 1; pin_checklist[PIN_AVR_SCK].valid_pins = &valid_pins_SCK; - pin_checklist[PIN_AVR_MOSI].mandatory = 1; - pin_checklist[PIN_AVR_MOSI].valid_pins = &valid_pins_MOSI; - pin_checklist[PIN_AVR_MISO].mandatory = 1; - pin_checklist[PIN_AVR_MISO].valid_pins = &valid_pins_MISO; + pin_checklist[PIN_AVR_SDO].mandatory = 1; + pin_checklist[PIN_AVR_SDO].valid_pins = &valid_pins_SDO; + pin_checklist[PIN_AVR_SDI].mandatory = 1; + pin_checklist[PIN_AVR_SDI].valid_pins = &valid_pins_SDI; pin_checklist[PIN_AVR_RESET].mandatory = 1; /* 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); 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), - avr_pin_name(PIN_AVR_MOSI), avr_pin_name(PIN_AVR_MISO), - pins_to_str(&pgm->pin[PIN_AVR_SCK]), - pins_to_str(&pgm->pin[PIN_AVR_MOSI]), - pins_to_str(&pgm->pin[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_SDO]), + pins_to_str(&pgm->pin[PIN_AVR_SDI])); log_err("If other pin configuration is used, fallback to slower bitbanging mode is used.\n"); 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. - * 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). */ - /* everything is an output, except MISO */ + /* everything is an output, except SDI */ for(pin = 0; pin < N_PINS; ++pin) { pdata->pin_direction |= pgm->pin[pin].mask[0]; 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) { pdata->led_mask |= pgm->pin[pin].mask[0]; diff --git a/src/avrftdi_tpi.c b/src/avrftdi_tpi.c index dcb3d48d..f4cd18f9 100644 --- a/src/avrftdi_tpi.c +++ b/src/avrftdi_tpi.c @@ -72,7 +72,7 @@ avrftdi_tpi_initialize(const PROGRAMMER *pgm, const AVRPART *p) { log_info("Setting /Reset pin low\n"); pgm->setpin(pgm, PIN_AVR_RESET, 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); pgm->setpin(pgm, PIN_AVR_RESET, ON); diff --git a/src/bitbang.c b/src/bitbang.c index 74548d5a..4d0be96e 100644 --- a/src/bitbang.c +++ b/src/bitbang.c @@ -172,9 +172,9 @@ static unsigned char bitbang_txrx(const PROGRAMMER *pgm, unsigned char byte) { * one pgm->setpin()-call resp. par clrpin()-call, then * - SCK is high for 2T * - SCK is low for 2T - * - MOSI setuptime is 1T - * - MOSI holdtime is 3T - * - SCK low to MISO read is 2T to 3T + * - SDO setuptime is 1T + * - SDO holdtime is 3T + * - SCK low to SDI read is 2T to 3T * So we are within programming specs (expect for AT90S1200), * 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; /* 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); @@ -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 * 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); @@ -208,7 +208,7 @@ static int bitbang_tpi_clk(const PROGRAMMER *pgm) { unsigned char r = 0; 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); @@ -220,7 +220,7 @@ void bitbang_tpi_tx(const PROGRAMMER *pgm, unsigned char byte) { unsigned char b, parity; /* start bit */ - pgm->setpin(pgm, PIN_AVR_MOSI, 0); + pgm->setpin(pgm, PIN_AVR_SDO, 0); bitbang_tpi_clk(pgm); parity = 0; @@ -229,16 +229,16 @@ void bitbang_tpi_tx(const PROGRAMMER *pgm, unsigned char byte) { parity ^= b; /* 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); } /* parity bit */ - pgm->setpin(pgm, PIN_AVR_MOSI, parity); + pgm->setpin(pgm, PIN_AVR_SDO, parity); bitbang_tpi_clk(pgm); /* 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); } @@ -248,7 +248,7 @@ int bitbang_tpi_rx(const PROGRAMMER *pgm) { unsigned char b, rbyte, parity; /* 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) */ b = 1; @@ -517,7 +517,7 @@ int bitbang_initialize(const PROGRAMMER *pgm, const AVRPART *p) { pgm->powerup(pgm); 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) { /* make sure cmd_tpi() is defined */ 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: */ 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); - if (pgm->getpin(pgm, PIN_AVR_MISO) != 0) { - pmsg_error("MOSI->MISO 0 failed\n"); + pgm->setpin(pgm, PIN_AVR_SDO, 0); + if (pgm->getpin(pgm, PIN_AVR_SDI) != 0) { + pmsg_error("SDO->SDI 0 failed\n"); return -1; } - pgm->setpin(pgm, PIN_AVR_MOSI, 1); - if (pgm->getpin(pgm, PIN_AVR_MISO) != 1) { - pmsg_error("MOSI->MISO 1 failed\n"); + pgm->setpin(pgm, PIN_AVR_SDO, 1); + if (pgm->getpin(pgm, PIN_AVR_SDI) != 1) { + pmsg_error("SDO->SDI 1 failed\n"); return -1; } - msg_notice2("MOSI-MISO link present\n"); + msg_notice2("SDO-SDI link present\n"); } 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) { /* 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++) pgm->highpulsepin(pgm, PIN_AVR_SCK); @@ -626,9 +626,9 @@ int bitbang_check_prerequisites(const PROGRAMMER *pgm) { return -1; if (verify_pin_assigned(pgm, PIN_AVR_SCK, "AVR SCK") < 0) 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; - if (verify_pin_assigned(pgm, PIN_AVR_MOSI, "AVR MOSI") < 0) + if (verify_pin_assigned(pgm, PIN_AVR_SDO, "AVR SDO") < 0) return -1; if (pgm->cmd == NULL) { diff --git a/src/buspirate.c b/src/buspirate.c index 69328950..3df31642 100644 --- a/src/buspirate.c +++ b/src/buspirate.c @@ -25,8 +25,8 @@ * GND <-> GND * +5V <-> Vcc * CS <-> RESET - * MOSI <-> MOSI - * MISO <-> MISO + * SDO <-> SDO + * SDI <-> SDI * SCL/CLK <-> SCK * ( AUX <-> XTAL1 ) * @@ -1168,12 +1168,12 @@ static void buspirate_bb_enable(PROGRAMMER *pgm, const AVRPART *p) { PDATA(pgm)->flag |= BP_FLAG_IN_BINMODE; /* 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; buspirate_send_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; buspirate_send_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: 010xxxxx Input (1) or output (0): - AUX|MOSI|CLK|MISO|CS + AUX|SDO|CLK|SDI|CS Output value: 1xxxxxxx 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: - 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) { unsigned char buf[10]; diff --git a/src/config_gram.y b/src/config_gram.y index 23018490..a90d2373 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -100,8 +100,8 @@ static int pin_name; %token K_MAX_WRITE_DELAY %token K_MCU_BASE %token K_MIN_WRITE_DELAY -%token K_MISO -%token K_MOSI +%token K_SDI +%token K_SDO %token K_NUM_PAGES %token K_NVM_BASE %token K_OCD_BASE @@ -662,8 +662,8 @@ prog_parm_pins: 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_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_MISO TKN_EQUAL {pin_name = PIN_AVR_MISO; } pin_number | + K_SDO TKN_EQUAL {pin_name = PIN_AVR_SDO; } 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_RDYLED TKN_EQUAL {pin_name = PIN_LED_RDY; } pin_number | K_PGMLED TKN_EQUAL {pin_name = PIN_LED_PGM; } pin_number | diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index 672c7a98..ed4a47f3 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -164,7 +164,7 @@ abysmally slow. 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 -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 the lines using the Linux sysfs GPIO interface. Of course, care should 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 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 is pin 22 as GPIO25 which can be used as /RESET, and pin 25 can be used as GND. @@ -204,10 +204,10 @@ A typical programming cable would then look like: @multitable @columnfractions .15 .15 .3 @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{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{25} @tab @code{6} @tab @code{GND} @end multitable @@ -223,7 +223,7 @@ programmers communicate through the USB, using @code{libusb} as a platform abstraction layer. 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 -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 usbdev config parameter). 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} 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 -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 @emph{CS} 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{VDD} @tab @code{VDD Target (2) -- possibly optional if AVR self powered } @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{OSI} @tab @code{AUX (6) } @end multitable @@ -1799,8 +1799,8 @@ programmer buff = [, ... ] ; # pin number(s) reset = ; # pin number sck = ; # pin number - mosi = ; # pin number - miso = ; # pin number + sdo = ; # pin number + sdi = ; # pin number errled = ; # pin number rdyled = ; # pin number pgmled = ; # 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 @item @strong{Dragon} @tab @strong{Target} @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 3 (SCK) @tab -@item 4 (MOSI) @tab +@item 4 (SDO) @tab @item 5 (RESET) @tab PDI_CLK / RST @item 6 (GND) @tab GND @end multitable @@ -2974,10 +2974,10 @@ Solution: Use the following pin mapping: @multitable @columnfractions .2 .2 .2 @item @strong{AVRISP} @tab @strong{Target} @tab @strong{ATtiny} @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 3 (SCK) @tab TPICLK @tab 3 -@item 4 (MOSI) @tab @tab +@item 4 (SDO) @tab @tab @item 5 (RESET) @tab /RESET @tab 6 @item 6 (GND) @tab GND @tab 2 @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? 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. -However, a 1K resistor should be placed between the @var{MOSI} and @var{TPIDATA}. -The @var{MISO} pin connects to @var{TPIDATA} directly. +However, a 1K resistor should be placed between the @var{SDO} and @var{TPIDATA}. +The @var{SDI} pin connects to @var{TPIDATA} directly. The @var{SCK} pin is connected to @var{TPICLK}. 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 programmer 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; reset = ~7; sck = ~4; - mosi = ~3; - miso = ~8; + sdo = ~3; + sdi = ~8; ; @end example diff --git a/src/ft245r.c b/src/ft245r.c index 900bef5a..8eab7d6f 100644 --- a/src/ft245r.c +++ b/src/ft245r.c @@ -25,9 +25,9 @@ /* ft245r -- FT245R/FT232R Synchronous BitBangMode Programmer default pin assign FT232R / FT245R - miso = 1; # RxD / D1 + sdi = 1; # RxD / D1 sck = 0; # RTS / D0 - mosi = 2; # TxD / D2 + sdo = 2; # TxD / D2 reset = 4; # DTR / D4 */ @@ -548,7 +548,7 @@ static int ft245r_initialize(const PROGRAMMER *pgm, const AVRPART *p) { set_reset(pgm, OFF); /* 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 @@ -557,35 +557,35 @@ static int ft245r_initialize(const PROGRAMMER *pgm, const AVRPART *p) { uint8_t byte; 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 - everything we send on MOSI gets mirrored back on MISO. */ - set_pin(pgm, PIN_AVR_MOSI, 0); - if (get_pin(pgm, PIN_AVR_MISO) != 0) { + everything we send on SDO gets mirrored back on SDI. */ + set_pin(pgm, PIN_AVR_SDO, 0); + if (get_pin(pgm, PIN_AVR_SDI) != 0) { io_link_ok = false; if(ovsigck) { - pmsg_warning("MOSI->MISO 0 failed\n"); + pmsg_warning("SDO->SDI 0 failed\n"); } else { - pmsg_error("MOSI->MISO 0 failed\n"); + pmsg_error("SDO->SDI 0 failed\n"); return -1; } } - set_pin(pgm, PIN_AVR_MOSI, 1); - if (get_pin(pgm, PIN_AVR_MISO) != 1) { + set_pin(pgm, PIN_AVR_SDO, 1); + if (get_pin(pgm, PIN_AVR_SDI) != 1) { io_link_ok = false; if(ovsigck) { - pmsg_warning("MOSI->MISO 1 failed\n"); + pmsg_warning("SDO->SDI 1 failed\n"); } else { - pmsg_error("MOSI->MISO 1 failed\n"); + pmsg_error("SDO->SDI 1 failed\n"); return -1; } } 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 */ - set_pin(pgm, PIN_AVR_MOSI, 1); + set_pin(pgm, PIN_AVR_SDO, 1); for (i = 0; i < 16; i++) { set_sck(pgm, 1); 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, 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); buf[*buf_pos] = ft245r_out; (*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) { 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 */ unsigned char bit = 0x80; unsigned char r = 0; buf += offset * (8 * FT245R_CYCLES); 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; } 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); 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; } 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++) { (*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; bit <<= 1; } @@ -747,7 +747,7 @@ static int ft245r_tpi_rx(const PROGRAMMER *pgm, uint8_t *bytep) { uint32_t res, m, byte; /* 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) 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[] = { { PIN_AVR_SCK, 1, &valid_pins}, - { PIN_AVR_MOSI, 1, &valid_pins}, - { PIN_AVR_MISO, 1, &valid_pins}, + { PIN_AVR_SDO, 1, &valid_pins}, + { PIN_AVR_SDI, 1, &valid_pins}, { PIN_AVR_RESET,1, &valid_pins}, { PPI_AVR_BUFF, 0, &valid_pins}, }; @@ -889,7 +889,7 @@ static int ft245r_open(PROGRAMMER *pgm, const char *port) { ft245r_ddr = 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[PPI_AVR_BUFF].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 = 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_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_VCC,0); ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_LED_ERR,0); diff --git a/src/lexer.l b/src/lexer.l index b637c4b7..bcd12909 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -196,9 +196,9 @@ max_write_delay { yylval=NULL; ccap(); return K_MAX_WRITE_DELAY; } mcu_base { yylval=NULL; ccap(); return K_MCU_BASE; } memory { yylval=NULL; ccap(); return K_MEMORY; } 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; } -mosi { yylval=NULL; ccap(); return K_MOSI; } +mosi { yylval=NULL; ccap(); return K_SDO; } // Deprecated no { yylval=new_token(K_NO); return K_NO; } NULL { yylval=NULL; return K_NULL; } 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; } retry_pulse { yylval=NULL; ccap(); return K_RETRY_PULSE; } 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; } signature { yylval=NULL; ccap(); return K_SIGNATURE; } size { yylval=NULL; ccap(); return K_SIZE; } diff --git a/src/libavrdude.h b/src/libavrdude.h index 83556af3..7f98b30e 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -401,8 +401,8 @@ enum { PPI_AVR_BUFF, PIN_AVR_RESET, PIN_AVR_SCK, - PIN_AVR_MOSI, - PIN_AVR_MISO, + PIN_AVR_SDO, + PIN_AVR_SDI, PIN_LED_ERR, PIN_LED_RDY, PIN_LED_PGM, @@ -830,10 +830,10 @@ void pgm_free(PROGRAMMER *p); void programmer_display(PROGRAMMER * pgm, const char * p); -/* show is a mask like this (1<pinno[i] & PIN_MASK) != 0 || i == PIN_AVR_RESET || i == PIN_AVR_SCK || - i == PIN_AVR_MOSI || - i == PIN_AVR_MISO ) { + i == PIN_AVR_SDO || + i == PIN_AVR_SDI ) { pin = pgm->pinno[i] & PIN_MASK; if ((r=linuxgpio_export(pin)) < 0) { 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 */ for (retry_count = 0; retry_count < GPIO_SYSFS_OPEN_RETRIES; retry_count++) { usleep(GPIO_SYSFS_OPEN_DELAY); - if (i == PIN_AVR_MISO) + if (i == PIN_AVR_SDI) r=linuxgpio_dir_in(pin); else r=linuxgpio_dir_out(pin); @@ -307,7 +307,7 @@ static int linuxgpio_open(PROGRAMMER *pgm, const char *port) { if (retry_count) pmsg_notice2("needed %d retr%s for linuxgpio_dir_%s(%s)\n", 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) { linuxgpio_unexport(pin); diff --git a/src/linuxspi.c b/src/linuxspi.c index cebee554..e45ca687 100644 --- a/src/linuxspi.c +++ b/src/linuxspi.c @@ -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 * minimum pulse width on RESET pin, t RST * 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 * is out of synchronization. When in sync, the second byte (0x53) will echo * back when issuing the third byte of the Programming Enable instruction diff --git a/src/pgm.c b/src/pgm.c index dca0ea87..34006d53 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -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])); if(show & (1<pin[PIN_AVR_SCK])); - if(show & (1<pin[PIN_AVR_MOSI])); - if(show & (1<pin[PIN_AVR_MISO])); + if(show & (1<pin[PIN_AVR_SDO])); + if(show & (1<pin[PIN_AVR_SDI])); if(show & (1<pin[PIN_LED_ERR])); if(show & (1<pin[PIN_AVR_SCK]), &(pgm->pinno[PIN_AVR_SCK])) < 0) 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; - 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; if (pin_fill_old_pinno(&(pgm->pin[PIN_LED_ERR]), &(pgm->pinno[PIN_LED_ERR])) < 0) return -1; @@ -378,8 +378,8 @@ const char * avr_pin_name(int pinname) { case PPI_AVR_BUFF : return "BUFF"; case PIN_AVR_RESET : return "RESET"; case PIN_AVR_SCK : return "SCK"; - case PIN_AVR_MOSI : return "MOSI"; - case PIN_AVR_MISO : return "MISO"; + case PIN_AVR_SDO : return "SDO"; + case PIN_AVR_SDI : return "SDI"; case PIN_LED_ERR : return "ERRLED"; case PIN_LED_RDY : return "RDYLED"; case PIN_LED_PGM : return "PGMLED"; @@ -401,8 +401,8 @@ const char * avr_pin_lcname(int pinname) { case PPI_AVR_BUFF : return "buff"; case PIN_AVR_RESET : return "reset"; case PIN_AVR_SCK : return "sck"; - case PIN_AVR_MOSI : return "mosi"; - case PIN_AVR_MISO : return "miso"; + case PIN_AVR_SDO : return "sdo"; + case PIN_AVR_SDI : return "sdi"; case PIN_LED_ERR : return "errled"; case PIN_LED_RDY : return "rdyled"; case PIN_LED_PGM : return "pgmled"; diff --git a/src/stk500v2.c b/src/stk500v2.c index a4cf943a..4294b12f 100644 --- a/src/stk500v2.c +++ b/src/stk500v2.c @@ -1005,7 +1005,7 @@ static struct const char *description; } connection_status[] = { - { STATUS_CONN_FAIL_MOSI, "MOSI fail" }, + { STATUS_CONN_FAIL_SDO, "SDO fail" }, { STATUS_CONN_FAIL_RST, "RST fail" }, { STATUS_CONN_FAIL_SCK, "SCK fail" }, { STATUS_TGT_NOT_DETECTED, "Target not detected" }, diff --git a/src/stk500v2_private.h b/src/stk500v2_private.h index 5531a269..8a08daf3 100644 --- a/src/stk500v2_private.h +++ b/src/stk500v2_private.h @@ -141,7 +141,7 @@ // Status #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_SCK 0x04 #define STATUS_TGT_NOT_DETECTED 0x10 diff --git a/src/usbtiny.c b/src/usbtiny.c index 2063f89b..a69de8f3 100644 --- a/src/usbtiny.c +++ b/src/usbtiny.c @@ -445,10 +445,10 @@ static int usbtiny_initialize (const PROGRAMMER *pgm, const AVRPART *p ) { usleep(50000); 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 - everything we send on MOSI gets mirrored back on MISO. */ - msg_notice2("doing MOSI-MISO link check\n"); + everything we send on SDO gets mirrored back on SDI. */ + msg_notice2("doing SDO-SDI link check\n"); memset(res, 0xaa, sizeof(res)); 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; } 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" - "\tplease verify that MISO is connected directly to TPIDATA and\n" - "\tMOSI is connected to TPIDATA through a 1kOhm resistor\n", + pmsg_error("SDO->SDI check failed (got 0x%02x 0x%02x 0x%02x 0x%02x)\n" + "\tplease verify that SDI is connected directly to TPIDATA and\n" + "\tSDO is connected to TPIDATA through a 1kOhm resistor\n", res[0], res[1], res[2], res[3]); return -1; }