PICP Users Manual
Linux (and Windows) Interface to PICSTART Plus, Warp-13, JuPic, and Olimex programmers


Copyright 2004-2006 by Jeffery L. Post
Version 0.6.8 - July, 2006
GNU General Public License


TABLE OF CONTENTS




Introduction



Picp is a Linux (and Windows) command line interface to Microchip's PICSTART Plus, Newfound Electronic's Warp-13, JuPic, and Olimex PIC programmers. Originally written by Andrew Pines, picp is now maintained by Jeff Post. The latest version can be downloaded from my picmicro website.

Thanks to Jim Robertson of Newfound Electronics, who generously donated a Warp-13a programmer and technical advice so that picp would work with both the Warp-13 and PICSTART Plus programmers.

Thanks also to Adam Jurkiewicz, who donated a JuPic programmer for testing. JuPic is an excellent replacement for the Warp-13 programmer (which is no longer being sold). And thanks to Mark Stanley who donated an Olimex programmer.

Picp is licensed under the GNU General Public License.




Command Line Interface



Usage:
    picp [-c] [-d] [-v] ttyname devtype [-i] [-h] [-q] [-v] [-s [size]] [-b|-r|-w|-e][pcidof]
where:
   ttyname is the serial (or USB) device the PICSTART or Warp-13 is attached to
      (e.g. /dev/ttyS0 or com1)
   devtype is the pic device to be used (12C508, 16C505, etc.)
      -b blank checks the requested region or regions
      -c enable comm line debug output to picpcomm.log (must be before ttyname)
      -d (if only parameter) show device list
      -e erases the requested region (flash parts only)
      -f ignores verify errors while writing
      -h show this help
      -i use ISP protocol (must be first option after devtype)
      -q sets quiet mode (excess messages supressed)
      -r initiates a read (Intel Hex record format)
      -s [size] shows a hash mark status bar of length [size] while erasing/writing
      -w writes to the requested region
          -wpx will suppress actual writing to program space (for debugging picp)
      -v shows PICSTART Plus version number
      -v (if only parameter) show picp version number
   Read/Write/Erase parameters:
      p [filename] = program memory, optionally reading/writing filename
      c [val] = configuration bits (val is a numeric word value when writing)
      i [val] = ID locations
      d [filename] = data memory, optionally reading/writing filename
      o [val] = oscillator calibration space
      f = entire flash device (only applies to -e, erase)
   filename is an optional input or output file (default is stdin/stdout)


Example:

    picp -c /dev/ttyS1 16f84 -wp widget.hex

Programs a 16F84 device with the program in the file widget.hex using the ttyS1 serial port, and writes comm line debug information in the file picpcomm.log.

*The -i option causes picp to use a slightly different protocol for communicating with the Warp-13 programmer when programming 18fxxx chips connected to the ISP port of the Warp-13. This appears to be necessary only when using BluePole firmware version 1.5. Use this option only if you experience problems without it.

Back to top





Comm Protocol



This is a summary of the Picstart Plus (Warp-13) protocol known as of July, 2004. This information is the result of tests performed by Andrew Pines, Gabor Kiss, and Jeff Post. It is believed to be accurate, but there are no guarantees.

-> shows data from the computer to the PIC programmer.
<- shows data from the PIC programmer to the computer.
... means a repetition.


-------------------------------------------------------------------------------
Picstart Plus commands in numerical order:
(Only those with a name, eg CMD_BLANK_CHECK, are used by picp)




CMD_BLANK_CHECK 'B'
0x42->Blank check full
<-0x42
<-status


0x43->Diagnostics
<-0xdd
subcode->
<-echo


0x44->Blank check partial
<-0x44
<-status


CMD_WRITE_PGM 'Q'
0x51->Write program
<-0x51
word to write->
<-word read back
...
<-status


CMD_READ_PGM 'T'
0x54->Read program
<-0x54
<-word read
...
<-status


CMD_READ_OSC 'c'
0x63->Read calibration values
<-0x63
<-word read
...
<-status


CMD_READ_DATA 'd'
0x64->Read data
<-0x64
<-byte read
...
<-status


CMD_READ_ID 'e'
0x65->Read ID
<-0x65
<-word read
...
<-status


CMD_READ_CFG 'f'
0x66->Read config
<-0x66
<-word read
...
<-status


CMD_WRITE_CFG 'g'
0x67->Write config
<-0x67
word to write->
<-each word echoed back
...
<-status


CMD_WRITE_ID 'h'
0x68->Write ID
<-0x68
word to write->
<-word read back
...
<-status


CMD_WRITE_DATA 'i'
0x69->Write data
<-0x69
byte to write->
<-byte read back
...
<-status


CMD_WRITE_CFG_WORD 'p'
0x70->Write one config word
<-0x70
word to write->
<-word read back
<-status
(For 18xxx chips only. Each word must be preceeded by 'set range'.)



CMD_WRITE_OSC 'q'
0x71->Write calibration values
<-0x71
word to write->
<-word read back
...
<-status


0x80->Get processor info length
<-0x80
<-0x2c (44)


CMD_LOAD_INFO
0x81->Load processor info
<-0x81
44 bytes->
chksum->
<-status


CMD_LOAD_EXT_INFO
0x82->Load extended config masks
<-0x82
8+8 words->
chksum->
<-status


CMD_REQUEST_MODEL
0x88->Ping
<-0xab response identifying PS+/Warp-13/JuPic


CMD_REQUEST_VERSION
0x8d->Get version
<-0x8d
<-major
<-middle
<-minor


CMD_SET_ADDR
0x8e->Set range
<-0x8e
5 bytes->send each byte
<-each byte echoed
...


CMD_ERASE_FLASH
0x8f->Erase flash device
<-0x8f
<-status


0x90->Compute program checksum
<-0x90
<-checksum_h
<-checksum_l
<-status


0x91->Compute config checksum
<-0x91
<-checksum_h
<-checksum_l
<-status


0x92->Compute ID checksum
<-0x92
<-checksum_h
<-checksum_l
<-status


0x93->Compute data checksum
<-0x93
<-checksum_h
<-checksum_l
<-status


0x94->Compute cal checksum
<-0x94
<-checksum_h
<-checksum_l
<-status



Back to top



PIC Device Configuration File



Beginning with version 0.6.8, picp no longer compiles in the PIC definition data from the file picdev.c. The PIC definition data is now read in at runtime from a file called picdevrc. This allows users to add new PIC device types without having to recompile the source code. The picdevrc file contains the PIC definition data in ascii, so it can be modified with any text editor. Picp will try to find picdevrc in the current directory, and if not found there, will look for it in /usr/local/bin (Linux) or c:\Program Files\picp (Windows).

The format of picdevrc entries may be either a short (default) form for a smaller file, or a long form that includes information more meaningful to humans. Picp will process either type.

Example picdevrc entry for 16F84 (default form):

[16F84]
00000000
00000000
PICSTART WARP JUPIC


[16F84:def]
04003fff3fff007f
007f3fff3fff00ff
00ff000000000000
0001200004200701
0000004000000000
0301020f


[16F84:defx]
3fff000000000000
0000000000000000
3fff000000000000
0000000000000000



Example picdevrc entry for 16F84 (long form):

[16F84]       ; pic definition
0; config word: code protect bit mask
0; config word: watchdog bit mask
0; Word alignment for writing to this device
0; Configuration memory start address
0 0; ID Locations addr and size
0; Data eeprom address
0; number of words in cfg bits with factory set bits
0 0 0 0 0 0 0 0; fixed bits mask
PICSTART WARP JUPIC; bit map of supporting programmers

[16F84:def]
04 00       ; size of program space
3f ff; width of address word
3f ff; width of data word
00 7f; width of ID
00 7f; ID mask
3f ff; width of configuration word
3f ff; configuration word mask
00 ff; EEPROM data width
00 ff; EEPROM data mask
00 00; Calibration width
00 00; Calibration mask
00 00; ??
00 01; ??
20 00; address of ID locations
04; size of ID locations
20 07; address of configuration bits
01; size of configuration register
00 00; address of data space
00 40; size of data space
00 00; address of internal clock calibration value
00 00; size of clock calibration space
03; additional programming pulses for C devices
01; main programming pulses for C devices
02 0f; ?? ZIF configuration ??

[16F84:defx]
3fff0000
00000000
00000000
00000000
3fff0000
00000000
00000000
00000000




Known Issues




Erase program (-ep) does not work with most PIC devices. Use -ef (erase flash) instead.

Some data in picdev.c is known to be incorrect (but what the correct data should be is not known). Many entries in picdev have been sent to me by users, but I don't always have the corresponding PIC devices with which to test them. If you find a problem with a particular PIC chip, please let me know.

Support for 18Fxxx devices has been tested only with 18F458 and 18F252 chips. Bug reports regarding 18Fxxx chips will be greatly appreciated. Please email a zip or gz file with the picpcomm.log file and any other information relevant to the problems you find.

Support for some 10Fxxx devices has been added, but is only partially tested at this time.

Many functions have still not been implemented. Work is continuing on these issues.

Please send bug reports and feature wish lists to  'j_post <AT> pacbell <DOT> net'. Comments on this documentation are also appreciated.

Back to top