AVRISP-MKII.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. /** \file
  2. *
  3. * This file contains special DoxyGen information for the generation of the main page and other special
  4. * documentation pages. It is not a project source file.
  5. */
  6. /** \mainpage AVRISP MKII Programmer Project
  7. *
  8. * \section Sec_Compat Project Compatibility
  9. *
  10. * The following list indicates what microcontrollers are compatible with this project.
  11. *
  12. * \li Series 7 USB AVRs (AT90USBxxx7)
  13. * \li Series 6 USB AVRs (AT90USBxxx6)
  14. * \li Series 4 USB AVRs (ATMEGAxxU4)
  15. * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) - <i>8KB versions with reduced features only</i>
  16. *
  17. * \section Sec_Info USB Information
  18. *
  19. * The following table gives a rundown of the USB utilization of this project.
  20. *
  21. * <table>
  22. * <tr>
  23. * <td><b>USB Mode:</b></td>
  24. * <td>Device</td>
  25. * </tr>
  26. * <tr>
  27. * <td><b>USB Class:</b></td>
  28. * <td>Vendor Specific Class</td>
  29. * </tr>
  30. * <tr>
  31. * <td><b>USB Subclass:</b></td>
  32. * <td>N/A</td>
  33. * </tr>
  34. * <tr>
  35. * <td><b>Relevant Standards:</b></td>
  36. * <td>Atmel AVRISP MKII Protocol Specification</td>
  37. * </tr>
  38. * <tr>
  39. * <td><b>Supported USB Speeds:</b></td>
  40. * <td>Full Speed Mode</td>
  41. * </tr>
  42. * </table>
  43. *
  44. * \section Sec_Description Project Description
  45. *
  46. * Firmware for an Atmel Studio compatible AVRISP-MKII clone programmer. This project will enable the USB
  47. * AVR series of microcontrollers to act as a clone of the official Atmel AVRISP-MKII programmer, usable within
  48. * Atmel Studio or with any software capable of driving a real Atmel AVRISP-MKII programmer. In its most
  49. * basic form, it allows for the programming of AVR TINY, MEGA and XMEGA devices at the programmer's VCC voltage from
  50. * within Atmel Studio with no special hardware other than the USB AVR and the parts needed for the USB
  51. * interface. If the user desires, more advanced circuits incorporating level conversion can be made to allow for the
  52. * programming of target AVRs running at a different voltage to the programmer.
  53. *
  54. * This device spoofs Atmel's official AVRISP-MKII device PID so that it remains compatible with Atmel's AVRISP-MKII
  55. * drivers. It is currently tested working under the following configurations:
  56. *
  57. * - <b>Windows:</b> Atmel Studio 7, with alternative driver
  58. * - <b>Windows:</b> AVRDUDE 6.2, with alternative driver
  59. * - <b>Linux:</b> AVRDUDE 6.1
  60. *
  61. * <b>Note that this clone requires a libUSB based driver under Windows,</b> due to an incompatible change in the official
  62. * Jungo based driver. The alternative driver given here will function with both real and clone AVRISP devices in Atmel
  63. * Studio 7 onwards under Windows - and as a bonus, also provides AVRDude access to the programmer.
  64. *
  65. * As of Atmel Studio version 7.0.1417 the legacy Jungo driver has been deprecated in favor of an official libUSB based
  66. * driver, making the driver packaged here superfluous. Use the driver packaged here only if you are still using an earlier
  67. * Atmel Studio 7 build, otherwise the official Atmel libUSB driver should be used.
  68. *
  69. * Note that this design currently has the following limitations:
  70. * - No reversed/shorted target connector detection and notification
  71. * - A separate header is required for each of the ISP, PDI and TPI programming protocols that the user wishes to use
  72. *
  73. * On AVR models with an ADC converter, the USB AVR's AVCC pin should be tied to 5V (e.g. VBUS) and the
  74. * \c VTARGET_ADC_CHANNEL token should be set to an appropriate ADC channel number in the project makefile for VTARGET
  75. * detection to operate correctly. On models without an ADC converter, VTARGET will report a fixed 3.3V level at all times
  76. * which should allow the programmer to remain compatible at the protocol level with all AVR devices.
  77. *
  78. * While this application can be compiled for USB AVRs with as little as 8KB of FLASH, for full functionality 16KB or more
  79. * of FLASH is required. On 8KB devices, ISP or PDI/TPI protocol programming support can be disabled to reduce program size.
  80. *
  81. * \section Sec_Installation Installation
  82. * The programmer supports multiple platforms, both Windows and Linux.
  83. *
  84. * \subsection SSec_LinuxInstallation Linux Installation
  85. * On Linux systems, the programmer should be usable out of the box with no special setup other than (on some systems)
  86. * editing of the system permissions to allow the programmer to be used from a non-elevated (root) context. The programmer
  87. * is compatible with the free open source AVRDude programming software project.
  88. *
  89. * \subsection SSec_WindowsInstallation Windows Installation
  90. * On Windows systems, due to an unfortunate limitation of the USB AVR devices and the Atmel Studio platform, the programmer
  91. * requires an alternative libUSB based driver. Uninstall the existing Jungo driver for the device (if installed) and replace
  92. * it with the driver that ships with this project, to enable access to the programmer in Atmel Studio and AVRDUDE.
  93. *
  94. * \section Sec_ISP ISP Connections
  95. * Connections to the device for SPI programming (when enabled):
  96. *
  97. * <table>
  98. * <tr>
  99. * <th><b>Programmer Pin:</b></th>
  100. * <th><b>Target Device Pin:</b></th>
  101. * <th><b>ISP 6 Pin Layout:</b></th>
  102. * </tr>
  103. * <tr>
  104. * <td>MISO</td>
  105. * <td>PDO</td>
  106. * <td>1</td>
  107. * </tr>
  108. * <tr>
  109. * <td>ADCx <b><sup>1</sup></b></td>
  110. * <td>VTARGET</td>
  111. * <td>2</td>
  112. * </tr>
  113. * <tr>
  114. * <td>SCLK</td>
  115. * <td>SCLK</td>
  116. * <td>3</td>
  117. * </tr>
  118. * <tr>
  119. * <td>MOSI</td>
  120. * <td>PDI</td>
  121. * <td>4</td>
  122. * </tr>
  123. * <tr>
  124. * <td>PORTx.y <b><sup>2</sup></b></td>
  125. * <td>/RESET</td>
  126. * <td>5</td>
  127. * </tr>
  128. * <tr>
  129. * <td>GND</td>
  130. * <td>GND</td>
  131. * <td>6</td>
  132. * </tr>
  133. * </table>
  134. *
  135. * In addition, the AVR's OCR1A pin will generate a 4MHz clock, to act as an external rescue device clock if the
  136. * fuses have been mis-set. To use the recovery clock, connect the OCR1A pin of the USB AVR to the target AVR's
  137. * XTAL1 pin, and set the ISP programming speed to 125KHz (note: other ISP speeds will not work correctly).
  138. *
  139. * <b><sup>1</sup></b> <i>Optional, see \ref Sec_Options section - for USB AVRs with ADC modules only</i> \n
  140. * <b><sup>2</sup></b> <i>See AUX line related tokens in the \ref Sec_Options section</i>
  141. *
  142. * \section Sec_PDI PDI Connections
  143. * Connections to the device for PDI programming (when enabled):
  144. *
  145. * <table>
  146. * <tr>
  147. * <th><b>Programmer Pin:</b></th>
  148. * <th><b>Target Device Pin:</b></th>
  149. * <th><b>PDI 6 Pin Layout:</b></th>
  150. * </tr>
  151. * <tr>
  152. * <td>Tx/Rx <b><sup>2</sup></b></td>
  153. * <td>DATA</td>
  154. * <td>1</td>
  155. * </tr>
  156. * <tr>
  157. * <td>ADCx <b><sup>1</sup></b></td>
  158. * <td>VTARGET</td>
  159. * <td>2</td>
  160. * </tr>
  161. * <tr>
  162. * <td>N/A</td>
  163. * <td>N/A</td>
  164. * <td>3</td>
  165. * </tr>
  166. * <tr>
  167. * <td>N/A</td>
  168. * <td>N/A</td>
  169. * <td>4</td>
  170. * </tr>
  171. * <tr>
  172. * <td>XCK</td>
  173. * <td>CLOCK</td>
  174. * <td>5</td>
  175. * </tr>
  176. * <tr>
  177. * <td>GND</td>
  178. * <td>GND</td>
  179. * <td>6</td>
  180. * </tr>
  181. * </table>
  182. *
  183. * <b><sup>1</sup></b> <i>Optional, see \ref Sec_Options section - for USB AVRs with ADC modules only</i> \n
  184. * <b><sup>2</sup></b> <i>The AVR's Tx and Rx become the DATA line when connected together via a pair of 220 ohm resistors</i> \n
  185. *
  186. * \section Sec_TPI TPI Connections
  187. * Connections to the device for TPI programming (when enabled):
  188. *
  189. * <table>
  190. * <tr>
  191. * <th><b>Programmer Pin:</b></th>
  192. * <th><b>Target Device Pin:</b></th>
  193. * <th><b>TPI 6 Pin Layout:</b></th>
  194. * </tr>
  195. * <tr>
  196. * <td>Tx/Rx <b><sup>2</sup></b></td>
  197. * <td>DATA</td>
  198. * <td>1</td>
  199. * </tr>
  200. * <tr>
  201. * <td>ADCx <b><sup>1</sup></b></td>
  202. * <td>VTARGET</td>
  203. * <td>2</td>
  204. * </tr>
  205. * <tr>
  206. * <td>XCK <b><sup>2</sup></b></td>
  207. * <td>CLOCK</td>
  208. * <td>3</td>
  209. * </tr>
  210. * <tr>
  211. * <td>N/A</td>
  212. * <td>N/A</td>
  213. * <td>4</td>
  214. * </tr>
  215. * <tr>
  216. * <td>PORTx.y <b><sup>3</sup></b></td>
  217. * <td>/RESET</td>
  218. * <td>5</td>
  219. * </tr>
  220. * <tr>
  221. * <td>GND</td>
  222. * <td>GND</td>
  223. * <td>6</td>
  224. * </tr>
  225. * </table>
  226. *
  227. * <b><sup>1</sup></b> <i>Optional, see \ref Sec_Options section - for USB AVRs with ADC modules only</i> \n
  228. * <b><sup>2</sup></b> <i>The AVR's Tx and Rx become the DATA line when connected together via a pair of 220 ohm resistors</i> \n
  229. * <b><sup>3</sup></b> <i>See AUX line related tokens in the \ref Sec_Options section</i>
  230. *
  231. * \section Sec_Options Project Options
  232. *
  233. * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
  234. *
  235. * <table>
  236. * <tr>
  237. * <th><b>Define Name:</b></th>
  238. * <th><b>Location:</b></th>
  239. * <th><b>Description:</b></th>
  240. * </tr>
  241. * <tr>
  242. * <td>AUX_LINE_PORT</td>
  243. * <td>AppConfig.h</td>
  244. * <td>PORT register for the programmer's AUX target line. The use of this line varies between the programming protocols,
  245. * but is generally used for the target's /RESET line.
  246. * \n \n <i>Ignored when compiled for the XPLAIN board.</i></td>
  247. * </tr>
  248. * <tr>
  249. * <td>AUX_LINE_PIN</td>
  250. * <td>AppConfig.h</td>
  251. * <td>PIN register for the programmer's AUX target line. The use of this line varies between the programming protocols,
  252. * but is generally used for the target's /RESET line.
  253. * \n \n <i>Ignored when compiled for the XPLAIN board.</i></td>
  254. * </tr>
  255. * <tr>
  256. * <td>AUX_LINE_DDR</td>
  257. * <td>AppConfig.h</td>
  258. * <td>DDR register for the programmer's AUX target line. The use of this line varies between the programming protocols,
  259. * but is generally used for the target's /RESET line.
  260. * \n \n <i>Ignored when compiled for the XPLAIN board.</i></td>
  261. * </tr>
  262. * <tr>
  263. * <td>AUX_LINE_MASK</td>
  264. * <td>AppConfig.h</td>
  265. * <td>Mask for the programmer's AUX target line. The use of this line varies between the programming protocols,
  266. * but is generally used for the target's /RESET line. <b>Must not be the AVR's /SS pin</b>.
  267. * \n \n <i>Ignored when compiled for the XPLAIN board.</i></td>
  268. * </tr>
  269. * <tr>
  270. * <td>VTARGET_ADC_CHANNEL</td>
  271. * <td>AppConfig.h</td>
  272. * <td>ADC channel number (on supported AVRs) to use for VTARGET level detection, if NO_VTARGET_DETECT is not defined.
  273. * \n \n <i>Ignored when compiled for targets lacking an ADC.</i></td>
  274. * </tr>
  275. * <tr>
  276. * <td>ENABLE_ISP_PROTOCOL</td>
  277. * <td>AppConfig.h</td>
  278. * <td>Define to enable SPI programming protocol support.
  279. * \n \n <i>Ignored when compiled for the XPLAIN board.</i></td>
  280. * </tr>
  281. * <tr>
  282. * <td>ENABLE_XPROG_PROTOCOL</td>
  283. * <td>AppConfig.h</td>
  284. * <td>Define to enable PDI and TPI programming protocol support.
  285. * \n \n <i>Ignored when compiled for the XPLAIN board.</i></td>
  286. * </tr>
  287. * <tr>
  288. * <td>NO_VTARGET_DETECT</td>
  289. * <td>AppConfig.h</td>
  290. * <td>Define to disable VTARGET sampling and reporting on AVR models with an ADC converter. This will cause the programmer
  291. * to report a fixed 3.3V target voltage to the host regardless of the real target voltage.
  292. * \n \n <i>Ignored when compiled for targets lacking an ADC.</i></td>
  293. * </tr>
  294. * <tr>
  295. * <td>VTARGET_REF_VOLTS</td>
  296. * <td>AppConfig.h</td>
  297. * <td>Indicates the programmer AVR's AVCC reference voltage when measuring the target's supply voltage. Note that the supply
  298. * voltage should never exceed the reference voltage on the programmer AVR without some form of protection to prevent damage
  299. * to the ADC.
  300. * \n \n <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
  301. * </tr>
  302. * <tr>
  303. * <td>VTARGET_USE_INTERNAL_REF</td>
  304. * <td>AppConfig.h</td>
  305. * <td>Selects the internal 2.56V ADC reference voltage, instead of using the AVR's VREF pin. When enabled, this option will
  306. * override the VTARGET_REF_VOLTS configuration option.
  307. * \n \n <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
  308. * </tr>
  309. * <tr>
  310. * <td>VTARGET_SCALE_FACTOR</td>
  311. * <td>AppConfig.h</td>
  312. * <td>Indicates the target's supply voltage scale factor when applied to the ADC. A simple resistive divider can be used on the
  313. * ADC pin for measuring the target's supply voltage, so that voltages above the programmer AVR's AVCC reference voltage can be
  314. * measured. This should be the reciprocal of the division performed - e.g. if the VTARGET voltage is halved, this should be set
  315. * to 2.
  316. * \n \n <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
  317. * </tr>
  318. * <tr>
  319. * <td>XCK_RESCUE_CLOCK_ENABLE</td>
  320. * <td>AppConfig.h</td>
  321. * <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
  322. * hardware that does not expose the OCR1A pin of the AVR, but <i>may</i> cause some issues with PDI programming mode.</td>
  323. * </tr>
  324. * <tr>
  325. * <td>INVERTED_ISP_MISO</td>
  326. * <td>AppConfig.h</td>
  327. * <td>Define to invert the received data on the ISP MISO line. This is sometimes needed depending on the level translation hardware used,
  328. * if the translator hardware inverts the received logic level.</td>
  329. * </tr>
  330. * <tr>
  331. * <td>FIRMWARE_VERSION_MINOR</td>
  332. * <td>AppConfig.h</td>
  333. * <td>Define to set the minor firmware revision nunber reported to the host on request. By default this will use a firmware version compatible
  334. * with the latest Atmel IDE version, however if desired the reported minor value can be adjusted here.</td>
  335. * </tr>
  336. * </table>
  337. */