==== Pickle Microchip PIC ICSP ====
{{:projects:pickle:dspic-soic.jpg?200|Pi Zero programming dsPIC33EP}}
Pickle is an PICMicro in-circuit serial programmer for FreeBSD, NetBSD, Linux, Cygwin (Windows) and MACOS/X or any UNIX/POSIX based system, which includes the Raspberry Pi and embedded devices running OpenWRT.
All operating systems support high voltage programming (HVP) of PICMicros with the Velleman K8048 or K8076 kits using a RS232 interface, yet many other high voltage programming kits may be supported with the appropriate configuration.
Support is also available to program low voltage programming (LVP) compatible PICMicros directly from a Raspberry Pi, OpenWRT enabled router or an USB UART adapter. Look for PICMicros marked LVP(PGM) or LVP(KEY) in the supported PICMicro device list.
Refer to the Microchip documentation for your PICMicro as to whether it supports high voltage (HVP) or low voltage (LVP) programming or both.
Currently supported PICMicros range from the PIC10 to the PIC32. Predominantly PICMicros available in DIP packages are tested and supported.
In order to use the program in Windows you must first install and setup Cygwin including the necessary development tools for building the application. See [[tools:cygwin|this]] page for details.
Darron M Broad < darron at kewl dot org >
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== News ===
{{:projects:pickle:pic32mm.jpg?200|PIC32MM}}
Pickle version 5.0 has been released. This version changes how ICSP interfaces are configured in the configuration file. The changes do not affect the RPi but do affect the legagy Velleman K8048.
Programming executive support has been added for PIC32MM 32-bit PICMicros.
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== Licence ===
Before you download and use the application you should read the [[:projects:pickle:licence|LICENCE]] found here. This licence details the rights and liabilities of using the application and it should be especially understood that I, the author, will not accept any responsibility for any side effects of running it. Do not download and run this program unless you are willing to accept the consequences of it failing for any reason.
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== History ===
{{:projects:pickle:ftdi-icsp.jpg?200|FTDI}}
Pickle was originally written by Darron M Broad in 2005 as `k8048' to support the PIC16F627. `k8048' was updated in 2007 adding various other devices and more active development has occured since 2012 adding many more. The project was renamed from `k8048' to pickle in January 2015 as the Velleman K8048 kit became less relevant and superseded by the Raspberry Pi as the primary development platform.
=== Thanks ===
Special [[projects:pickle:thanks|thanks]] go to various people who helped over the years with this project!
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== ICSP interfaces ===
Hardware with ICSP support.
^Device^Description^Speed^Data^
|[[projects:pickle#bananapi|BPI]]/[[projects:pickle#orangepi0|OPI]] (1)|Linux AllWinner Banana Pi (A20) and Orange Pi (H2+/H3) GPIO.|Fast|[[:boards:bpi|BPi]] [[:boards:opi0|OPi0]]|
|[[projects:pickle#linuxcp2104|CP2104]] |Linux CP2104 GPIO.|Slow|CP210x_VCP_Linux_3.13|
|[[projects:pickle#linuxftdi|FTDI]] |Linux FTDI USB bit-bang.|Slow|libftdi or libftdi1|
|[[projects:pickle#linuxgpiobb|GPIO-BB]] |Linux GPIO bit-bang version 1.3.|Fast|[[projects:gpio-bb|GPIO Bit-bang]]|
|[[projects:pickle#linuxmcp2221|MCP2221]] |Linux MCP2221 GPIO.|Slow|Wire as PI/O below |
|[[projects:pickle#linuxmcp23016|MCP23016]]|Linux MCP23016 I2C.|Slow|Wire as PI/O below|
|[[projects:pickle#linuxmcp230xx|MCP230XX]]|Linux MCP23008/17 I2C.|Slow|[[:interfaces:slicepi|Slice of PI/O]]|
|[[projects:pickle#linuxmcp23sxx|MCP23SXX]]|Linux MCP23S08/17 SPI.|Slow|Wire as PI/O above|
|[[projects:pickle#linuxpcf8574|PCF8574]] |Linux PCF8574 I2C.|Slow|Single data I/O|
|SYSFSGPIO|Linux SYSFS|Slow|Single data I/O|
|[[projects:pickle#rpi1|RPI]] (2) |Linux Raspberry Pi GPIO (Pi0/Pi1/Pi2/Pi3/Pi4).|Fast|[[:boards:rpi|RPi]] [[:boards:chipkitpi|chipKITPi]]|
|[[projects:pickle#k8048tty|TTY]] |POSIX Serial bit-bang.|Variable|8250/16550 is fast, USB is slow, Eg. [[:interfaces:cp2102|CP2102]]|
(1) Memory mapped I/O on BPI can cause a lock-up on latest kernels. Use GPIO-BB instead.\\
(2) Board auto-detect does not work with newer Kernels.
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== PICMicros ===
{{:projects:pickle:mz.jpg?200|PIC32MZ}}
The following tables list all the supported PICMicros. PICMicros in each table are grouped by family and at least one device of each family has been tested.
[[:projects:pickle:12-bit|12-bit word / 8-bit data PIC10F/12F/16F architecture]]
[[:projects:pickle:14-bit|14-bit word / 8-bit data PIC10F/12F/16F architecture]]
[[:projects:pickle:14-bit-new|14-bit word / 8-bit data PIC16F architecture (new programming algorithm)]]
[[:projects:pickle:16-bit|16-bit word / 8-bit data PIC18F architecture]]
[[:projects:pickle:16-bit-new|16-bit word / 8-bit data PIC18F architecture (new programming algorithm)]]
[[:projects:pickle:24-bit|24-bit word / 16-bit data PIC24/dsPIC architecture]]
[[:projects:pickle:32-bit|32-bit word / 32-bit data PIC32 architecture]]
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== Tested PICMicros ===
{{:projects:pickle:picmicros.jpg?200|PICMicros}}
The PICMicros in the following table have been tested are known to work in specific modes of operation.
Code Y/N indicates whether an [[:projects:icspio|ICSP I/O]] test has been written for this device.
The three modes are as follows:
* HVP. High voltage programming at 9 or 13V.
* LVP(PGM). Low voltage programming with VPP and PGM at VDD.
* LVP(KEY). Low voltage programming with VPP at VDD and entry using a 32-bit key.
The legacy Velleman K8048/K8076 is incompatible with many modern devices and any advice is noted.
New algorithm noted in the comment column refers to the new PIC16F/18F programming algorithm incompatible
with the older ICSP programming method.
^ Code ^ PICMicro ^ Added by ^ Tested by ^ HVP ^ LVP(PGM) ^ LVP(KEY) ^ Velleman K8048 ^ Comments ^
|Y |PIC16F84A |Darron Broad |Paul Van Gelder |13 |N |N | | |
|Y |PIC16F627 |Darron Broad | |13 |5 |N | | |
|Y |PIC16F88 |Tobin Richard | |13 |5 |N | | |
|Y |PIC16F648A |Darron Broad | |13 |5 |N | | |
|Y |PIC16F819 |Darron Broad | |13 |5 |N | | |
|Y |PIC16F676 |Darron Broad | |13 |N |N | | |
|Y |PIC12F675 |Darron Broad | |13 |N |N | | |
|Y |PIC16F877A |Darron Broad | |13 |5 |N |ICSP only. | |
|Y |PIC18F1320 |Darron Broad | |13 |5 |N |PGM 10K to GND on 28P. | |
|Y |PIC18F2550 |Darron Broad | |12.5 |5 |N | | |
|Y |PIC18F252 |Darron Broad | |13 |5 |N | | |
|Y |PIC16F716 |Darron Broad | |13 |N |N | | |
|Y |PIC16F505 |Darron Broad | |13 |N |N | | |
|Y |PIC10F200 |Darron Broad | |13 |N |N |ICSP only. | |
|Y |PIC10F202 |Darron Broad | |13 |N |N |ICSP only. | |
|Y |PIC18F4550 |Darron Broad | |12.5 |5 |N |ICSP only. | |
|Y |PIC18F2320 |Darron Broad | |13 |5 |N | | |
|Y |PIC12F683 |Darron Broad | |13 |N |N | | |
|Y |PIC16F688 |Darron Broad | |13 |N |N | | |
|Y |PIC16F628A |Darron Broad | |13 |5 |N | | |
|Y |PIC16F726 |Darron Broad | |9 |N |N | | |
|Y |PIC12F508 |Darron Broad | |13 |N |N | | |
|Y |PIC12F615 |Darron Broad | |13 |N |N | | |
|Y |PIC16F872 |Darron Broad | |13 |5 |N | | |
|Y |PIC16F57 |Darron Broad | |13 |N |N |ICSP only. | |
|Y |PIC16F54 |Darron Broad | |13 |N |N | | |
|Y |PIC16F506 |Darron Broad | |13 |N |N | | |
|Y |PIC10F220 |Darron Broad | |13 |N |N |ICSP only.. | |
|Y |PIC16F887 |Darron Broad | |12 |5 |N |ICSP only. | |
|Y |PIC12F519 |Darron Broad | |13 |N |N | | |
|Y |PIC16F73 |Darron Broad | |13 |N |N | | |
|Y |PIC10F320 |Darron Broad | |9 |5 |N |VPP 9V. ICSP only. | |
|Y |PIC16F886 |Darron Broad | |12 |5 |N | | |
|Y |PIC16F1507 |Darron Broad | |9 |N |5 |VPP 9V. Use 14P socket. | |
|Y |PIC18F25K22 |Darron Broad | |9 |N |5 |VPP 9V. | |
|Y |PIC18F4620 |Darron Broad | |12.5 |5 |N |ICSP only. | |
|Y |PIC16F876A |Darron Broad | |13 |5 |N | | |
|Y |PIC12F617 |Darron Broad | |13 |N |N | | |
|Y |PIC18F4520 |Darron Broad | |12.5 |5 |N |ICSP only. | |
|Y |PIC16F917 |Darron Broad | |12 |N |N |ICSP only. | |
|Y |PIC16F84 |Ian Stoyle | |13 |N |N | | |
|Y |PIC18F1330 |Darron Broad | |12.5 |N |N | | |
|Y |PIC18F2431 |Darron Broad | |13 |5 |N |Incompatible (VDD on pin 7). | |
|Y |PIC18F26K80 |Darron Broad & \\ Gerhard Bertelsmann |Gerhard Bertelsmann |9 |N |5 |Incompatible (VPP fault). | |
|Y |PIC16F1825 |Darron Broad | |9 |N |5 |VPP 9V. | |
|Y |PIC16F1936 |Darron Broad | |9 |N |5 |VPP 9V. | |
|Y |PIC16F1847 |Darron Broad | |9 |N |5 |VPP 9V. | |
|Y |PIC18F25K50 |Darron Broad | |9 |N |5 | | |
|Y |PIC18F14K50 |Darron Broad | |9 |5 |N |Incompatible (PGC/PGD 3V3 limit). | |
|Y |PIC18LF27J53 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC16F690 |Darron Broad |Josef Larsson |13 |N |N |Use 14P socket. | |
|Y |PIC12F510 |Darron Broad | |13 |N |N | | |
|Y |PIC16F59 |Darron Broad | |13 |N |N |ICSP only. | |
|Y |PIC16F767 |Darron Broad | |13 |N |N | | |
|Y |PIC16F1788 |Darron Broad | |9 |N |5 |VPP 9V. | |
|Y |PIC16F570 |Darron Broad | |13 |N |N | | |
|Y |PIC16F721 |Darron Broad | |9 |N |N |Use 14P socket. | |
|Y |PIC16F527 |Darron Broad | |13 |N |N |Use 14P socket. | |
|Y |PIC12F752 |Darron Broad | |13 |N |N | | |
|Y |PIC12LF1552 |Darron Broad | |9 |N |3V3 |Incompatible (VDD 3V3). | |
|Y |PIC16F1518 |Darron Broad | |9 |N |5 |VPP 9V. | |
|Y |PIC16F1455 |Darron Broad | |9 |N |5 |Incompatible (PGC/PGD 3V3 limit). | |
|Y |PIC18LF2539 |Darron Broad | |13 |5 |N | | |
|Y |PIC16F526 |Darron Broad | |13 |N |N | | |
|Y |PIC16F753 |Darron Broad | |13 |N |N | | |
|Y |PIC16F785 |Darron Broad | |12 |N |N |Use 14P socket. | |
|Y |PIC16F707 |Darron Broad | |9 |N |N |ICSP only. | |
|Y |PIC18F14K22 |Darron Broad | |9 |5 |N |VPP 9V. Use 14P socket. | |
|Y |PIC18F26K20 |Darron Broad | |9 |3V3 |N |Incompatible (VDD 3V3). | |
|Y |PIC16F1459 |Darron Broad | |9 |N |5 |Incompatible (PGC/PGD 3V3 limit). | |
|Y |PIC24F04KA201 |Darron Broad | |9 |N |3V3 |Incompatible (architecture). | |
|Y |dsPIC33FJ06GS101A |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC24FJ16MC101 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |dsPIC30F1010 |Darron Broad | |N |N |5 |Incompatible (architecture). | |
|Y |PIC24F16KL402 |Darron Broad | |9 |N |3V3 |Incompatible (architecture). | |
|Y |dsPIC33FJ16GS502 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |dsPIC33FJ32MC102 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |dsPIC33EP128GP502 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC24HJ128GP502 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC24FJ64GB002 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC24FJ64GA002 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC24FV32KA302 |Darron Broad | |9 |N |5 |VPP 9V. ICSP only. | |
|Y |dsPIC30F4013 |Darron Broad | |13 |N |N |ICSP only. | |
|Y |dsPIC33FJ128GP802 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC16F1708 |Darron Broad | |9 |N |5 |VPP 9V. Use 14P socket. | |
|Y |PIC12F1612 |Darron Broad | |9 |N |5 |VPP 9V. | |
|Y |PIC16F636 |Darron Broad | |13 |N |N | | |
|Y |PIC16LF1716 |Darron Broad | |9 |N |3V3 |Incompatible (VDD 3V3). | |
|Y |PIC12LF1572 |Darron Broad | |9 |N |3V3 |Incompatible (VDD 3V3). | |
|Y |PIC24FJ128GB202 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC16LF1559 |Darron Broad | |9 |N |3V3 |Incompatible (VDD 3V3). | |
|Y |PIC24FJ128GA202 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC32MX150F128B |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC32MX250F128B |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC32MX795F512H |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC32MX170F256B |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC24FV08KM101 |Darron Broad | |9 |N |5 |VPP 9V. ICSP only. | |
|Y |PIC32MX270F256B |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC16LF18313 |Darron Broad | |9 |N |3V3 |Incompatible (VDD 3V3). | |
|Y |PIC16F1578 |Darron Broad | |9 |N |5 |VPP 9V. Use 14P socket. | |
|Y |PIC16F1776 |Darron Broad | |9 |N |5 |VPP 9V. | |
|Y |PIC16F1764 |Darron Broad | |9 |N |5 |VPP 9V. | |
|Y |PIC18F45K80 |Darron Broad | |9 |N |5 |Incompatible (VPP fault). | |
|Y |PIC16LF1566 |Darron Broad | |9 |N |3V3 |Incompatible (VDD 3V3). | |
|Y |dsPIC33EV256GM002 |Darron Broad | |N |N |5 |VPP 5V. ICSP only. | |
|Y |dsPIC33EV256GM102 |Darron Broad | |N |N |5 |VPP 5V. ICSP only. | |
|Y |PIC16F18346 |Darron Broad | |9 |N |5 |VPP 9V. not tested. | |
|Y |PIC16F15355 |Darron Broad | |9 |N |5 |VPP 9V. |New algorithm.|
|Y |PIC18F26K40 |Darron Broad | |9 |N |5 |VPP 9V. |New algorithm.|
|Y |PIC16F18875 |Darron Broad | |9 |N |5 |VPP 9V. not tested. |New algorithm.|
|Y |dsPIC33EP64GS502 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC24FJ256GA702 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |PIC32MM0032GPL028 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |dsPIC33EP512MC502 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|Y |dsPIC33EP128GS702 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|N |PIC16F873A |Chris Williams | |13 |5 |N | | |
|N |PIC16F1503 |Darron Broad |Dustin Hoffman |9 |N |5 |VPP 9V. | |
|N |PIC32MX564F128H |Darron Broad |Gerhard Bertelsmann |N |N |3V3 |Incompatible (architecture). | |
|N |PIC18F13K50 |Darron Broad |Gerhard Bertelsmann |9 |5 |N |Incompatible (PGC/PGD 3V3 limit). | |
|N |PIC16LF1454 |Darron Broad |Gerhard Bertelsmann |9 |N |3V3 |Incompatible (VDD 3V3). | |
|N |PIC18F4685 |Darron Broad | |12.5 |5 |N |ICSP only. | |
|N |PIC24FJ256GB106 |Simon Casey | |N |N |3V3 |Incompatible (architecture). | |
|N |PIC24FJ128GC010 |Simon Casey | |N |N |3V3 |Incompatible (architecture). | |
|N |PIC24FJ1024GB610 |Simon Casey | |N |N |3V3 |Incompatible (architecture). | |
|N |PIC24FJ128GA410 |Simon Casey | |N |N |3V3 |Incompatible (architecture). | |
|N |PIC16F18313 |Darron Broad | |9 |N |5V |VPP 9V. not tested. | |
|N |PIC16F1822 |Darron Broad | |9 |N |5V |VPP 9V. not tested. | |
|N |PIC16F1840 |Darron Broad | |9 |N |5V |VPP 9V. not tested. | |
|N |PIC16F1501 |Darron Broad | |9 |N |5V |VPP 9V. not tested. | |
|N |PIC16F1571 |Darron Broad | |9 |N |5V |VPP 9V. not tested. | |
|N |PIC16F1572 |Darron Broad | |9 |N |5V |VPP 9V. not tested. | |
|N |PIC18F25K42 |Darron Broad | |9 |N |5V |VPP 9V.|New algorithm.|
|N |PIC18F26J50 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|N |PIC16F19156 |Darron Broad | |9 |N |5 |VPP 9V. |New algorithm.|
|N |PIC18F26K42 |Darron Broad | |9 |N |5 |VPP 9V. |New algorithm.|
|N |PIC16F18446 |Darron Broad | |9 |N |5 |VPP 9V. Use 14P socket. |New algorithm.|
|N |PIC18F25Q10 |Darron Broad | |9 |N |5 |VPP 9V. |New algorithm.|
|N |dsPIC33EP32GS202 |Darron Broad | |N |N |3V3 |Incompatible (architecture). | |
|N |PIC32MM0256GPM028 |Pete Restall| |N |N |3V3 |Incompatible (architecture). | |
|N |PIC18F26K83 |Darron Broad | |9 |N |5 |VPP 9V. |New algorithm.|
|N |PIC18F27Q43 |Darron Broad | |9 |N |5 |VPP 9V. |New algorithm.|
^ Code ^ PICMicro ^ Added by ^ Tested by ^ HVP ^ LVP(PGM) ^ LVP(KEY) ^ Velleman K8048 ^ Comments ^
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== Installation ===
Download the latest archive file {{downloads:pickle-5.01.tgz|pickle-5.01.tgz}} or check out the latest development version here [[http://hg.kewl.org/pub/pickle/archive/tip.tar.gz|tip.tar.gz]].
Decompress and extract the application source code from the archive. Perform `sudo make && sudo make install', the application will be ready for use.
This has been tested on FreeBSD 5 and 6 yet should work on all FreeBSD variants and other BSD derived systems. It has also been test to work in Linux 2.6 but only compiled for 2.4.
A binary build is available for the RPi {{downloads:pickle-5.02-pi.tgz|pickle-5.02-pi.tgz}}. This pre-built binary must be extracted as root into / as /opt/pickle/.
Here are some sample sessions obtaining the source of the application and then compiling and installing it.
== FreeBSD ==
As root.
cd /usr/ports/devel/gmake
make
make install
rehash
cd /root
fetch "https://wiki.kewl.org/_media/downloads:pickle-5.01.tgz"
tar zxf pickle-5.01.tgz
cd pickle
gmake k8048
gmake k8048-install
== Linux ==
wget "https://wiki.kewl.org/_media/downloads:pickle-5.01.tgz"
tar zxf pickle-5.01.tgz
cd pickle
make linux
sudo make linux-install
== Cygwin ==
wget "https://wiki.kewl.org/_media/downloads:pickle-5.01.tgz"
tar zxf pickle-5.01.tgz
cd pickle
make cygwin
make cygwin-install
cd ~
vi .pickle
DEVICE=/dev/ttyS2
SLEEP=0
BITRULES=0x001F
BUSY=0
:wq!
Below is an example where we build the latest version of pickle from the code repository (use at your own risk).
== Debian ==
sudo -s
apt-get install build-essential mercurial libftdi-dev
rehash
hg clone http://hg.kewl.org/pub/pickle
cd pickle
make linux
make linux-install
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== Configuration ===
{{:projects:pickle:k8048-rpi.jpg?200|Velleman K8048 RPi}}
There are two ways to configure pickle; either use a dot file named `.pickle' in your home directory, else create a directory named `.pickle' and store the configuration in a file there named `config'.
The second option is to allow selectable configurations with the `PICKLE' environment variable, and also for storage of Programming Executive files for the 32-bit PICMicros.
The options are as follows.
#
# I/O device
#
#DEVICE=BPI # Banana Pi SBC
#DEVICE=CP2104 # CP2104 USB UART
#DEVICE=FTDI # FTDI FT230X, FT4232H, FT2232H or FT232 USB UART
#DEVICE=GPIO-BB # Linux GPIO bit-bang kernel module
#DEVICE=MCP2221 # Microchip USB bridge
#DEVICE=MCP23016 # Microchip I2C I/O expander
#DEVICE=MCP230XX # Microchip 23008/23017 I2C I/O expanders
#DEVICE=MCP23SXX # Microchip 23S08/23S17 SPI I/O expanders
#DEVICE=PCF8574 # Philips I2C I/O expander
#DEVICE=RPI # Raspberry Pi/0/2/3/4 SBCs
#DEVICE=TTY # POSIX RS-232 UART
# I/O interface
#IFACE=/dev/ttyUSB0 # CP2104 or TTY
#IFACE=0 # FTDI
#IFACE=/dev/gpio-bb # GPIO-BB
#IFACE=/dev/i2c-1 # MCP23016, MCP230XX or PCF8574
#IFACE=/dev/spidev0.1 # MCP23SXX
#IFACE=/dev/ttyS0 # TTY
# I/O 1/2-bit delay/sleep time
#
# For ttyS use 1
# For ttyUSB use 600
# For RPI use 1
#
# When SLEEP is set to zero no delay is taken
# When SLEEP is less than 10, then SLEEP x I/O bit time is taken for RPI and tty
# When SLEEP is less than 100 a busy loop is utilised
# When SLEEP is >=100 then system usleep is used.
#
# For GPIO BIT-BANG SLEEP configures the low and high clock durations in the driver
#
# TTY ttyS
#SLEEP=1
# TTY ttyUSB
#SLEEP=600
# RPI VELLEMAN K8048
#SLEEP=10
# RPI GPIO
#SLEEP=1
# I2C/SPI
#SLEEP=0
# GPIO-BB
#SLEEP=1
# I/O bit rules.
# These rules determine the polarity of the control lines and whether
# data input requires data output pulled high or low.
# 0x0001 PGD_OUT_FLIP
# 0x0002 PGC_OUT_FLIP
# 0x0004 VPP_OUT_FLIP
# 0x0008 PGD_IN_FLIP
# 0x0010 PGD_IN_PULLUP
# 0x0020 PGM_OUT_FLIP
# 0x0040 VPP_OUT_CLOCK
# 0x0080 PGD_IN_PULLDOWN
# These rules release GPIOs on program exit by setting them to Input.
# 0x0100 PGD_RELEASE
# 0x0200 PGC_RELEASE
# 0x0400 PGM_RELEASE
# 0x0800 VPP_RELEASE
# 0x1000 VPP_RUN
# This rule enables shift with irq lock for GPIO BIT-BANG
# 0x2000 BB_LOCK
# This rule resets any released pin to its previous function on exit (input, output or ALT).
# 0x4000 ALT_RELEASE
# This rule is for Winklepicker reset
# 0x8000 TX_BREAK
# TTY VELLEMAN K8048 = PGD_IN_PULLUP + PGD_OUT_FLIP + PGC_OUT_FLIP + VPP_OUT_FLIP + PGD_IN_FLIP
# TTY VELLEMAN K8076 = PGD_IN_PULLUP
# RPI VELLEMAN K8048 = PGD_IN_PULLUP
#
# TTY VELLEMAN K8048
#BITRULES=0x001F
# TTY VELLEMAN K8076
#BITRULES=0x0010
# RPI VELLEMAN K8048
#BITRULES=0x0010
# RPI GPIO
#BITRULES=0x1000
# MCP23017 I2C
#BITRULES=0x1010
# GPIO-BB
#BITRULES=0x1000
# RPI CHIPKIT PI PIC32 ICSP
#BITRULES=0x4F00
# TTY T-TYPE FLIP FLOP ON TXD FOR VPP
#BITRULES=0x004F
# I/O busy cursor speed (0=DISABLED)
#
#BUSY=0
# RPI VELLEMAN K8048 (https://wiki.kewl.org/dokuwiki/projects:k8048-rpi)
#
# TX/!MCLR/VPP - DSUB9(3)
#VPP=14
# PGM - NOT SUPPORTED ON VELLEMAN K8048
#PGM=-1
# RTS/PGC CLOCK - DSUB9(7)
#PGC=18
# DTR/PGD DATA_OUT - DSUB9(4)
#PGDO=24
# CTS/PGD DATA_IN - DSUB9(8)
#PGDI=25
# RPI GPIO (separate PGD DATA I/O)
# = SLICE OF PI/O =
# !MCLR/VPP - PI/O G04
#VPP=4
# PGM - PI/O G22
#PGM=22
# PGC CLOCK - PI/O G25
#PGC=25
# PGD DATA_OUT - PI/O G24
#PGDO=24
# PGD DATA_IN - PI/O G23
#PGDI=23
# RPI OR GPIO-BB (single PGD DATA I/O)
# = SLICE OF PI/O =
# !MCLR/VPP - PI/O G04
#VPP=4
# PGM - PI/O G22
#PGM=22
# PGC CLOCK - PI/O G25
#PGC=25
# PGD DATA_I/O - PI/O G24
#PGD=24
# RPI OR GPIO-BB (single PGD DATA I/O)
# = CHIPKIT PI I/O =
# !MCLR/VPP - RPI-Connect 18
#VPP=9
# PGM - RPI-Connect 12
#PGM=22
# PGC CLOCK - RPI-Connect 16
#PGC=10
# PGD DATA_I/O - RPI-Connect 20
#PGD=11
# RPI OR GPIO-BB (single PGD DATA I/O)
# = CHIPKIT PI PIC32 ICSP =
# !MCLR/VPP - /RESET
#VPP=4
# PGM - N/A
#PGM=-1
# PGC CLOCK - PGC1 RX2
#PGC=14
# PGD DATA_I/O - PGD1 TX2
#PGD=15
# I2C/SPI ADDRESS
#
#ADDR=0x20
# ICSP I/O 1/2-bit sleep time for `pio'.
#FWSLEEP=30
# Debug level (0=NONE, 1=ERROR, 10=INFO)
#DEBUG=1
# PIC14-NEW, PIC16, and PIC16-NEW CONFIG MASK
#
# 1 CONFIGVER APPLY TO VERIFY (DEFAULT)
# 2 CONFIGAND APPLY TO DUMP (DEFAULT)
# 4 CONFIGSET APPLY TO WRITE
#
# DOES NOT APPLY TO PIC18J SERIES
#
#CONFIG=0 # DISABLED
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== Example configuration ===
== Linux AllWinner Banana Pi (A20) ==
DEVICE=BPI
SLEEP=1
BITRULES=0x1000
VPP=270
PGM=-1
PGC=266
PGD=272
== Linux AllWinner Orange Pi 0 (H2+) ==
DEVICE=OPI0
BITRULES=0x1000
SLEEP=1
VPP=12
PGC=11
PGD=6
PGM=-1
== Linux CP2104 GPIO ==
#
# IO0 ---------> MCLR
# IO1 ---------> PGC
# IO2 ---390R--> PGD
# IO3 <--390R--- PGD
#
# /dev/ttyUSB0
#
DEVICE=CP2104
IFACE=/dev/ttyUSB0
BITRULES=0x1000
VPP=0
PGC=1
PGDO=2
PGDI=3
== Linux FTDI USB bit-bang ==
# DB0 TXD
# DB1 RXD
# DB2 RTS#
# DB3 CTS#
# DB4 DTR#
# DB5 DSR#
# DB6 DCD#
# DB7 RI#
DEVICE=FTDI
IFACE=0
BITRULES=0x1000
SLEEP=0
VPP=0
PGC=1
PGD=3
PGM=-1 # DISABLED
DEBUG=0
== Linux GPIO bit-bang ==
DEVICE=GPIO-BB
IFACE=/dev/gpio-bb
SLEEP=1
BITRULES=0x1000
VPP=9
PGM=22
PGC=10
PGD=11
== Linux MCP2221 GPIO ==
#
# GP3 PGDI <---------- PGD
# GP2 VPP ----------> MCLR
# GP1 PGC ----------> PGC
# GP0 PGDO ----1K----> PGD
#
DEVICE=MCP2221
BITRULES=0x1000
SLEEP=0
PGDI=3
VPP=2
PGC=1
PGDO=0
PGM=-1 # N/A
== Linux MCP23016 I2C ==
VPP=0
PGC=1
PGDO=2
PGDI=3
PGM=-1
DEVICE=MCP23016
IFACE=/dev/i2c-1
ADDR=0x20
SLEEP=0
#VPP_RUN + PGD_IN_PULLUP
BITRULES=0x1010
== Linux MCP23008/17 I2C ==
VPP=0
PGC=1
PGDO=2
PGDI=3
PGM=-1
DEVICE=MCP230XX
IFACE=/dev/i2c-1
ADDR=0x20
SLEEP=0
#VPP_RUN + PGD_IN_PULLUP
BITRULES=0x1010
== Linux MCP23S08/17 SPI ==
VPP=0
PGC=1
PGDO=2
PGDI=3
PGM=-1
DEVICE=MCP23SXX
IFACE=/dev/spidev0.0
ADDR=0x20
SLEEP=0
#VPP_RUN + PGD_IN_PULLUP
BITRULES=0x1010
BAUDRATE=1000000
== Linux PCF8574 I2C ==
VPP=0
PGDI=1
PGDO=1
PGC=2
PGM=-1
DEVICE=PCF8574
IFACE=/dev/i2c-1
ADDR=0x20
SLEEP=0
#VPP_RUN + PGC_RELEASE + PGD_RELEASE + PGD_IN_PULLUP
BITRULES=0x1310
== Linux RPi 1 GPIO ==
DEVICE=RPI1
SLEEP=1
BITRULES=0x1000
VPP=9
PGM=-1
PGC=10
PGD=11
== Linux RPi 4 GPIO ==
DEVICE=RPI # AUTO-DETECT
SLEEP=1
BITRULES=0x1000
VPP=9
PGM=-1
PGC=10
PGD=11
== POSIX Serial bit-bang ===
Velleman K8048
DEVICE=TTY
IFACE=/dev/ttyS0
SLEEP=1
BITRULES=0x001F
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== Programming Executive ===
{{:projects:pickle:pic32icsp.jpg?200|Pi Zero programming PIC32MX}}
On dsPIC/PIC24 and PIC32 devices, Microchip provide a `programming executive'.
This software is loaded into the chip to speed up ICSP.
Pickle supports ICSP with the programming executive (PE) on the PIC32 but not the dsPIC/PIC24 devices. Currently there are no plans to add PE support for the dsPIC/PIC24.
By default, PIC32 PE mode is not enabled and a few steps must be completed to activate this mode of operation.
If you have a .pickle file then rename it with a temporary name.
mv ~/.pickle ~/.pickle-config
Make a directory named .pickle in your home dir.
mkdir ~/.pickle
Move any old config into the new directory, renaming it to `config'.
mv ~/.pickle-config ~/.pickle/config
Download and unzip the programming executive from Microchip, Eg. for the PIC32MX150F128B.
cd ~/.pickle
wget -q http://ww1.microchip.com/downloads/en/DeviceDoc/RIPE_11_000301.zip
unzip RIPE_11_000301.zip
A file named RIPE_11_000301.hex will now exist in the .pickle directory. When we use p32, and it finds this file, it will automatically load it into the chip.
The following PE files are all that's required for the PIC32 range of PICMicros.
^ md5sum ^filename ^
|2662befb94584d40b905a9040a9ed2f4 |RIPE_06_000201.hex|
|4cb8f6492b1234a45c92979a36d91587 |RIPE_11_000301.hex|
|aea1a950b72471e54b82852b93105d6a |RIPE_15_000502.hex|
|bb462553082999b4bd8b4e94154fd0d7 |RIPE_20a_000510.hex|
|903282c9b4966817b7d7ee961c60cff4 |RIPE_20b_000510.hex|
To test that the PE has been registered correctly, we can issue the id command,
and if the PE is found the filename is shown. If the filename is not
shown then something is wrong.
$ p32 id
[1D000000] [PROGRAM] 00008000 WORDS
[1F80F220] [DEVICEID] 14D06053 PIC32MX150F128B
[1FC00000] [BOOT] 00000300 WORDS
[1FC00BF0] [DEVCFG3] CFFFFFFF
[1FC00BF4] [DEVCFG2] FFF9FFD9
[1FC00BF8] [DEVCFG1] FC67CF59
[1FC00BFC] [DEVCFG0] 7FFFFFFB
[PE] RIPE_11_000301.hex
The speed up when using the PIC32 PE to read and write to flash file is considerable.
For example, programming 128KB without PE takes about 60 seconds on the RPi, with the
PE it takes about 7.5 seconds. Verifying the same data takes 2 minutes without the PE
and 5.5 seconds with it.
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== Running the application ===
There are multiple ways to run the pickle and its mode of operation is selected by using one of its symlinked command variations.
== pickle: Show usage of other modes of operation ==
$ pickle
USAGE: pickle
Usage information.
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
FRONTENDS:
INHX32
File or standard input.
STK500
POSIX serial or network input.
BACKENDS:
BPI/OPI
Linux AllWinner Banana Pi (A20) and Orange Pi (H2+/H3) GPIO.
CP2104
Linux CP2104 GPIO.
FTDI
Linux FTDI USB bit-bang.
GPIO-BB
Linux GPIO bit-bang version 1.3.
MCP2221
Linux MCP2221 GPIO.
MCP23016
Linux MCP23016 I2C.
MCP230XX
Linux MCP23008/17 I2C.
MCP23SXX
Linux MCP23S08/17 SPI.
PCF8574
Linux PCF8574 I2C.
RPI
Linux Raspberry Pi GPIO (Pi0/Pi1/Pi2/Pi3/Pi4).
TTY
POSIX Serial bit-bang.
EXAMPLES:
p12 SELECT DEVICE OPERATION [ARG]
12-bit word PIC10F/12F/16F operations.
p14 [SELECT DEVICE] [LVP] OPERATION [ARG]
14-bit word PIC10F/12F/16F operations.
n14 [LVP] OPERATION [ARG]
14-bit word PIC16F operations.
p16 [SELECT DEVICE] [LVP|HVP] OPERATION [ARG]
16-bit word PIC18F operations.
n16 [LVP] OPERATION [ARG]
16-bit word PIC18F operations.
p24 [SELECT|PARTITION DEVICE] [LVP|HVP] OPERATION [ARG]
24-bit word PIC24/dsPIC operations.
p32 OPERATION [ARG]
32-bit word PIC32 operations.
pctrl RUN|STOP|RESTORE
Control master clear.
pio COMMAND [ARG]
ICSPIO operations.
pload PROGRAM|VERIFY TTY|IP FILE [16|24|32]
Program or verify file on TTY or network.
ptest TEST [ARG]
Hardware tests.
VERSION:
5.01
== p12: Perform operations on 12-bit word architecture devices ==
$ p12
USAGE: p12 SELECT DEVICE OPERATION [ARG]
12-bit word PIC10F/12F/16F operations.
Error: Missing arg(s).
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
EXAMPLES:
p12 select
Show supported devices.
p12 select PIC1XFXXX blank
Blank device (disable protection and bulk erase).
p12 select PIC1XFXXX config
Display device configuration.
p12 select PIC1XFXXX data
Display data flash content.
p12 select PIC1XFXXX dump
Dump device content (INHX32 format).
p12 select PIC1XFXXX flash [n] [address]
Display all or n words of program flash content from address.
p12 select PIC1XFXXX id
Display device identification.
p12 select PIC1XFXXX osccal
Display oscillator calibration.
p12 select PIC1XFXXX osccal 0x0c1a
Restore oscillator calibration as 0x0c1a.
p12 select PIC1XFXXX program [file.hex] [noblank]
Blank and program file.hex or stdin to flash (INHX32 format).
p12 select PIC1XFXXX verify [file.hex]
Verify file.hex or stdin in flash (INHX32 format).
p12 select PIC1XFXXX view [file.hex] [raw]
View file.hex or stdin (INHX32 format).
p12 select PIC1XFXXX /dev/ttyUSB0 | 8048
Listen on /dev/ttyUSB0 or network for remote programming.
VERSION:
5.0
== p14: Perform operations on 14-bit word architecture devices ==
$ p14
USAGE: p14 [SELECT DEVICE] [LVP] OPERATION [ARG]
14-bit word PIC10F/12F/16F operations.
Error: Missing arg(s).
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
EXAMPLES:
p14 select
Show supported devices.
p14 select 16F84 OPERATION [ARG]
Select device PIC16F84.
p14 lvp OPERATION [ARG]
LVP 32-bit key entry.
p14 blank
Blank device (disable protection and bulk erase).
p14 config
Display device configuration.
p14 config 0x3000
Restore band-gap configuration as 0x3000.
p14 data
Display data EEPROM content.
p14 dump
Dump device content (INHX32 format).
p14 erase eeprom | flash | id | row [n]
Erase EEPROM, flash, id or flash at row for n rows.
p14 flash [n] [address]
Display all or n words of program flash content from address.
p14 id
Display device identification.
p14 loader
Output boot loader configuration.
p14 osccal
Display oscillator calibration.
p14 osccal 0x343c
Restore oscillator calibration as 0x343c.
p14 program [file.hex] [noblank]
Blank and program file.hex or stdin to flash (INHX32 format).
p14 verify [file.hex]
Verify file.hex or stdin in flash (INHX32 format).
p14 view [file.hex] [raw]
View file.hex or stdin (INHX32 format).
p14 /dev/ttyUSB0 | 8048
Listen on /dev/ttyUSB0 or network for remote programming.
VERSION:
5.0
== n14: Perform operations on 14-bit word architecture devices (new programming algorithm) ==
$ n14
USAGE: n14 [LVP] OPERATION [ARG]
14-bit PIC16F operations.
Error: Missing arg(s).
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
EXAMPLES:
n14 select
Show supported devices.
n14 lvp OPERATION [ARG]
LVP 32-bit key entry.
n14 blank
Blank device (disable protection and bulk erase).
n14 config
Display device configuration.
n14 data
Display data EEPROM content.
n14 dump
Dump device content (INHX32 format).
n14 flash [n] [address]
Display all or n words of program flash content from address.
n14 id
Display device identification.
n14 loader
Output boot loader configuration.
n14 program [file.hex] [noblank]
Blank and program file.hex or stdin to flash (INHX32 format).
n14 verify [file.hex]
Verify file.hex or stdin in flash (INHX32 format).
n14 view [file.hex] [raw]
View file.hex or stdin (INHX32 format).
n14 /dev/ttyUSB0 | 8048
Listen on /dev/ttyUSB0 or network for remote programming.
VERSION:
5.0
== p16: Perform operations on 16-bit word architecture devices ==
$ p16
USAGE: p16 [SELECT DEVICE] [LVP|HVP] OPERATION [ARG]
16-bit word PIC18F operations.
Error: Missing arg(s).
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
EXAMPLES:
p16 select
Show supported devices.
p16 select 18LF2539 OPERATION [ARG]
Select device PIC18LF2539.
p16 lvp OPERATION [ARG]
LVP 32-bit key entry.
p16 hvp OPERATION [ARG]
HVP 32-bit key entry.
p16 blank
Blank device (disable protection and bulk erase).
p16 config
Display device configuration.
p16 data
Display data EEPROM content.
p16 dump
Dump device content (INHX32 format).
p16 erase eeprom | flash | id | row [n]
Erase EEPROM, flash, id or flash at row for n rows.
p16 flash [n] [address]
Display all or n words of program flash content from address.
p16 id
Display device identification.
p16 loader
Output boot loader configuration.
p16 program [file.hex] [noblank]
Blank and program file.hex or stdin to flash (INHX32 format).
p16 verify [file.hex]
Verify file.hex or stdin in flash (INHX32 format).
p16 view [file.hex] [raw]
View file.hex or stdin (INHX32 format).
p16 /dev/ttyUSB0 | 8048
Listen on /dev/ttyUSB0 or network for remote programming.
VERSION:
5.0
== n16: Perform operations on 16-bit word architecture devices (new programming algorithm) ==
$ n16
USAGE: n16 [LVP] OPERATION [ARG]
16-bit PIC18F operations.
Error: Missing arg(s).
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
EXAMPLES:
n16 select
Show supported devices.
n16 lvp OPERATION [ARG]
LVP 32-bit key entry.
n16 blank
Blank device (disable protection and bulk erase).
n16 config
Display device configuration.
n16 data
Display data EEPROM content.
n16 dump
Dump device content (INHX32 format).
n16 flash [n] [address]
Display all or n words of program flash content from address.
n16 id
Display device identification.
n16 loader
Output boot loader configuration.
n16 program [file.hex] [noblank]
Blank and program file.hex or stdin to flash (INHX32 format).
n16 verify [file.hex]
Verify file.hex or stdin in flash (INHX32 format).
n16 view [file.hex] [raw]
View file.hex or stdin (INHX32 format).
n16 /dev/ttyUSB0 | 8048
Listen on /dev/ttyUSB0 or network for remote programming.
VERSION:
5.0
== p24: Perform operations on 24-bit word architecture devices ==
$ p24
USAGE: p24 [SELECT|PARTITION DEVICE] [LVP|HVP] OPERATION [ARG]
24-bit word PIC24/dsPIC operations.
Error: Missing arg(s).
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
EXAMPLES:
p24 select
Show supported devices.
p24 select 33EP128GP502 OPERATION [ARG]
Select device dsPIC33EP128GP502.
p24 select 24FJ128GB202 OPERATION [ARG]
Select device PIC24FJ128GB202.
p24 partition 33EP64GS502 OPERATION [ARG]
Select and partition device dsPIC33EP64GS502.
p24 lvp OPERATION [ARG]
LVP 32-bit key entry.
p24 hvp OPERATION [ARG]
HVP 32-bit key entry.
p24 blank
Blank device (disable protection and bulk erase).
p24 config
Display device configuration.
p24 data
Display data EEPROM content.
p24 dump
Dump device content (INHX32 format).
p24 exec [n] [address]
Display all or n words of executive flash content from address.
p24 flash [n] [address]
Display all or n words of program flash content from address.
p24 id
Display device identification.
p24 loader
Output boot loader configuration.
p24 program [file.hex] [noblank]
Blank and program file.hex or stdin to flash (INHX32 format).
p24 verify [file.hex]
Verify file.hex or stdin in flash (INHX32 format).
p24 view [file.hex] [raw]
View file.hex or stdin (INHX32 format).
p24 /dev/ttyUSB0 | 8048
Listen on /dev/ttyUSB0 or network for remote programming.
VERSION:
5.0
== p32: Perform operations on 32-bit word architecture devices ==
$ p32
USAGE: p32 OPERATION [ARG]
32-bit word PIC32 operations.
Error: Missing arg(s).
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
EXAMPLES:
p32 select
Show supported devices.
p32 boot [n] [address]
Display all or n words of boot flash content from address.
p32 blank
Blank device (erase).
p32 config
Display device configuration.
p32 dump
Dump device content (INHX32 format).
p32 flash [n] [address]
Display all or n words of program flash content from address.
p32 id
Display device identification.
p32 program [file.hex] [noblank]
Blank and program file.hex or stdin to flash (INHX32 format).
p32 verify [file.hex]
Verify file.hex or stdin in flash (INHX32 format).
p32 view [file.hex] [raw]
View file.hex or stdin (INHX32 format).
p32 /dev/ttyUSB0 | 8048
Listen on /dev/ttyUSB0 or network for remote programming.
VERSION:
5.0
== pctrl: Control master clear on GPIO ==
$ pctrl
USAGE: pctrl RUN|STOP|RESTORE [BEFORE][AFTER][DURATION]
Control master clear.
Error: Missing arg.
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
COMMANDS:
RUN Raise master clear to take the device out of reset.
STOP Lower master clear to put the device into reset.
RESTORE Lower then raise master clear to reset the device.
ARGUMENTS:
BEFORE Delay in milliseconds before command.
AFTER Delay in milliseconds after command.
DURATION Duration of reset for RESTORE command.
DEFAULTS:
BEFORE 0ms.
AFTER 0ms.
DURATION 10ms.
EXAMPLES:
pctrl RUN 10
Wait 10ms then raise master clear to take the device out of reset.
pctrl STOP 0 10
Lower master clear to put the device into reset then wait 10ms.
pctrl RESTORE 0 0 100
Lower for 100ms then raise master clear to reset the device.
VERSION:
5.0
== pio: Perform ICSPIO operations ==
$ pio
USAGE: pio COMMAND [ARG]
ICSPIO operations.
Error: Missing arg(s).
FILES:
/home/darron/.pickle/config
Configuration.
ENVIRONMENT:
PICKLE
Configuration file.
COMMANDS:
LED 0x00..0x3F Set Velleman K8048 LEDs.
SWITCH Get Velleman K8048 switches.
SLEEP Sleep until watchdog time-out.
WATCHDOG E|D Set watchdog enable/disable.
CLOCK 0..7 Set internal RC clock divider.
DIRECTION A..D|G 0x00..0xFF Set port data direction.
OUTPUT A..D|G 0x00..0xFF Set port data output.
INPUT A..D|G Get port data input, output on stdout.
ANALOG 0..N|D Set analog channel enable/disable.
SAMPLE Get analog channel input.
EEREAD 0x00..0xFF Get data EEPROM.
EEWRITE 0x00..0xFF 0x00..0xFF Set data EEPROM.
READ 0x0000..0xFFFF Get program flash.
VREF 0..15|D Set vref voltage level or disable.
8 0..0xFF Send an 8-bit arg & get an 8-bit answer.
16 0..0xFFFF Send a 16-bit arg & get an 8-bit answer.
24 0..0xFFFFFF Send a 24-bit arg & get an 8-bit answer.
32 0..0xFFFFFFFF Send a 32-bit arg & get an 8-bit answer.
TEST 0..0xFF Send an 8-bit test arg & get no reply.
ERROR Get last firmware error.
EXAMPLES:
pio WATCHDOG D
Turn off watchdog.
pio DIRECTION C 0xF0
Set port C bits 0..3 as output and bits 4..7 as input.
pio OUTPUT C 0x0A
Set port C bits 0..3 to 0x0A.
VERSION:
5.0
== pload: Program or verify file on TTY or network ==
$ pload
USAGE: pload PROGRAM|VERIFY TTY|IP FILE [16|24|32]
Program or verify file on TTY or network.
Error: Missing arg.
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
EXAMPLES:
pload program /dev/ttyS0 file.hex
Program file.hex (INHX32 format) on /dev/ttyS0.
pload verify /dev/ttyS0 file.hex
Verify file.hex (INHX32 format) on /dev/ttyS0.
pload program 192.168.1.100 < led.hex
Program stdin (INHX32 format) on 192.168.1.100 port 8048.
pload program /dev/ttyAMA0 led.hex 24
Program led.hex (INHX32 format) on /dev/ttyAMA0 using 24-bit addressing.
VERSION:
5.0
== ptest: Perform various hardware and communication tests ==
$ ptest
USAGE: ptest TEST ARG
Hardware tests.
Error: Missing args.
FILES:
/home/darron/.pickle/config
Configuration file.
ENVIRONMENT:
PICKLE
Configuration file.
EXAMPLES:
ptest VPP|PGC|PGD|PGM 5
VPP, PGC, PGD or PGM LOW->HIGH->LOW output test with 5 seconds mark time.
ptest INPUT 10
PGD input test with 10 iterations of 1 second per step.
ptest DSUB9 10
D-SUB-9 test with 10 seconds per step.
ptest ICSP 10
ICSP test with 10 seconds per step.
ptest CLOCK 0
PGC/RTS(7) clock test with no mark time.
ptest CLOCK 10
PGC/RTS(7) clock test with 10us mark time.
ptest 16F627 100
PIC16F627 debug test with 100us clock mark time.
ptest ICSPIO 100
ICSPIO test with 100us clock mark time.
ptest RPI 10
RPI GPIO test with 10 seconds mark time.
ptest ALLWINNER 10
BPI/OPI GPIO test with 10 seconds mark time.
VERSION:
5.01
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\
=== Using the Application ===
{{:projects:pickle:16f54.jpg?200|PIC16F54}}
To demonstrate its usage we may utilise some assembly code supplied in the Pickles support package.
An example assembly file for the PIC16F627 on the Velleman K8048 kit sends the text "hello, world" over the ICSP lines to the host PC within an infinite loop.
The ptest command has a function to decode the text as sent above and dump it to the console, below is an example of assembling the assembly code file, writing it to the PIC16F627 chip and dumping out the text sent by the chip.
== Build debug assembly file ==
hg clone http://hg.kewl.org/pub/pickles
cd pickles/examples/pic16f627/
make
== Program PIC16F627 with debug assembly hex file ==
p14 program debug.hex
Total: 272
== Verify PIC16F627 against debug assembly hex file ==
p14 verify debug.hex
Total: 272 Fail: 0
It is important to remember that on the Velleman K8048 the switch must be set to PROG. mode when writing to the chip and set to the RUN mode to execute code.
== PIC16F627 debug assembly test mode ==
ptest 16f627 100
TEST 16F627 debug.asm [CTRL-C TO STOP]
io_test4: read byte: 02 .
io_test4: read byte: 48 H
io_test4: read byte: 65 e
io_test4: read byte: 6C l
io_test4: read byte: 6C l
io_test4: read byte: 6F o
io_test4: read byte: 2C ,
io_test4: read byte: 20
io_test4: read byte: 77 w
io_test4: read byte: 6F o
io_test4: read byte: 72 r
io_test4: read byte: 6C l
io_test4: read byte: 64 d
io_test4: read byte: 0A .
io_test4: read byte: 03 .
io_test4: read line: Hello, world
io_test4: read byte: 02 .
^C
TEST DONE
Below are other examples of using the other commands available in pickle.
== Display device identity ==
p14 id
[0000] [PROGRAM] 0400 WORDS
[2000] [USERID0] 0001 .
[2001] [USERID1] 0002 .
[2002] [USERID2] 0003 .
[2003] [USERID3] 0004 .
[2004] [RESERVED] 3FFF
[2005] [RESERVED] 3FFF
[2006] [DEVICEID] 07A0 DEV:7A0 REV:00 PIC16F627
[2007] [CONFIG] 3F31
[2100] [DATA] 0080 BYTES
== Display only device configuration ==
p14 config
[2007] [CONFIG] 3F31
== Display data EEPROM ==
p14 data
[2100] 48 65 6C 6C 6F 2C 20 77 6F 72 6C 64 0A 00 FF FF Hello, world....
== Display program flash ==
p14 flash
[0000] 2862 3FFF 3FFF 3FFF 0009 00A4 01A5 01A6 b.......
[0008] 0BA6 2808 0BA5 2808 0BA4 2808 3400 3EFF ........
[0010] 1D03 280F 3400 00A4 3001 200F 0BA4 2814 ........
[0018] 3400 00A4 300B 200F 300B 200F 0BA4 281A ........
[0020] 3400 00A5 300A 2019 0BA5 2822 3400 01A0 ....."..
[0028] 01A1 1F06 3400 0BA1 2829 0BA0 2829 3400 ....).).
[0030] 01A0 01A1 1B06 3400 0BA1 2832 0BA0 2832 .....2.2
[0038] 3400 00A2 1406 2027 1786 2030 1386 3008 ...'.0..
[0040] 00A3 2027 0103 0CA2 1803 3080 0086 2030 .'.....0
[0048] 0BA3 2841 1006 3400 1683 1303 009B 1283 .A......
[0050] 1303 3002 2039 1683 1303 141C 081A 0A9B ..9.....
[0058] 1283 1303 3800 1903 285F 2039 2853 3003 ...._9S.
[0060] 2039 3400 1283 1303 018B 3007 009F 0186 9.......
[0068] 1683 1303 158E 3080 0081 307E 0086 30FF .....~..
[0070] 0085 1283 1303 3000 204C 3001 2005 2873 ....L..s
== Dump device content ==
p14 dump
:020000040000FA
:100000006228FF3FFF3FFF3F0900A400A501A601B2
:10001000A60B0828A50B0828A40B08280034FF3ECF
:10002000031D0F280034A40001300F20A40B142856
:100030000034A4000B300F200B300F20A40B1A2823
:100040000034A5000A301920A50B22280034A00195
:10005000A101061F0034A10B2928A00B2928003478
:10006000A001A101061B0034A10B3228A00B3228ED
:100070000034A2000614272086173020861308308B
:10008000A30027200301A20C031880308600302033
:10009000A30B412806100034831603139B00831220
:1000A000031302303920831603131C141A089B0A09
:1000B00083120313003803195F28392053280330B3
:1000C00039200034831203138B0107309F0086010F
:1000D000831603138E15803081007E308600FF303A
:1000E00085008312031300304C2001300520732853
:020000040000FA
:10420000480065006C006C006F002C0020007700F7
:104210006F0072006C0064000A000000FF00FF00E5
:020000040000FA
:024000000100BD
:024002000200BA
:024004000300B7
:024006000400B4
:02400E00313F40
:00000001FF
I hope you enjoy using this application, good luck.
[[projects:pickle#pickle_microchip_pic_icsp|TOC]]\\