Springen naar inhoud


Pic Programming Adapter For The Raspberry Pi

Pi Adapter Pic

  • Log in a.u.b. om te beantwoorden
Geen reacties in dit onderwerp

#1 pascalbianca



  • Webmaster
  • 4382 berichten
    Laatst bezocht 05 feb 2020 07:09
  • LocatieSusteren, Nederland, Midden Limburg.

Geplaatst op 10 oktober 2012 - 21:34

Geplaatste afbeelding

The design seeks to adapt the GPIO header so that it may be used for programming PIC microcontrollers, but this does involve a bit more than just physically connecting pins to the target chip.
Most of the PIC family require a 12V programming level, and this setup makes that possible.
The sets of NPN transistors shown in the schematic fragment above are arranged in darlington pairs.
They're actually switching voltage from the 6V linear regulator built into the system using the Pi's 3.3V pins.
There's also a 12V regulator, so you're going to need a power supply that is capable of sourcing more than that.
There are several status LEDs built into the programmer, and it includes support for detecting which chip is being programmed.
So far this covers just four different chips, but we're sure that it could be adapted to fit your own needs.


The circuit for this project is quite simple. Its purpose is to adapt the GPIO pins of the Raspberry Pi to the voltages expected by the PIC. It also provides LEDs for diagnostic purposes.
Since different devices have different pinouts, I recommend that you build this circuit on a breadboard. Of course, you could adapt it for strip board, but I would suggest providing a mechanism to rewire the connections to the IC socket.
You could safely omit the diagnostic and testing LEDs. You will need to supply 12V externally to this circuit, as the Raspberry Pi does not have a voltage source that produces that high a voltage, and also make connectors to connect the Raspberry Pi to the circuit. I recommend connecting the GPIO to match the defaults for the software:

Geplaatste afbeelding

Geplaatste afbeelding

Geplaatste afbeelding


Currently, some of Microchip's 12 bit and 14 bit devices are supported (technically, 8 bit data word size, but 12/14 bit program word size):
  • PIC16F628 (14 bit auto-detected; recommended for beginners)
  • PIC16F54 (12 bit; recommended for advanced users only)
  • PIC16F627 (14 bit auto-detected)
  • PIC16F872 (14 bit auto-detected)
It would not be difficult to add support for more similar devices. To do this, edit "Pic14Bit: s_chips" in pic14.cpp for 14 bit chips, or "Pic12Bit: s_chips" in pic12.cpp and "Arguments: s_ChipIdmap" in rpipic.cpp. Note: the PIC16F28 is recommended as this is the chip that I have tested most, and does not require circuit reconfiguration (such as the PIC16F54 does in order to make it boot). You should note that this software is very experimental, and likely has many bugs.

Building and Running
  • Install scons, and a PIC assembler such as gpasm:
sudo apt-get install gpasm scons

   2. Download and extract the RPiPIC software source to your Raspberry Pi. The current version of the RPiPIC software is: 2012100701.

   3.Change to the source directory and run:

   4.Test the circuit by running:
sudo ./rpipic -r --device-id

If you're using one of the recognised devices, you should see an output like:

Reading device ID...
Finished reading device ID...
Detected chip: pic16f628
Reading device ID...
Finished reading device ID...

If you see:

Reading device ID... Finished reading device ID... Could not find 14 bit chip with ID: 0x0000

then there is something wrong with your circuit.

5. If necessary, erase the PIC:
sudo ./rpipic -e

This command should also be sufficient to disable code protection if it has been enabled.

6. Write a test program to the PIC:
make -C samples
cat samples/pic16f627.hex | sudo ./rpipic -pcdxu
Note: samples/pic16f627.hex also works on the PIC16F628.

7. To test the PIC program:
sudo ./rpipic -b

8. See what else the program can do:
./rpipic --help

Bijgevoegde Bestanden

Ook met taq PI, Pi, Adapter, Pic voorzien

0 gebruiker(s) lezen dit onderwerp

0 lid(leden), 0 bezoeker(s), 0 anonieme gebruikers


[PI] Untitled 1

Met dank aan J├╝rgen voor de jarenlange inzet van visualbasic.be (anno dec 2000)
Met dank aan Mike en Ronneke voor de jarenlange inzet van vbib.be (anno dec 2010)
Met dank aan PascalBianca voor de jarenlange inzet van vbib.be (anno dec 2016)