Pic programing in Linux - Questions

Thread Starter

LeanMeGood

Joined May 13, 2013
2
Hello all.

I am wanting to teach myself some basic PIC programming. I have not done any before and was looking at purchasing a PICkit3. Reason being the MPLabs solution seems to run on Linux. After reading some threads though, it appears the pickit3 does not have Linux drivers.

So I was wondering if anyone here programs PIC's in Linux and if so what hardware/software do you use?

I am just looking to create a simple board with 2 inputs, and 2 outputs.

I hope there are some Linux pic users out there and there is a common way to program pic's. If you can point me towards any information to get me started I would appreciate it very much. All my investigoogling is failing.
 

Markd77

Joined Sep 7, 2009
2,806
Probably the simplest way is to download MPlabX which will work fine and you can develop and program chips with PICKIT2 or PICKIT3
I don't like MPLABX, so there is another way if you get the PICKIT2 instead of the PICKIT3
MPlab 8 runs pretty well using Wine, but can't directly program PICs
There's a command line program (made by Microchip) called pk2cmd which runs in Linux and does that job.
If you have 32 bit Linux just install and then use a line like this in terminal:
pk2cmd /PPIC12F508 /F/home/mint/Desktop/pound/sound.HEX /M
If you have 64 bit Linux you need to compile the source code for pk2cmd, which is fairly straightforward, but you need to get libusb-dev first.
You may also have to use these lines in the terminal (every boot)
PATH=$PATH:/usr/share/pk2
export PATH
I think there is a way to make that automatic, but I don't mind.
 

Thread Starter

LeanMeGood

Joined May 13, 2013
2
Thanks for the advice guys!!
I'm looking into the picaxe way of doing things. It sounds pretty user friendly and everything but it kind of feels like cheating considering they have preloaded their picaxe code to make everything easy for you. Ideally I want to learn something that I could possibly include in a product. Not sure where you stand on OEM development with the picaxe. I am sure its fine but I will have to read the documentation. Would hate to do something I'm not allowed to.

My romanticised view of writing C code, compiling, then running a single CLI instruction to blow it onto a PIC from within Linux may not come to fruition any time soon unless I go for the pickit2. Heh I have to learn C for starters! but I've never been afraid of learning.

I don't really want to limit myself by choosing the pickit2, when the pickit3 apparently does a wider range of chips. I guess I have to do a bit more reading before making a choice.
 

nerdegutta

Joined Dec 15, 2009
2,684
It sounds pretty user friendly and everything but it kind of feels like cheating considering they have preloaded their picaxe code to make everything easy for you.
I feel a bit the same way...

I used MPLAB 8.63 under wine in Linux, and compiling took like forever.At least that was my feeling. Could be my hardware messing with me thou.
 

Markd77

Joined Sep 7, 2009
2,806
I haven't compiled a PIC C program, but general use and simulating for assembler takes a similar time to windows with Mplab 8. Mplab X runs natively under Linux, and in future will be the only version updated for the newest PICs. The same is true for the PICKIT3. MPLAB X has somewhat mixed reviews, some people prefer it.
You probably won't find the PICKIT2 supported devices too restricting, apparently there is a new device file that has a few more than this, but this is what I have available:
www.microchip.com/forums/download.axd?file=2;396218
 

tracecom

Joined Apr 16, 2010
3,944
Ideally I want to learn something that I could possibly include in a product. Not sure where you stand on OEM development with the picaxe. I am sure its fine but I will have to read the documentation. Would hate to do something I'm not allowed to.
There are no restrictions on using the PICAXE in commercial products. The extra cost is the only real constraint.
 

atferrari

Joined Jan 6, 2004
4,769
Probably the simplest way is to download MPlabX which will work fine and you can develop and program chips with PICKIT2 or PICKIT3
I don't like MPLABX, so there is another way if you get the PICKIT2 instead of the PICKIT3
MPlab 8 runs pretty well using Wine, but can't directly program PICs
There's a command line program (made by Microchip) called pk2cmd which runs in Linux and does that job.
If you have 32 bit Linux just install and then use a line like this in terminal:
pk2cmd /PPIC12F508 /F/home/mint/Desktop/pound/sound.HEX /M
If you have 64 bit Linux you need to compile the source code for pk2cmd, which is fairly straightforward, but you need to get libusb-dev first.
You may also have to use these lines in the terminal (every boot)
PATH=$PATH:/usr/share/pk2
export PATH
I think there is a way to make that automatic, but I don't mind.
It does not look simple. One day I will have to be there. Fearing the moment.
 

Markd77

Joined Sep 7, 2009
2,806
A lot of things in Linux aren't simple, I'm still a noob after using it for a few years. Sometimes it takes a while to figure out how to do something, but luckily most problems can be solved easily enough with a little searching.
Most of the popular programs don't require any effort at all to install, it's just the niche ones that can be tricky.
 
Top