Table of Contents
Raspberry Pi
The Raspberry Pi is a cheap and simple Linux compatible computer with high speed GPIO. Read all about it here.
GPIO
The board has male GPIO header pins. The plus models and version 2 have 40 pins, the original models 26 pins.
+---P1---+ 3V3 01 02 5V GPIO0/GPIO2/SDA 03 A/A+ 04 5V GPIO1/GPIO3/SCL 05 B/B+ 06 GND GPIO4 07 2 08 GPIO14/TX GND 09 10 GPIO15/RX GPIO17 11 12 GPIO18 GPIO21/GPIO27 13 14 GND GPIO22 15 16 GPIO23 3V3 17 18 GPIO24 GPIO10/MOSI 19 20 GND GPIO9 /MISO 21 22 GPIO25 GPIO11/SCLK 23 24 GPIO8/CE0 GND 25______26 GPIO7/CE1 EEPROM ID_SD 27 28 EEPROM ID_SC GPIO5 29 A+ 30 GND GPIO6 31 B+ 32 GPIO12 GPIO13 33 2 34 GND GPIO19 35 36 GPIO16 GPIO26 37 38 GPIO20 GND 39 40 GPIO21 +--------+
Ribbon cables may be used to extend the GPIOs. In this instance a female presentation will be given.
For the older models, a 26-pin ribbon is needed.
_________________________________________ / / +----------------------------------------+ | 7 8 25 0V 24 23 0V 18 15 14 0V 5V 5V | | | | | | 0V 11 9 10 3V 22 27 17 0V 4 3 2 3V |1 +-------------------__-------------------+
For PLUS and version 2 models an old style 40-pin IDE ribbon cable may be re-purposed as a GPIO extension.
______________________________________________________________ / / +-------------------------------------------------------------+ | 21 20 16 0V 12 0V SC 7 8 25 0V 24 23 0V 18 15 14 0V 5V 5V | | | | | | 0V 26 19 13 6 5 SD 0V 11 9 10 3V 22 27 17 0V 4 3 2 3V |1 +-----------------------------___-----------------------------+
Pickle Microchip PIC ICSP
Along with USB serial we can use the RPi GPIOs to program PICMicros using Pickle Microchip PIC ICSP.
Memory mapped I/O can be used to drive the GPIOs, however, the GPIO bit-bang driver for Linux may also be utilised on the RPi if preferred.
High Voltage Programming with Vellman K8048
The RPi cannot interface directly with 5V PICMicros nor generate the high voltage required for high voltage ICSP and an interface is required for the GPIOs.
Here is an example for the Velleman K8048. Of course, this particular device can be interfaced using a USB serial port, however, this would be slower.
Low Voltage Programming with VPP at 3V3
Low voltage ICSP at 3V3 can be performed directly from the RPi GPIOs.
The following connections refer to the R-PI GPIO header. Ensure that power is only ever applied from GPIO 3V3 on PIN 1 and never 5V.
Single common data I/O connection (RPI or GPIO bit-bang driver)
R-PI PICMicro GPIO header .pickle ==== ======== =========== ======= 3V3-------------------------------VDD--+ PIN 1 (P1-01) | GND-------------------------------VSS R1 PIN 6 | GPIO04--------R3-470R-------------VPP--+ PIN 7 VPP=4 GPIO25--------R4-470R-------------PGC PIN 22 PGC=25 GPIO24--------R5-470R-------------PGD PIN 18 PGD=24 GPIO22--------R6-470R-------------PGM--R2-+ PIN 15 PGM=22 | /// (R1) 10K !MCLR pull-up (R2) 10K where appropriate (PGM is not present on all devices). (R3..R6) 470R. DEVICE=RPI AUTO-DETECT (modern kernel) DEVICE=RPI0 0 / 0W DEVICE=RPI1 1 DEVICE=RPI2 2 / 02W DEVICE=RPI3 3 DEVICE=RPI4 4 / 400
Display LVP device identity without PGM
p16 lvp id [000000] [PROGRAM] 10000 WORDS [01FFF8] [CONFIG1] F7BA [01FFFA] [CONFIG2] FA10 [01FFFC] [CONFIG3] F8F1 [01FFFE] [CONFIG4] F980 [3FFFFE] [DEVICEID] 5A61 DEV:5A60 (5A:3) REV:1 PIC18LF27J53
Display LVP device identity with PGM
p14 id [0000] [PROGRAM] 2000 WORDS [2000] [USERID0] 0001 . [2001] [USERID1] 0002 . [2002] [USERID2] 0003 . [2003] [USERID3] 0004 . [2004] [RESERVED] 3FFF . [2005] [RESERVED] 3FFF . [2006] [DEVICEID] 2062 DEV:2060 (103) REV:2 PIC16F886 [2007] [CONFIG1] 30E2 [2008] [CONFIG2] 3EFF [2009] [CALIB] 2278 [2100] [DATA] 0100 BYTES
Program and verify LVP device with PGM
p14 program pic16f886.hex Total: 732 p14 verify pic16f886.hex Total: 732 Fail: 0