Why would someone want to do that? Well, basically for two reasons. First, the classic: βthis should be possibleβ β so lets try it, spend the better part of three weekends and some nights to finally get it working. Might sound stupid, but to me, this is still the best way to really learn a technology or technical topic. Starting with basic C++ skills, I learned a lot about PIC assembler (yep, ICSP for PICs is basically sending a bunch of op codes to the device), PIC memory layout and of course PIC ICSP and controlling GPIOs of the Raspberry Pi.
π Bildschirmfoto 2016-04-11 um 17.25.22
Whatβs the second reason? In my case, I have a PIC connected to the Pi anyway, talking to each other via RS232 β so I figured I could use the spare pins on the connector to assign some GPIOs to the appropriate PINs on the PIC and I donβt need a second connector for ICSP, the board is quite full anyway. Also I can update the firmware without having to build a bootloader (which is a topic on its own).
I case youβre curious, the whole project will eventually be a driver board for my 3 axis CNC. Currently I have a PC + Arduino + GBRL-Shield, but Iβm not happy with the setup. So Iβm planning on building a web based controller on the Pi. This way I can control the machine using a cheap Galaxy Tab A or my mobile Phone. Also I can directly upload the G-Code (produced by Fusion 360 β AWESOME!) from my laptop β either directly or via my NAS or Dropbox or the like (both machines are quite a bit apart).
OMG Andy, all this has already been built?! Yes β it is still fun to try it yourself and learn a whole lot new :-)
Because I found a lot of inspiration and help in the projects of others, I tried and document my code quite well a bit. Also I added a bit of a description on how it all works β so if youβre into ICSP / PICs / GPIOs have a look here: OpenCobra on GitHub
| Reference: | Using the Raspberry Pi to program a Microchip PIC (PIC24) device via ICSP from our JCG partner Andreas Haufler at the Andyβs Software Engineering Corner blog. |
Thank you!
We will contact you soon.
Andreas HauflerApril 13th, 2016Last Updated: April 12th, 2016

This site uses Akismet to reduce spam. Learn how your comment data is processed.