ReadmeForPK2CMDLinux2-6.txt 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. Release Notes for PICkit 2 Command Line Interface
  2. Linux Kernel 2.6 binary
  3. PK2CMD.EXE v1.20
  4. Device File v1.55.00 (included)
  5. PICkit 2 Firmware v2.32.00 (minimum required)
  6. 8 January, 2009
  7. Special thanks to the following individuals for their critical contributions
  8. to the development of this software:
  9. Jeff Post, Xiaofan Chen, and Alain Gibaud.
  10. -----------------------------------------------------------------------------
  11. Table of Contents
  12. -----------------------------------------------------------------------------
  13. 1. Tool Definition
  14. 2. Device Support List
  15. 3. Operating System Support List
  16. 4. What's New or Updated
  17. 5. Known Problems
  18. 6. Important Notes
  19. 7. Installation
  20. 8. Upgrading the PICkit 2 Operating System
  21. 9. Command Line Options
  22. 10. Command Line Examples
  23. 11. Return Codes
  24. 12. Customer Support
  25. ----------------------------------------------------------------------------
  26. 1. Tool Definition
  27. ----------------------------------------------------------------------------
  28. PICkit 2 Command Line Interface (PK2CMD) is a 32-bit command-line interface
  29. to the PICkit 2 device programmer.
  30. The PK2CMD executable requires the "PK2DeviceFile.dat" file for execution.
  31. As root (using 'su' or 'sudo'), copy the file pk2cmd to /usr/local/bin and
  32. the file PK2DeviceFile.dat to /usr/share/pk2.
  33. Your user PATH environment variable should include /usr/share/pk2. If using
  34. bash, edit the file .bashrc to include:
  35. PATH=$PATH:/usr/share/pk2
  36. export PATH
  37. Other command line interfaces should have a similar mechanism for setting
  38. your PATH variable.
  39. Optionally, the path to the device file may be explicitly specified on the
  40. command line using option -b (-B).
  41. Please read the file 'usbhotplug.txt' before installing pk2cmd. It explains
  42. how to set up USB udev or hotplug rules so pk2cmd can be run in user mode.
  43. You must also have libusb (http://libusb.sourceforge.net) installed on your
  44. system. (See the Installation section for more information)
  45. This Readme is targeted to users of the command-line interface. Refer to the
  46. "PICkit 2 User's Guide" for more information about the PICkit 2 Programmer.
  47. ----------------------------------------------------------------------------
  48. 2. Device Support List
  49. ----------------------------------------------------------------------------
  50. Device support is dependent on the device file version installed
  51. with the PICkit 2 device programmer. For the versions listed above
  52. device support is listed below.
  53. When selecting a part using the "P" option (section 9), use the
  54. full name from the list below.
  55. + Indicates parts that require 4.75V minimum VDD for programming.
  56. PICkit 2 may not be able to generate sufficiently high VDD,
  57. so an external 5.0v power supply may be required.
  58. # indicates Midrange parts that support low Vdd programming
  59. Baseline Devices
  60. ----------------
  61. PIC10F200 PIC10F202 PIC10F204 PIC10F206
  62. PIC10F220 PIC10F222
  63. PIC12F508 PIC12F509 PIC12F510 PIC12F519
  64. PIC16F505 PIC16F506 PIC16F526
  65. PIC16F54 PIC16F57 PIC16F59
  66. Midrange/Standard Devices
  67. ----------------
  68. >> All 'LF' versions of devices are supported
  69. PIC12F609 PIC12HV609
  70. PIC12F615 PIC12HV615
  71. PIC12F629 PIC12F635# PIC12F675 PIC12F683#
  72. PIC16F610 PIC16HV610 PIC16F616 PIC16HV616
  73. PIC16F627 PIC16F628 PIC16F639
  74. PIC16F627A PIC16F628A PIC16F648A
  75. PIC16F630 PIC16F631 PIC16F636# PIC16F676
  76. PIC16F677 PIC16F684# PIC16F685# PIC16F687#
  77. PIC16F688# PIC16F689# PIC16F690#
  78. PIC16F72+
  79. PIC16F73+ PIC16F74+ PIC16F76+ PIC16F77+
  80. PIC16F716
  81. PIC16F737+ PIC16F747+ PIC16F767+ PIC16F777+
  82. PIC16F785 PIC16HV785
  83. PIC16F84A PIC16F87# PIC16F88#
  84. PIC16F818# PIC16F819#
  85. PIC16F870 PIC16F871 PIC16F872
  86. PIC16F873 PIC16F874 PIC16F876 PIC16F877
  87. PIC16F873A PIC16F874A PIC16F876A PIC16F877A
  88. PIC16F882#
  89. PIC16F883# PIC16F884# PIC16F886# PIC16F887#
  90. PIC16F913# PIC16F914# PIC16F916# PIC16F917#
  91. PIC16F946#
  92. Midrange/1.8V Min Devices
  93. ----------------
  94. PIC16F722 PIC16LF722
  95. PIC16F723 PIC16LF723 PIC16F724 PIC16LF724
  96. PIC16F726 PIC16LF726 PIC16F727 PIC16LF727
  97. PIC16F1933 PIC16F1934 PIC16F1936 PIC16F1937
  98. PIC16F1938 PIC16F1939
  99. PIC16LF1933 PIC16LF1934 PIC16LF1936 PIC16LF1937
  100. PIC16LF1938 PIC16LF1939
  101. PIC18F Devices
  102. --------------
  103. >> All 'LF' versions of devices are supported
  104. PIC18F242 PIC18F252 PIC18F442 PIC18F452
  105. PIC18F248 PIC18F258 PIC18F448 PIC18F458
  106. PIC18F1220 PIC18F1320 PIC18F2220
  107. PIC18F1230 PIC18F1330 PIC18F1330-ICD
  108. PIC18F2221 PIC18F2320 PIC18F2321 PIC18F2331
  109. PIC18F2410 PIC18F2420 PIC18F2423 PIC18F2431
  110. PIC18F2450 PIC18F2455 PIC18F2458 PIC18F2480
  111. PIC18F2510 PIC18F2515 PIC18F2520 PIC18F2523
  112. PIC18F2525 PIC18F2550 PIC18F2553 PIC18F2580
  113. PIC18F2585
  114. PIC18F2610 PIC18F2620 PIC18F2680 PIC18F2682
  115. PIC18F2685
  116. PIC18F4220 PIC18F4221 PIC18F4320 PIC18F4321
  117. PIC18F4331 PIC18F4410 PIC18F4420 PIC18F4423
  118. PIC18F4431 PIC18F4450 PIC18F4455 PIC18F4458
  119. PIC18F4480
  120. PIC18F4510 PIC18F4515 PIC18F4520 PIC18F4523
  121. PIC18F4525 PIC18F4550 PIC18F4553 PIC18F4580
  122. PIC18F4585
  123. PIC18F4610 PIC18F4620 PIC18F4680 PIC18F4682
  124. PIC18F4685 PIC18F6310 PIC18F6390 PIC18F6393
  125. PIC18F6410 PIC18F6490 PIC18F6493 PIC18F6520
  126. PIC18F6525 PIC18F6527
  127. PIC18F6585 PIC18F6620 PIC18F6621 PIC18F6622
  128. PIC18F6627 PIC18F6628 PIC18F6680 PIC18F6720
  129. PIC18F6722 PIC18F6723
  130. PIC18F8310 PIC18F8390 PIC18F8393 PIC18F8410
  131. PIC18F8490 PIC18F8493
  132. PIC18F8520 PIC18F8525 PIC18F8527 PIC18F8585
  133. PIC18F8620 PIC18F8621 PIC18F8622 PIC18F8627
  134. PIC18F8628
  135. PIC18F8680 PIC18F8720 PIC18F8722 PIC18F8723
  136. PIC18F_J_ Devices
  137. -----------------
  138. PIC18F24J10 PIC18LF24J10
  139. PIC18F24J11 PIC18LF24J11 PIC18F24J50 PIC18LF24J50
  140. PIC18F25J10 PIC18LF25J10
  141. PIC18F25J11 PIC18LF25J11 PIC18F25J50 PIC18LF25J50
  142. PIC18F26J11 PIC18LF26J11 PIC18F26J50 PIC18LF26J50
  143. PIC18F44J10 PIC18LF44J10
  144. PIC18F44J11 PIC18LF44J11 PIC18F44J50 PIC18LF44J50
  145. PIC18F45J10 PIC18LF45J10
  146. PIC18F45J11 PIC18LF45J11 PIC18F45J50 PIC18LF45J50
  147. PIC18F46J11 PIC18LF46J11 PIC18F46J50 PIC18LF46J50
  148. PIC18F63J11 PIC18F63J90 PIC18F64J11 PIC18F64J90
  149. PIC18F65J10 PIC18F65J11 PIC18F65J15 PIC18F65J50
  150. PIC18F65J90
  151. PIC18F66J10 PIC18F66J11 PIC18F66J15 PIC18F66J16
  152. PIC18F66J50 PIC18F66J55 PIC18F66J60 PIC18F66J65
  153. PIC18F66J90
  154. PIC18F67J10 PIC18F67J11 PIC18F67J50 PIC18F67J60
  155. PIC18F67J90
  156. PIC18F83J11 PIC18F83J90 PIC18F84J11 PIC18F84J90
  157. PIC18F85J10 PIC18F85J11 PIC18F85J15 PIC18F85J50
  158. PIC18F85J90
  159. PIC18F86J10 PIC18F86J11 PIC18F86J15 PIC18F86J16
  160. PIC18F86J50 PIC18F86J55 PIC18F86J60 PIC18F86J65
  161. PIC18F86J90
  162. PIC18F87J10 PIC18F87J11 PIC18F87J50 PIC18F87J60
  163. PIC18F87J90
  164. PIC18F96J60 PIC18F96J65 PIC18F97J60
  165. PIC18F_K_ Devices
  166. -----------------
  167. PIC18F13K22 PIC18LF13K22 PIC18F14K22 PIC18LF14K22
  168. PIC18F13K50 PIC18LF13K50 PIC18F14K50 PIC18LF14K50
  169. PIC18F14K50-ICD
  170. PIC18F23K20 PIC18F24K20 PIC18F25K20 PIC18F26K20
  171. PIC18F43K20 PIC18F44K20 PIC18F45K20 PIC18F46K20
  172. PIC24 Devices
  173. -------------
  174. PIC24FJ16GA002 PIC24FJ16GA004
  175. PIC24FJ32GA002 PIC24FJ32GA004
  176. PIC24FJ48GA002 PIC24FJ48GA004
  177. PIC24FJ64GA002 PIC24FJ64GA004
  178. PIC24FJ64GA006 PIC24FJ64GA008 PIC24FJ64GA010
  179. PIC24FJ96GA006 PIC24FJ96GA008 PIC24FJ96GA010
  180. PIC24FJ128GA006 PIC24FJ128GA008 PIC24FJ128GA010
  181. PIC24FJ128GA106 PIC24FJ128GA108 PIC24FJ128GA110
  182. PIC24FJ192GA106 PIC24FJ192GA108 PIC24FJ192GA110
  183. PIC24FJ256GA106 PIC24FJ256GA108 PIC24FJ256GA110
  184. PIC24FJ64GB106 PIC24FJ64GB108 PIC24FJ64GB110
  185. PIC24FJ128GB106 PIC24FJ128GB108 PIC24FJ128GB110
  186. PIC24FJ192GB106 PIC24FJ192GB108 PIC24FJ192GB110
  187. PIC24FJ256GB106 PIC24FJ256GB108 PIC24FJ256GB110
  188. PIC24HJ12GP201 PIC24HJ12GP202
  189. PIC24HJ16GP304
  190. PIC24HJ32GP202 PIC24HJ32GP204
  191. PIC24HJ32GP302 PIC24HJ32GP304
  192. PIC24HJ64GP202 PIC24HJ64GP204
  193. PIC24HJ64GP206 PIC24HJ64GP210
  194. PIC24HJ64GP502
  195. PIC24HJ64GP504 PIC24HJ64GP506 PIC24HJ64GP510
  196. PIC24HJ128GP202 PIC24HJ128GP204
  197. PIC24HJ128GP206 PIC24HJ128GP210
  198. PIC24HJ128GP306 PIC24HJ128GP310
  199. PIC24HJ128GP502 PIC24HJ128GP504
  200. PIC24HJ128GP506 PIC24HJ128GP510
  201. PIC24HJ256GP206 PIC24HJ256GP210 PIC24HJ256GP610
  202. dsPIC33 Devices
  203. ---------------
  204. dsPIC33FJ06GS101 dsPIC33FJ06GS102 dsPIC33FJ06GS202
  205. dsPIC33FJ16GS402 dsPIC33FJ16GS404
  206. dsPIC33FJ16GS502 dsPIC33FJ16GS504
  207. dsPIC33FJ12GP201 dsPIC33FJ12GP202
  208. dsPIC33FJ16GP304
  209. dsPIC33FJ32GP202 dsPIC33FJ32GP204
  210. dsPIC33FJ32GP302 dsPIC33FJ32GP304
  211. dsPIC33FJ64GP202 dsPIC33FJ64GP204
  212. dsPIC33FJ64GP206 dsPIC33FJ64GP306 dsPIC33FJ64GP310
  213. dsPIC33FJ64GP706 dsPIC33FJ64GP708 dsPIC33FJ64GP710
  214. dsPIC33FJ64GP802 dsPIC33FJ64GP804
  215. dsPIC33FJ128GP202 dsPIC33FJ128GP204
  216. dsPIC33FJ128GP206 dsPIC33FJ128GP306 dsPIC33FJ128GP310
  217. dsPIC33FJ128GP706 dsPIC33FJ128GP708 dsPIC33FJ128GP710
  218. dsPIC33FJ256GP506 dsPIC33FJ256GP510 dsPIC33FJ256GP710
  219. dsPIC33FJ128GP802 dsPIC33FJ128GP804
  220. dsPIC33FJ12MC201 dsPIC33FJ12MC202
  221. dsPIC33FJ16MC304
  222. dsPIC33FJ32MC202 dsPIC33FJ32MC204
  223. dsPIC33FJ32MC302 dsPIC33FJ32MC304
  224. dsPIC33FJ64MC202 dsPIC33FJ64MC204
  225. dsPIC33FJ64MC506 dsPIC33FJ64MC508 dsPIC33FJ64MC510
  226. dsPIC33FJ64MC706 dsPIC33FJ64MC710
  227. dsPIC33FJ64MC802 dsPIC33FJ64MC804
  228. dsPIC33FJ128MC202 dsPIC33FJ128MC204
  229. dsPIC33FJ128MC506 dsPIC33FJ128MC510 dsPIC33FJ128MC706
  230. dsPIC33FJ128MC708 dsPIC33FJ128MC710
  231. dsPIC33FJ256MC510 dsPIC33FJ256MC710
  232. dsPIC33FJ128MC802 dsPIC33FJ128MC804
  233. dsPIC30 Devices
  234. ---------------
  235. dsPIC30F2010 dsPIC30F2011 dsPIC30F2012
  236. dsPIC30F3010 dsPIC30F3011 dsPIC30F3012
  237. dsPIC30F3013 dsPIC30F3014
  238. dsPIC30F4011 dsPIC30F4012 dsPIC30F4013
  239. dsPIC30F5011^ dsPIC30F5013^ dsPIC30F5015
  240. dsPIC30F5016
  241. dsPIC30F6010A dsPIC30F6011A dsPIC30F6012A
  242. dsPIC30F6013A dsPIC30F6014A dsPIC30F6015
  243. ^ These 2 devices are not supported for low VDD programming.
  244. dsPIC30 SMPS Devices
  245. --------------------
  246. dsPIC30F1010
  247. dsPIC30F2020 dsPIC30F2023
  248. PIC32 Devices
  249. --------------------
  250. PIC32MX320F032H PIC32MX320F064H PIC32MX320F128L
  251. PIC32MX320F128H
  252. PIC32MX340F128H PIC32MX340F128L
  253. PIC32MX340F256H
  254. PIC32MX360F256L PIC32MX360F512L
  255. PIC32MX420F032H
  256. PIC32MX440F128L PIC32MX440F128H
  257. PIC32MX440F256H PIC32MX440F512H
  258. PIC32MX460F256L PIC32MX460F512L
  259. KEELOQ HCS Devices
  260. ------------------
  261. HCS200 HCS201 HCS300 HCS301 HCS320
  262. HCS360 HCS361 HCS362
  263. HCSxxx File -> Import HEx Notes:
  264. The first line only may be imported from SQTP
  265. *.NUM files generated by the KEELOQ tool in
  266. MPLAB.
  267. Connections for HCS devices
  268. ---------------------------------------
  269. PICkit 2 Pin HCS Device Pin
  270. (2) Vdd 8
  271. (3) GND 5
  272. (5) PGC /3 HCS20x, 320
  273. \3 -or- 4 HCS30x, 36x
  274. (4) PGD 6
  275. (1) VPP 2 HCS360, 361 only
  276. MCP250xx CAN Devices
  277. --------------------
  278. MCP25020 MCP25025
  279. MCP25050 MCP25055
  280. !!IMPORTANT!! - MCP250xx devices are OTP and can only be
  281. programmed once.
  282. Connections for MCP250xx devices
  283. ---------------------------------------
  284. PICkit 2 Pin MCP Device Pin (DIP)
  285. (1) Vpp 11 Vpp
  286. (2) Vdd 14 VDD
  287. - The MCP device MUST be powered from PICkit 2!
  288. (3) GND 7 Vss
  289. (4) PGD 5 DATA
  290. (5) PGC 6 CLOCK
  291. Serial EEPROM Devices
  292. ---------------------
  293. NOTE: Other supported voltage grades are listed in parentheses
  294. next to the device. Select the "LC" part number to program
  295. these other voltage grades.
  296. 11LC010 (AA)
  297. 11LC020 (AA)
  298. 11LC040 (AA)
  299. 11LC080 (AA)
  300. 11LC160 (AA)
  301. 24LC00 (AA)(C) 25LC010A (AA)
  302. 24LC01B (AA) 25LC020A (AA)
  303. 24LC02B (AA) 25LC040A (AA)
  304. 24LC04B (AA) 25LC080A (AA)
  305. 24LC08B (AA) 25LC080B (AA)
  306. 24LC16B (AA) 25LC160A (AA)
  307. 24LC32A (AA) 25LC160B (AA)
  308. 24LC64 (AA)(FC) 25LC320A (AA)
  309. 24LC128 (AA)(FC) 25LC640A (AA)
  310. 24LC256 (AA)(FC) 25LC128 (AA)
  311. 24LC512 (AA)(FC) 25LC256 (AA)
  312. 24LC1025 (AA)(FC) 25LC512 (AA)
  313. 25LC1024 (AA)
  314. 93LC46A/B/C (AA)(-C)
  315. 93LC56A/B/C (AA)(-C)
  316. 93LC66A/B/C (AA)(-C)
  317. 93LC76A/B/C (AA)(-C)
  318. 93LC86A/B/C (AA)(-C)
  319. Connections for 11LC devices
  320. ---------------------------------------
  321. PICkit 2 Pin 11LC Device Pin (DIP)
  322. (2) Vdd ! 8 Vcc
  323. (3) GND 4 Vss
  324. (6) AUX 5 SCIO
  325. ! 11LC devices may not program properly below 3.6V VDD.
  326. This is a limitation of the PICkit 2 AUX IO pin.
  327. Connections for 24LC devices
  328. ---------------------------------------
  329. PICkit 2 Pin 24LC Device Pin (DIP)
  330. (2) Vdd ! 8 Vcc
  331. (3) GND 4 Vss
  332. (5) PGC 6 SCL (driven as push-pull)
  333. (6) AUX 5 SDA (requires pullup)
  334. 7 WP - disabled (GND)
  335. 1, 2, 3 Ax pins
  336. Connect to Vdd or GND per
  337. datasheet and to set address
  338. ! 24LC devices may not program properly below 3.6V VDD.
  339. This is a limitation of the PICkit 2 AUX IO pin.
  340. Connections for 25LC devices
  341. ---------------------------------------
  342. PICkit 2 Pin 25LC Device Pin (DIP)
  343. (1) VPP 1 nCS
  344. (2) Vdd 8 Vcc
  345. (3) GND 4 Vss
  346. (4) PGD 2 SO
  347. (5) PGC 6 SCK
  348. (6) AUX 5 SI
  349. 7 nHOLD - disabled (Vdd)
  350. 3 nWP - disabled (Vdd)
  351. Connections for 93LC devices
  352. ---------------------------------------
  353. PICkit 2 Pin 93LC Device Pin (DIP)
  354. (1) VPP 1 CS
  355. (2) Vdd 8 Vcc
  356. (3) GND 5 Vss
  357. (4) PGD 4 DO
  358. (5) PGC 2 CLK
  359. (6) AUX 3 DI
  360. 7 PE - enabled (Vdd)
  361. 6 'C' Device ORG
  362. Set to select word size
  363. ----------------------------------------------------------------------------
  364. 3. Operating System Support List (Tested)
  365. ----------------------------------------------------------------------------
  366. The pk2cmd binary for kernel 2.6 was built on CentOS 4.7 (RHEL 4.7). It has
  367. been tested on the following systems:
  368. CentOS 4.7
  369. CentOS 5.1
  370. Ubuntu 6.06
  371. Ubuntu 7.10
  372. Ubuntu 8.04
  373. Ubuntu 8.10
  374. Fedora Core 6
  375. Fedora 9.
  376. It is recommended that you build a binary from the source code. The source
  377. code is downloadable from the Microchip PICkit 2 webpage, and includes build
  378. and installation instructions:
  379. www.microchip.com/pickit2
  380. ----------------------------------------------------------------------------
  381. 4. What's New or Updated
  382. ----------------------------------------------------------------------------
  383. >>> Version 1.20 <<<
  384. NEW FEATURES:
  385. - Faster PIC24, dsPIC33 programming
  386. PIC24 and dsPIC33 devices now use a Programming Executive (aka Enhanced
  387. ICSP) for faster programming. The -Q option may be used to disable use
  388. of the PE, and revert programming to basic ICSP. The PIC24H/dsPIC33
  389. Device ID corruption workaround is implemeted when using the PE.
  390. ** NOTE: Using the PE may fail on certain programming ports of 44-pin
  391. devices, especially PGC3/PGD3. If an error is frequently
  392. encountered, try another port or use -Q to disable the PE.
  393. -?P New Help Command
  394. The help command -?P will list all supported devices in the current
  395. device file, along with the device's family. Optionally, a string
  396. may be specified to search for devices beginning with the string.
  397. For example, -?PPIC16 will list all devices supported by the current
  398. device file beginning with "PIC16".
  399. -P Command with Auto-Detect
  400. The -P command can now be used for auto detection of most microcontroller
  401. devices. Note that not all supported parts can be auto detected.
  402. See the online command help (-p?) for more information. A new return
  403. code AUTODETECT_FAILED may be returned when using auto detection.
  404. (See section 11.)
  405. ** NOTE: For integration with GUIs or other software, to avoid damage
  406. to parts by VPP voltage levels above that rated for the part
  407. the recommended method for auto detection is:
  408. A) Get and cache a list of supported devices and families with
  409. -?P
  410. B) Get and cache a list of auto detectable families and IDs
  411. with -PF
  412. c) Use A and B to determine the family ID for a given part.
  413. Auto detect this part using -PFn where n is the family ID.
  414. -J New Command
  415. The new -J option will display the percentage operation complete instead
  416. of a rotating slash for Write, Verify, Read, and Blank Check operations.
  417. -L New Command
  418. The -L option allows the ICSP programming clock rate to be changed
  419. (slowed). This can increase programming times but allow programming to
  420. work on heavily loaded ICSP signals or with longer cables that are
  421. otherwise intermittent or fail. Using -L is similar to disabling the
  422. "Fast Programming" option in the PICkit 2 Programmer GUI software.
  423. -B New Command
  424. The -B command allows the path to the device file PK2DeviceFile.dat
  425. to be specified on the command line. See -B? for more information.
  426. -I shows device name
  427. The -I command now displays the device name associated with the read
  428. Device ID, and warns if it is different from the selected device.
  429. - Binary file import / export
  430. For serial EEPROM devices only, binary format files may be loaded with
  431. -F for programming or read to with -GF. See the online help for these
  432. commands, -F? and -G?.
  433. - Faster Writes of PIC18F6xJxx and PIC18F8xJxx devices.
  434. BUG FIXES:
  435. - Fixed an issue that could cause verify or read lockups with certain USB
  436. chipsets, that often affected Apple MacOS machines.
  437. - PIC32 PE (Programming Executive) updated to fix programming problems with
  438. some devices.
  439. - A bug in previous versions caused serial EEPROM devices to not be verified
  440. during programming with -M. Serial EEPROMs are now properly verified
  441. on a -M command.
  442. - When no -T command is specified, PK2CMD will always exit with VDD off if
  443. a -P command is present.
  444. - When no -R command is specified, PK2CMD will always exit with MCLR on if
  445. a -P command is present.
  446. - An issue with displaying 14 character or longer Unit IDs was corrected.
  447. Unit ID length is now limited to 14 characters with -N.
  448. - Baseline device checksums are now computed correctly (matching MPLAB) when
  449. Code Protect is enabled.
  450. - PK2CMD now supports Device Files with more than 500 parts properly.
  451. - Fixed an issue with -GF file names being created with an extraneous space
  452. at the end in some cases.
  453. >>> Version 1.12 <<<<
  454. Bug fix for "-s" option allows simultaneous operation of multiple instances
  455. of PK2CMD and multiple PICkit 2 units.
  456. Changes to "-s" option:
  457. See online help "pk2cmd -s?"
  458. Bug fix for PIC32 programming with blank boot flash.
  459. Requires OS firmware v2.32.00 or later
  460. >>> Version 1.10 <<<<
  461. -N option for assigning a Unit ID string to a PICkit 2 unit.
  462. Support for multiple PICkit 2 units with 1 PC:
  463. -S option to list all connected PICkit 2 units, or to select a particular
  464. unit for use by the Unit ID.
  465. -M or -MP commands will only verify the programmed portions of Program
  466. Memory to reduce total programming time. (This does not apply to
  467. verification with -Y or -YP)
  468. PIC18 J-Series and PIC24FJ devices have updated handling of Configuration
  469. words to match MPLAB IDE and PICkit 2 Programmer v2.5x
  470. New support for PIC32, 11LCxxx, and MCP250xx devices.
  471. Now allows spacing between command options and parameters.
  472. Ex: -pPIC16F887 and -p PIC16F887 are both valid.
  473. For -GP and -GE option types, spaces are not allowed in the address ranges.
  474. EX:
  475. Supported: -G P 0-F, -GP0-F, -G P0-F, -GP 0-F
  476. Not Supported: -G P 0 - F, -GP0 -F, -GP0- F, or other combinations with
  477. spaces in the range
  478. ----------------------------------------------------------------------
  479. 5. Known Problems
  480. ----------------------------------------------------------------------
  481. When using option "-s" to list PICkit 2 units, it will display units
  482. with firmware older than v2.30.00 as being in the bootloader with
  483. a Unit ID of <bootloader>.
  484. Use "-s#" to accurately list units with older firmware distinctly from
  485. units in the bootloader.
  486. The Programming Executive (PE) support for PIC24 and dsPIC33 devices may not
  487. work with some programming ports (PGx3 usually) on some 44-Pin devices. If
  488. errors are frequently encountered, try using a different programming port or
  489. using -Q to disable the PE. Parts that may have this issue include but are
  490. not limited to:
  491. PIC24HJ16GP304, PIC24HJ32GP204
  492. dsPIC33FJ16GP304, dsPIC33FJ32GP204, dsPIC33FJ16MC304, dsPIC33FJ32MC204
  493. ----------------------------------------------------------------------------
  494. 6. Important Notes
  495. ----------------------------------------------------------------------------
  496. -------------------------
  497. Note on -R and -T options
  498. -------------------------
  499. Four different cases requiring different uses of -R and -T to run after
  500. programming:
  501. 1) MCU is externally powered, and MCLR pin is configured as IO.
  502. Switches needed to run after programming: NONE
  503. 2) MCU is externally powered, and MCLR pin is configured as MCLR
  504. Switches needed to run after programming: -R
  505. 3) MCU needs to be powered from PICkit 2, MCLR configured as IO.
  506. Switches needed to run after programming : -T
  507. 4) MCU needs to be powered from PICkit 2, MCLR configured as MCLR.
  508. Switches needed to run after programming: -R -T
  509. ----------------------------------------------------------------------------
  510. 7. Installation
  511. ----------------------------------------------------------------------------
  512. It is recommended that you build a binary from the source code. The source
  513. code is downloadable from the Microchip PICkit 2 webpage, and includes build
  514. and installation instructions:
  515. www.microchip.com/pickit2
  516. After building run "make install" as root (using 'su' or 'sudo'). See below
  517. for manual installation.
  518. The method to run pk2cmd as a normal user (not root) depends on your
  519. particular Linux distribution. Please consult your Linux distribution
  520. documentation or use the support option as detailed in Section 12 of this
  521. documentation if you can not get it to work.
  522. Please read the file 'usbhotplug.txt' before installing pk2cmd. It explains
  523. how to set up USB udev or hotplug rules so pk2cmd can be run in user mode.
  524. You will need libusb runtime to run pk2cmd. Typical linux distros will have
  525. libusb-0.1 package installed already, so no additonal installation is
  526. needed. If not, use your linux distro's package management software to
  527. install it (typically named libusb).
  528. If you are running a very old Linux version which only includes an older
  529. version of libusb (older than 0.1.10), then it is better you install
  530. libusb-0.1 from the website below. In this case, you will have both the
  531. runtime library and the development package installed in the same time.
  532. You can download libusb-0.1 from http://libusb.sourceforge.net. See the
  533. README and INSTALL files for instructions on how to install libusb on your
  534. system.
  535. The following describes manual installation, including for using a pre-built
  536. binary:
  537. As root (using 'su' or 'sudo'), copy the file pk2cmd to /usr/local/bin and
  538. the file PK2DeviceFile.dat to /usr/share/pk2.
  539. Your user PATH environment variable should include /usr/share/pk2. If using
  540. bash, edit the file .bashrc to include:
  541. PATH=$PATH:/usr/share/pk2
  542. export PATH
  543. Other command line interfaces should have a similar mechanism for setting
  544. your PATH variable.
  545. If you continue to have problems with pk2cmd not finding PK2DeviceFile.dat,
  546. try copying the dat file to /usr/local/bin manually as a last resort.
  547. Optionally, the path to the device file may be explicitly specified on the
  548. command line using option -b (-B).
  549. ----------------------------------------------------------------------------
  550. 8. Upgrading the PICkit 2 Operating System
  551. ----------------------------------------------------------------------------
  552. If the executable detects an incompatible OS, an updated operating system
  553. may be downloaded using the -D command line option. The latest OS firmware
  554. can be downloaded from the PICkit 2 webpage at www.microchip.com/pickit2
  555. ----------------------------------------------------------------------------
  556. 9. Command Line Options
  557. ----------------------------------------------------------------------------
  558. The following commands are available in the command line interface.
  559. PICkit 2 COMMAND LINE HELP
  560. Options Description Default
  561. ----------------------------------------------------------------------------
  562. A<value> Set Vdd voltage Device Specific
  563. B<path> Specify the path to PK2DeviceFile.dat Searches PATH
  564. and calling dir
  565. C Blank Check Device No Blank Check
  566. D<file> OS Download None
  567. E Erase Flash Device Do Not Erase
  568. F<file> Hex File Selection None
  569. G<Type><range/path> Read functions None
  570. Type F: = read into hex file,
  571. path = full file path,
  572. range is not used
  573. Types P,E,I,C: = ouput read of Program,
  574. EEPROM, ID and/or Configuration
  575. Memory to the screen. P and E
  576. must be followed by an address
  577. range in the form of x-y where
  578. x is the start address and y is
  579. the end address both in hex,
  580. path is not used
  581. (Serial EEPROM memory is 'P')
  582. H<value> Delay before Exit Exit immediately
  583. K = Wait on keypress before exit
  584. 1 to 9 = Wait <value> seconds
  585. before exit
  586. I Display Device ID & silicon revision Do Not Display
  587. J<newlines> Display operation percent complete Rotating slash
  588. N = Each update on newline
  589. K Display Hex File Checksum Do Not Display
  590. L<rate> Set programming speed Fastest
  591. <rate> is a value of 1-16, with 1 being
  592. the fastest.
  593. M<memory region> Program Device Do Not Program
  594. memory regions:
  595. P = Program memory
  596. E = EEPROM
  597. I = ID memory
  598. C = Configuration memory
  599. If no region is entered, the entire
  600. device will be erased & programmed.
  601. If a region is entered, no erase
  602. is performed and only the given
  603. region is programmed.
  604. All programmed regions are verified.
  605. (serial EEPROM memory is 'P')
  606. N<string> Assign Unit ID string to first found None
  607. PICkit 2 unit. String is limited to 14
  608. characters maximum. May not be used
  609. with other options.
  610. Example: -NLab1B
  611. P<part> Part Selection. Example: -PPIC16f887 (Required)
  612. P Auto-Detect in all detectable families
  613. PF List auto-detectable part families
  614. PF<id> Auto-Detect only within the given part
  615. family, using the ID listed with -PF
  616. Example: -PF2
  617. Q Disable PE for PIC24/dsPIC33 devices Use PE
  618. R Release /MCLR after operations Assert /MCLR
  619. S<string/#> Use the PICkit 2 with the given Unit ID First found unit
  620. string. Useful when multiple PICkit 2
  621. units are connected.
  622. Example: -SLab1B
  623. If no <string> is entered, then the
  624. Unit IDs of all connected units will be
  625. displayed. In this case, all other
  626. options are ignored. -S# will list units
  627. with their firmware versions.
  628. See help -s? for more info.
  629. T Power Target after operations Vdd off
  630. U<value> Program OSCCAL memory, where: Do Not Program
  631. <value> is a hexidecimal number
  632. representing the OSCCAL value to be
  633. programmed. This may only be used in
  634. conjunction with a programming
  635. operation.
  636. V<value> Vpp override Device Specific
  637. W Externally power target Power from Pk2
  638. X Use VPP first Program Entry Method VDD first
  639. Y<memory region> Verify Device Do Not Verify
  640. P = Program memory
  641. E = EEPROM
  642. I = ID memory
  643. C = Configuration memory
  644. If no region is entered, the entire
  645. device will be verified.
  646. (Serial EEPROM memory is 'P')
  647. Z Preserve EEData on Program Do Not Preserve
  648. ? Help Screen Not Shown
  649. Each option must be immediately preceeded by a switch, Which can
  650. be either a dash <-> or a slash </> and options must be separated
  651. by a single space.
  652. Example: PK2CMD /PPIC16F887 /Fc:\mycode /M
  653. or
  654. PK2CMD -PPIC16F887 -Fc:\mycode -M
  655. Any option immediately followed by a question mark will invoke
  656. a more detailed description of how to use that option.
  657. Commands and their parameters are not case sensitive. Commands will
  658. be processed according to command order of precedence, not the order
  659. in which they appear on the command line.
  660. Precedence:
  661. -? (first)
  662. -B
  663. -S
  664. -D
  665. -N
  666. -P
  667. -A -F -J -L -Q -V -W -X -Z
  668. -C
  669. -U
  670. -E
  671. -M
  672. -Y
  673. -G
  674. -I -K
  675. -R -T
  676. -H (last)
  677. The program will return an exit code upon completion which will
  678. indicate either successful completion, or describe the reason for
  679. failure. To view the list of exit codes and their descriptions,
  680. type -?E on the command line.
  681. type -?V on the command line for version information.
  682. type -?L on the command line for license information.
  683. type -?P on the command line for a listing of supported devices.
  684. type -?P<string> to search for and display a list of supported devices
  685. beginning with <string>.
  686. ----------------------------------------------------------------------------
  687. 10. Command Line Examples
  688. ----------------------------------------------------------------------------
  689. COMMAND LINE
  690. OPERATION PERFORMED
  691. -----------------------------------------------------------------------------
  692. PK2CMD /?
  693. Help screen displayed.
  694. PK2CMD /?E
  695. All eXit (error) codes displayed.
  696. PK2CMD /?V
  697. Display version information for the PK2CMD executable, PK2DeviceFile.dat,
  698. and the OS firmware of the connected PICkit 2 programmer.
  699. PK2CMD /M?
  700. Help for the /M option displayed.
  701. PK2CMD /DPK2V022000.hex
  702. Firmware file PK2V022000.hex downloaded to PICkit 2
  703. PK2CMD /PPIC16F887 /FC:\PROJECT\PROGRAM.HEX /MP
  704. PICkit 2 set to a PIC16F887. Vdd and Vpp set to the device's
  705. default value. File PROGRAM.HEX is loaded. The device's
  706. program memory is programmed, with blank values
  707. in the locations not specified by PROGRAM.HEX. NOTE that
  708. the program memory is NOT erased first.
  709. PK2CMD /PPIC16F887 /FC:\PROJECT\PROGRAM.HEX /M -A3.3
  710. PICkit 2 set to a PIC16F887. Vdd is set to 3.3 Volts and
  711. Vpp set to the device's default value. File PROGRAM.HEX
  712. is loaded. The entire device is programmed, with blank values
  713. in the locations not specified by PROGRAM.HEX. NOTE that
  714. the entire device is erased before programming.
  715. PK2CMD /PdsPIC30F6014A /FC:\PROJECT\HEXCODE.HEX /Y
  716. PICkit 2 set to a dsPIC30F6014A. Voltages are set
  717. to the device's default values. The device is verified
  718. against the contents of HEXCODE.HEX.
  719. NOTE that any programming operation -M<> verifies the
  720. data programmed automatically.
  721. PK2CMD /PdsPIC30F6014A /FC:\PROJECT\HEXCODE.HEX /M /Y
  722. PICkit 2 set to a dsPIC30F6014A. The file HEXCODE.HEX
  723. is loaded. Voltages are set to the device's default
  724. values and the device is programmed.
  725. After programming, the device is verified against the
  726. contents of HEXCODE.HEX.
  727. Note: The Program (/M) operation implicitly performs a
  728. Verify when it completes the programming portion of the
  729. operation. Specifying a Verify (/Y) in the above manner
  730. effectively causes two Verify operations to be performed.
  731. PK2CMD /P18F4220 /FC:\PROJECT\APPCODE.HEX /Z /M
  732. PICkit 2 is set to a P18F4220. The file APPCODE.HEX is
  733. loaded. Voltages are set to the device's default values.
  734. All of the device's memory is programmed, with blank values
  735. in the locations not specified by APPCODE.HEX.
  736. The /z switch specifies PICkit 2 to preserve EEData.
  737. PK2CMD /P18F4220 /FC:\PROJECT\APPCODE.HEX /E /ME
  738. PICkit 2 is set to a P18F4220. The file APPCODE.HEX is
  739. loaded. Voltages are set to the device's default values.
  740. All of the device's memory is erased before the device's
  741. Program Memory is programmed, with blank values in the
  742. locations not specified by APPCODE.HEX.
  743. PK2CMD /P24LC128 /GP0-FF
  744. PICkit 2 is set to a 24LC128 serial EEPROM. Voltages are
  745. set to the device's default values. Device memory from
  746. location 0x00 to 0xFF is displayed.
  747. PK2CMD /P24LC128 /GFC:\PROJECT\EEVALUES.HEX
  748. PICkit 2 is set to a 24LC128 serial EEPROM. Voltages are
  749. set to the device's default values. The entire Device
  750. memory is read and saved in the hex file EEVALUES.HEX
  751. at the given path.
  752. PK2CMD /SLab1A /P24LC128 /GP0-FF
  753. The PICkit 2 with Unit ID "Lab1A" is set to a 24LC128
  754. serial EEPROM. Voltages are set to the device's default
  755. values. Device memory from location 0x00 to 0xFF is
  756. displayed from the serial EEPROM connected to this
  757. particular PICkit 2 unit.
  758. Notes
  759. -----
  760. If downloading firmware, all other commands are ignored.
  761. Firmware cannot be downloaded if more than 1 PICkit 2 unit
  762. is connected to the PC.
  763. If assigning a Unit ID using -N, all other commands are
  764. ignored.
  765. If displaying all available PICkit 2 units (-S), all other
  766. commands are ignored.
  767. Use -S with a string parameter, to execute the operations
  768. on one of several PICkit 2 units with the Unit ID matching
  769. the string paramter.
  770. A device (-P) must be specified for any PICkit 2 operation,
  771. unless an auto detect method is used.
  772. It is necessary to load a hex file every time a device
  773. is programmed.
  774. All values not specified in the hex file are set to blank
  775. (erased) values.
  776. Some Midrange, PIC18F, and dsPIC30F parts require a row-erase
  777. procedure to erase the chip at Vdd < 4.5 Volts. This will be
  778. done automatically if the selected device supports this function
  779. and the Vdd setpoint or detected target Vdd is below 4.5V.
  780. A warning will be issued for devices that only support bulk erases
  781. at Vdd >= 4.5 Volts if an erase is attempted at a lower voltage.
  782. The PICkit 2 VDD and VPP voltages can be calibrated using the
  783. PICkit 2 Programmer GUI application. The calibration will
  784. remain valid when used with PK2CMD on the same USB port.
  785. ----------------------------------------------------------------------------
  786. 11. Return Codes
  787. ----------------------------------------------------------------------------
  788. Value Code Notes
  789. ----- ---- -----
  790. 0 OPSUCCESS Returned if all selected operations complete
  791. successfully.
  792. 5 VOLTAGE_ERROR A Vdd and/or Vpp voltage error was detected.
  793. This could be due to PICkit 2 being
  794. improperly connected to a part, incorrect
  795. part selection, or interference from other
  796. circuitry on the target board.
  797. 7 OPFAILURE Returned if an operation fails and a more
  798. specific error does not exist.
  799. 10 NO_PROGRAMMER The PK2CMD executable is unable to find a
  800. connected PICkit 2 programmer.
  801. 11 WRONG_OS Returned if the OS firmware must be updated
  802. before being used with this version of
  803. PK2CMD.
  804. 15 FILE_OPEN_ERROR Returned if a file specified for reading to
  805. (-gf...) cannot be opened for writing.
  806. 24 DEVICEFILE_ERROR The PK2CMD executable cannot find the device
  807. file PK2DeviceFile.dat or the device file
  808. may be corrupted.
  809. 28 UPDGRADE_ERROR Returned when an OS firmware upgade (-d...)
  810. fails.
  811. 34 PGMVFY_ERROR Returned if a program or verify operation
  812. fails.
  813. 36 INVALID_CMDLINE_ARG A syntax error in a command line argument
  814. was detected, an invalid combination of
  815. operations was entered, an invalid value was
  816. entered, or a memory region was selected
  817. that is not supported by the current device.
  818. 37 INVALID_HEXFILE Error opening or loading a specified hex
  819. file (-f...).
  820. 39 AUTODETECT_FAILED A part autodetect operation failed to find
  821. a known part.
  822. ----------------------------------------------------------------------------
  823. 12. Customer Support
  824. ----------------------------------------------------------------------------
  825. This unsupported software is provided for the convenience of Microchip
  826. customers and solely for use with Microchip products. This software and all
  827. accompanying documentation is provided "as is" and may be downloaded and
  828. used at your own risk.
  829. Microchip does not offer any support related to the use of this software or
  830. information.
  831. You may be able to obtain assistance from other users of the software on the
  832. Microchip web forums at:
  833. http://forum.microchip.com
  834. Suggested forums for posting about this software are the following:
  835. [Development Tools] "Linux, Open Source Projects and Other Topics"
  836. http://forum.microchip.com/tt.aspx?forumid=182
  837. [Development Tools] "Programmers (MPLAB PM3, PICSTART Plus, PICkit 2)"
  838. http://forum.microchip.com/tt.aspx?forumid=15
  839. Additional help may be obtained from the Pickit Developers mailing list:
  840. pickit-devel@googlegroups.com