Commit 18b82b35 authored by Dean Camera's avatar Dean Camera
Browse files

Updated the AVRISP-MKII Clone programmer project to be compatible with the...

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.
parent 1482f778
......@@ -37,6 +37,9 @@
* - 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:
......
......@@ -46,9 +46,9 @@
*
* 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.
......@@ -59,7 +59,7 @@
*
* 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.
......@@ -256,7 +256,7 @@
* <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>
......@@ -285,19 +285,24 @@
* <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>
*/
......
......@@ -140,9 +140,9 @@ const USB_Descriptor_String_t PROGMEM LanguageString =
*/
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,
......@@ -151,9 +151,9 @@ const USB_Descriptor_String_t PROGMEM ManufacturerString =
*/
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
......@@ -162,8 +162,8 @@ const USB_Descriptor_String_t PROGMEM ProductString =
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"
......
......@@ -60,11 +60,11 @@ static ParameterItem_t ParameterTable[] =
{ .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,
......
......@@ -59,6 +59,12 @@
/** 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. */
......
......@@ -455,6 +455,12 @@ static void XPROGProtocol_SetParam(void)
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;
......
......@@ -49,6 +49,10 @@
/* 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)
......@@ -98,6 +102,7 @@
#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
......
......@@ -145,6 +145,7 @@ LUFA_OPTS += -D VTARGET_SCALE_FACTOR=1
#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
......
......@@ -81,7 +81,7 @@ const AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescript
.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)
},
......@@ -96,8 +96,8 @@ const AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescript
.TotalEndpoints = 2,
.Class = USB_CSCP_VendorSpecificClass,
.SubClass = 0x00,
.Protocol = 0x00,
.SubClass = USB_CSCP_NoDeviceSubclass,
.Protocol = USB_CSCP_NoDeviceProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
......@@ -140,9 +140,9 @@ const USB_Descriptor_String_t PROGMEM AVRISP_LanguageString =
*/
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,
......@@ -151,9 +151,9 @@ const USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
*/
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
......@@ -163,7 +163,7 @@ const USB_Descriptor_String_t PROGMEM AVRISP_SerialString =
{
.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"
......@@ -219,4 +219,3 @@ uint16_t AVRISP_GetDescriptor(const uint16_t wValue,
*DescriptorAddress = Address;
return Size;
}
......@@ -87,7 +87,12 @@
* <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>
*/
......
......@@ -127,7 +127,7 @@ AVRISP_PATH = ../AVRISP-MKII
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)"
......@@ -142,7 +142,7 @@ LUFA_OPTS += -D VTARGET_ADC_CHANNEL=2
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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment