Changed the AVRISP-MKII Clone programmer project to report a fixed 3.3V VTARGET voltage on USB AVRs lacking an ADC instead of 5V to prevent warnings in AVR Studio 5.1 when programming XMEGA devices.
* - Library Applications:
* - Altered the Mass Storage Host LowLevel demo so that SCSI data STALLs from the attached device can be recovered from automatically without
* having to reset the Mass Storage interface
+ * - Updated the AVRISP-MKII Clone programmer project to be compatible with the latest version of AVR Studio (version 5.1)
+ * - Changed the AVRISP-MKII Clone programmer project to report a fixed 3.3V VTARGET voltage on USB AVRs lacking an ADC instead of 5V to prevent
+ * warnings in AVR Studio 5.1 when programming XMEGA devices
*
* <b>Fixed:</b>
* - Core:
*
* Firmware for an AVRStudio compatible AVRISP-MKII clone programmer. This project will enable the USB AVR series of
* microcontrollers to act as a clone of the official Atmel AVRISP-MKII programmer, usable within AVRStudio. In its
- * most basic form, it allows for the programming of 5V AVRs from within AVRStudio with no special hardware other than
- * the USB AVR and the parts needed for the USB interface. If the user desires, more advanced circuits incorporating
- * level conversion can be made to allow for the programming of 3.3V AVR designs.
+ * most basic form, it allows for the programming of AVRs at the programmer's VCC voltage from within AVRStudio with
+ * no special hardware other than the USB AVR and the parts needed for the USB interface. If the user desires, more
+ * advanced circuits incorporating level conversion can be made to allow for the programming of 3.3V AVR designs.
*
* This device spoofs Atmel's official AVRISP-MKII device PID so that it remains compatible with Atmel's AVRISP-MKII
* drivers. When prompted, direct your OS to install Atmel's AVRISP-MKII drivers provided with AVRStudio.
*
* On AVR models with an ADC converter, AVCC should be tied to 5V (e.g. VBUS) and the \c VTARGET_ADC_CHANNEL token should be
* set to an appropriate ADC channel number in the project makefile for VTARGET detection to operate correctly. On models
- * without an ADC converter, VTARGET will report a fixed 5V level at all times.
+ * without an ADC converter, VTARGET will report a fixed 3.3V level at all times.
*
* While this application can be compiled for USB AVRs with as little as 8KB of FLASH, for full functionality 16KB or more
* of FLASH is required. On 8KB devices, ISP or PDI/TPI programming support can be disabled to reduce program size.
* <td>NO_VTARGET_DETECT</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Define to disable VTARGET sampling and reporting on AVR models with an ADC converter. This will cause the programmer
- * to report a fixed 5V target voltage to the host regardless of the real target voltage. <i>Ignored when compiled for
+ * to report a fixed 3.3V target voltage to the host regardless of the real target voltage. <i>Ignored when compiled for
* targets lacking an ADC.</i></td>
* </tr>
* <tr>
* <td>LIBUSB_DRIVER_COMPAT</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making
- * the code compatible with software such as avrdude (all platforms) that use the libUSB driver.
+ * the code compatible with software such as avrdude (all platforms) that use the libUSB driver.</td>
* </tr>
* <tr>
* <td>XCK_RESCUE_CLOCK_ENABLE</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Define to move the ISP rescue clock to the AVR's XCK pin instead of the OCR1A output pin. This is useful for existing programming
- * hardware that does not expose the OCR1A pin of the AVR, but *may* cause some issues with PDI programming mode.
+ * hardware that does not expose the OCR1A pin of the AVR, but *may* cause some issues with PDI programming mode.</td>
* </tr>
* <tr>
* <td>INVERTED_ISP_MISO</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Define to invert the received data on the ISP MISO line. This is sometimes needed depending on the level translation hardware used,
- * if the translator hardware inverts the received logic level.
+ * if the translator hardware inverts the received logic level.</td>
+ * </tr>
+ * <tr>
+ * <td>FIRMWARE_VERSION_MINOR</td>
+ * <td>Define to set the minor firmware revision nunber reported to the host on request. By default this will use a firmware version compatible
+ * with the latest Atmel IDE version, however if desired the reported minor value can be adjusted here.</td>
* </tr>
* </table>
*/
*/
const USB_Descriptor_String_t PROGMEM ManufacturerString =
{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+ .Header = {.Size = USB_STRING_LEN(5), .Type = DTYPE_String},
- .UnicodeString = L"Dean Camera"
+ .UnicodeString = L"ATMEL"
};
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
*/
const USB_Descriptor_String_t PROGMEM ProductString =
{
- .Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
- .UnicodeString = L"LUFA AVRISP MkII Clone"
+ .UnicodeString = L"AVRISP mkII"
};
/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
const USB_Descriptor_String_t PROGMEM SerialString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
-
- .UnicodeString = L"0000A00128255"
+
+ .UnicodeString = L"000200012345\0" // Note: Real AVRISP-MKII has the embedded NUL byte, bug in firmware?
};
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
{ .ParamID = PARAM_SW_MINOR,
.ParamPrivileges = PARAM_PRIV_READ,
- .ParamValue = 0x0D },
+ .ParamValue = FIRMWARE_VERSION_MINOR },
{ .ParamID = PARAM_VTARGET,
.ParamPrivileges = PARAM_PRIV_READ,
- .ParamValue = 0x32 },
+ .ParamValue = (uint8_t)(3.3 * 10) },
{ .ParamID = PARAM_SCK_DURATION,
.ParamPrivileges = PARAM_PRIV_READ | PARAM_PRIV_WRITE,
/** Total number of parameters in the parameter table */
#define TABLE_PARAM_COUNT (sizeof(ParameterTable) / sizeof(ParameterTable[0]))
+
+ #if (!defined(FIRMWARE_VERSION_MINOR) || defined(__DOXYGEN__))
+ /** Minor firmware version, reported to the host on request; must match the version
+ * the host is expecting, or it (may) reject further communications with the programmer. */
+ #define FIRMWARE_VERSION_MINOR 0x11
+ #endif
/* Type Defines: */
/** Type define for a parameter table entry indicating a PC readable or writable device parameter. */
case XPRG_PARAM_NVMCSR_REG:
XPROG_Param_NVMCSRRegAddr = Endpoint_Read_8();
break;
+ case XPRG_PARAM_UNKNOWN_1:
+ /* TODO: Undocumented parameter added in AVRStudio 5.1, purpose unknown. Must ACK and discard or
+ the communication with AVRStudio 5.1 will fail.
+ */
+ Endpoint_Discard_16();
+ break;
default:
ReturnStatus = XPRG_ERR_FAILED;
break;
/* Preprocessor Checks: */
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+ /* On the XPLAIN board, we only need PDI programming
+ for the ATXMEGA128A1 - disable ISP to prevent hardware
+ damage.
+ */
#undef ENABLE_ISP_PROTOCOL
#if !defined(ENABLE_XPROG_PROTOCOL)
#define XPRG_PARAM_EEPPAGESIZE 0x02
#define XPRG_PARAM_NVMCMD_REG 0x03
#define XPRG_PARAM_NVMCSR_REG 0x04
+ #define XPRG_PARAM_UNKNOWN_1 0x05
#define XPRG_PROTOCOL_PDI 0x00
#define XPRG_PROTOCOL_JTAG 0x01
#LUFA_OPTS += -D LIBUSB_DRIVER_COMPAT
#LUFA_OPTS += -D XCK_RESCUE_CLOCK_ENABLE
#LUFA_OPTS += -D INVERTED_ISP_MISO
+#LUFA_OPTS += -D FIRMWARE_VERSION_MINOR=0x11
# Create the LUFA source path variables by including the LUFA root makefile
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
- .ConfigAttributes = USB_CONFIG_ATTR_RESERVED,
+ .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
.TotalEndpoints = 2,
.Class = USB_CSCP_VendorSpecificClass,
- .SubClass = 0x00,
- .Protocol = 0x00,
+ .SubClass = USB_CSCP_NoDeviceSubclass,
+ .Protocol = USB_CSCP_NoDeviceProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
*/
const USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
+ .Header = {.Size = USB_STRING_LEN(5), .Type = DTYPE_String},
- .UnicodeString = L"Dean Camera"
+ .UnicodeString = L"ATMEL"
};
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
*/
const USB_Descriptor_String_t PROGMEM AVRISP_ProductString =
{
- .Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
+ .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
- .UnicodeString = L"LUFA AVRISP MkII Clone"
+ .UnicodeString = L"AVRISP mkII"
};
/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
- .UnicodeString = L"0000A00128255"
+ .UnicodeString = L"000200053650\0"
};
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
*DescriptorAddress = Address;
return Size;
}
-
* <td>LIBUSB_DRIVER_COMPAT</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making
- * the code compatible with software such as avrdude (all platforms) that use the libUSB driver.
+ * the code compatible with software such as avrdude (all platforms) that use the libUSB driver.</td>
+ * </tr>
+ * <tr>
+ * <td>FIRMWARE_VERSION_MINOR</td>
+ * <td>Define to set the minor firmware revision nunber reported to the host on request. By default this will use a firmware version compatible
+ * with the latest Atmel IDE version, however if desired the reported minor value can be adjusted here.</td>
* </tr>
* </table>
*/
LUFA_OPTS = -D USB_DEVICE_ONLY
LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0
LUFA_OPTS += -D ORDERED_EP_CONFIG
-LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=16
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D VTARGET_REF_VOLTS=3.3
LUFA_OPTS += -D VTARGET_SCALE_FACTOR=2
#LUFA_OPTS += -D LIBUSB_DRIVER_COMPAT
-
+#LUFA_OPTS += -D FIRMWARE_VERSION_MINOR=0x11
# Create the LUFA source path variables by including the LUFA root makefile
include $(LUFA_PATH)/LUFA/makefile