Author Topic: PIC programming - how should I start (on Linux)?  (Read 11520 times)

0 Members and 1 Guest are viewing this topic.

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
PIC programming - how should I start (on Linux)?
« on: January 19, 2014, 12:52:25 am »
I've been programming AVR and ARM controllers for some time already, but the first page of Digikey sorted by price ascending makes PIC very tempting. As far as I know there are different programmers for different families of PICs and some compiler limitations. Can anyone shed some light what should I get to use bottom of the range microcontrollers?

Should I get Pickit3? Are there any tools that work on Linux or at least under Wine? I'd preferably would like to program in C.

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC programming - how should I start (on Linux)?
« Reply #1 on: January 19, 2014, 02:19:15 am »
Sounds like "programming" means two different things in your post.

Programming 1 (as in burning code into a mcu): you need a programmer for that. pickits are cheap but less capable. ICDs more capable but more expensive too.

Programming 2 (as in writing code to make mcu work for you): Sure you can do it in C.

Quote
(on Linux)?

I tend to think it wiser that when you are trying to start, it pays to make your life easier. That means using Windows as much as you can.

Quote
I've been programming AVR and ARM controllers for some time already,

Then this whole thing will be super-easy for you.
================================
https://dannyelectronics.wordpress.com/
 

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 2152
Re: PIC programming - how should I start (on Linux)?
« Reply #2 on: January 19, 2014, 02:37:59 am »
I use "gputils" and a text editor. To transfer the program to the PIC I use "PICdev"; this has several options for different programming hardware , e.g. from a few transistors hung on the serial port, or the Velleman K8048 kit, or even the PICkit II will plug-in without any hassle. All under Linux.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28601
  • Country: nl
    • NCT Developments
Re: PIC programming - how should I start (on Linux)?
« Reply #3 on: January 19, 2014, 11:07:57 am »
I've been programming AVR and ARM controllers for some time already, but the first page of Digikey sorted by price ascending makes PIC very tempting. As far as I know there are different programmers for different families of PICs and some compiler limitations. Can anyone shed some light what should I get to use bottom of the range microcontrollers?
You will want the Hitech PIC compiler. That costs serious money so you'll have to use lots of PICs to save some money. And then you'll need to worry about in which memory bank to put a variable. I'd forget about Wine too. A lot of software doesn't work well. Better use Virtualbox to make a virtual machine.

All in all you are probably better off looking at cheap MSP430 devices.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: PIC programming - how should I start (on Linux)?
« Reply #4 on: January 19, 2014, 12:02:42 pm »
Should I get Pickit3? Are there any tools that work on Linux or at least under Wine? I'd preferably would like to program in C.
Microchip's MPLAB X IDE and XC8 compiler are available for (x86) Linux.

Offline Maxlor

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Re: PIC programming - how should I start (on Linux)?
« Reply #5 on: January 19, 2014, 12:48:33 pm »
PICkit3 as programmer, MPLABX as IDE, XC8 as compiler. The PICkit3 isn't that expensive, the software is free, it's supported by Microchip and it all works just fine on Linux. Try it first before evaluating 3rd party tools.
 

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: PIC programming - how should I start (on Linux)?
« Reply #6 on: January 19, 2014, 03:47:19 pm »
PICkit3 as programmer, MPLABX as IDE, XC8 as compiler. The PICkit3 isn't that expensive, the software is free, it's supported by Microchip and it all works just fine on Linux. Try it first before evaluating 3rd party tools.

dough! Thanks! I've downloaded it and it works ok, at least it runs and compiles the code.

Now is Pickit 3 THE programmer for all the MCU families?

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: PIC programming - how should I start (on Linux)?
« Reply #7 on: January 19, 2014, 03:58:53 pm »
Now I've read this thread and I'm totally confused...  :scared:

https://www.eevblog.com/forum/microcontrollers/pickit-3-still-seems-dodgy

Is it really that bad?

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC programming - how should I start (on Linux)?
« Reply #8 on: January 19, 2014, 04:04:27 pm »
xc8=picc/picc18 + (that dreaded) ocg.

Quote
Now I've read this thread and I'm totally confused...

That means the internet has fulfilled its promise, :)
================================
https://dannyelectronics.wordpress.com/
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4335
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: PIC programming - how should I start (on Linux)?
« Reply #9 on: January 19, 2014, 04:32:42 pm »
I use MPLABX and my PICKIT3 on a daily basis.

It just works. I have no complaints. No crashes, no random errors, no failures to connect, it's just a dependable tool which I can use to get the job done.

For what it's worth, I wouldn't start on Linux, I'd start on Windows 7.

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC programming - how should I start (on Linux)?
« Reply #10 on: January 19, 2014, 04:43:30 pm »
I always wondered about the need so many have to develop on Linux. I am not aware of any firm that officially supports it. The tool vendors don't support it - which totally makes sense given the lack of material demands. Yet, there are always people who insist on Linux - who are those people  and what makes it so indispensible that they have to develop on Linux?

If you make a living writing code, it seems to me that you want your tools, including the os to be reliable. Linux would be on bottom of that list for me.
================================
https://dannyelectronics.wordpress.com/
 

Offline Monkeh

  • Super Contributor
  • ***
  • Posts: 8162
  • Country: gb
Re: PIC programming - how should I start (on Linux)?
« Reply #11 on: January 19, 2014, 05:03:42 pm »
I always wondered about the need so many have to develop on Linux. I am not aware of any firm that officially supports it. The tool vendors don't support it - which totally makes sense given the lack of material demands. Yet, there are always people who insist on Linux - who are those people  and what makes it so indispensible that they have to develop on Linux?

If you make a living writing code, it seems to me that you want your tools, including the os to be reliable. Linux would be on bottom of that list for me.

Let's not start a great big OS debate, here, but.. As someone who's used Linux for many years in many applications, Linux is a reliable OS. It is used and officially supported by many companies, for many software applications, hardware tools, embedded devices, pieces of military hardware, and the very infrastructure in place to allow you to post on this forum relies on it heavily.

I have always wondered about the need so many have to use a huge pile of legacy code with so little flexibility..
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28601
  • Country: nl
    • NCT Developments
Re: PIC programming - how should I start (on Linux)?
« Reply #12 on: January 19, 2014, 05:09:42 pm »
@dannyf: You are missing out on a lot of good stuff. I use Linux for software development almost exclusively. Even software intended to run on Windows. Linux makes life a whole lot easier.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC programming - how should I start (on Linux)?
« Reply #13 on: January 19, 2014, 05:11:13 pm »
The issue isn't linuxs own reliability but the combined reliability of Linux and tools running on top of it.

as to companies that support officially development on Linux - they allow and support mcu software development on Linux, I would love to know a few as I have run into no one.
================================
https://dannyelectronics.wordpress.com/
 

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: PIC programming - how should I start (on Linux)?
« Reply #14 on: January 19, 2014, 05:13:11 pm »
I always wondered about the need so many have to develop on Linux. I am not aware of any firm that officially supports it. The tool vendors don't support it - which totally makes sense given the lack of material demands. Yet, there are always people who insist on Linux - who are those people  and what makes it so indispensible that they have to develop on Linux?

Well, I'm a one band man and I use Linux. It's an OS of my choice after I've used windows and mac for quite a long time. That's where the need comes from. I don't want to have a separate machine (real or virtual) to only run some tools.

If you make a living writing code, it seems to me that you want your tools, including the os to be reliable. Linux would be on bottom of that list for me.

Linux is not that unreliable as you might think. Lot's of companies (at least software companies) are using Linux as a standard developement platform. But I get your point - if you need a tool, you use the OS the tool needs. It's more the question of convenience in my case. Opensource toolchains run smootly for AVR and ARM plaftorms on Linux.
 

Offline poorchava

  • Super Contributor
  • ***
  • Posts: 1673
  • Country: pl
  • Troll Cave Electronics!
Re: PIC programming - how should I start (on Linux)?
« Reply #15 on: January 19, 2014, 06:08:29 pm »
How should you start? You should not.

Pics are cheap for a reason,  and the reason is that vast majority of them  have truckloads of bugs.  On top of that recent Microchip compilers are artificially crippled (output assembly is artificially bloated on purpose by insertion of Jin umps and nops)  in free versions in order for them bo be able to brag about increased code efficiency of paid versions.

Only thing good about Pics is that development tools are indeed great value for money and they are very affordable for pretty much everyone.

If you are familiar with ARM,  stick to them.
I love the smell of FR4 in the morning!
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28601
  • Country: nl
    • NCT Developments
Re: PIC programming - how should I start (on Linux)?
« Reply #16 on: January 19, 2014, 06:22:37 pm »
The issue isn't linuxs own reliability but the combined reliability of Linux and tools running on top of it.

as to companies that support officially development on Linux - they allow and support mcu software development on Linux, I would love to know a few as I have run into no one.
NXP supports they LPCExpresso tools for Linux. Same for TI's Code Composer Studio. If you look you'll come up with a longer list.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Monkeh

  • Super Contributor
  • ***
  • Posts: 8162
  • Country: gb
Re: PIC programming - how should I start (on Linux)?
« Reply #17 on: January 19, 2014, 06:27:37 pm »
The issue isn't linuxs own reliability but the combined reliability of Linux and tools running on top of it.

as to companies that support officially development on Linux - they allow and support mcu software development on Linux, I would love to know a few as I have run into no one.

http://www.ti.com/tool/ccstudio
https://www.microchip.com/pagehandler/en-us/family/mplabx/

Didn't look too hard, then..
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4335
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: PIC programming - how should I start (on Linux)?
« Reply #18 on: January 19, 2014, 07:20:18 pm »
How should you start? You should not.

Don't start learning about one of the most widely used, versatile and inexpensive microcontroller families out there?

Great advice there.  :palm:

Quote
Pics are cheap for a reason,  and the reason is that vast majority of them  have truckloads of bugs.

They're not that cheap. Compare and contrast like-for-like in terms of pin count and peripheral set, and you'll find that families like STM32 are actually cheaper as well as being much higher performance - but without the ease of use and some of the hardware capabilities that PICs tend to have. You'll struggle to find 5V operation or true EEPROM, for example.

As for the bugs, there certainly are plenty of them, but they're clearly documented in readily available errata. Decide whether the bugs in any given device actually matter to your application, and work around them if necessary.

Quote
On top of that recent Microchip compilers are artificially crippled

True - but not an issue unless you're struggling for performance.

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC programming - how should I start (on Linux)?
« Reply #19 on: January 19, 2014, 08:12:47 pm »
It looks like it will take a few tries to get people to understand the question: of those companies that develop applications on mcis, which supports the use if linux-based tools?

hint: mcu OEMs shall not apply.
================================
https://dannyelectronics.wordpress.com/
 

Offline Monkeh

  • Super Contributor
  • ***
  • Posts: 8162
  • Country: gb
Re: PIC programming - how should I start (on Linux)?
« Reply #20 on: January 19, 2014, 08:18:12 pm »
It looks like it will take a few tries to get people to understand the question: of those companies that develop applications on mcis, which supports the use if linux-based tools?

hint: mcu OEMs shall not apply.

Still not understanding the question.

Why would a third party company support your use of a tool?
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: PIC programming - how should I start (on Linux)?
« Reply #21 on: January 19, 2014, 09:30:15 pm »
The irony being that Windows is a pretty bad development environment. Everyone ends up having to install a ton of Unix emulation tools just to make it bearable.

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28601
  • Country: nl
    • NCT Developments
Re: PIC programming - how should I start (on Linux)?
« Reply #22 on: January 19, 2014, 10:14:41 pm »
It looks like it will take a few tries to get people to understand the question: of those companies that develop applications on mcis, which supports the use if linux-based tools?

hint: mcu OEMs shall not apply.
Mentor Graphics for starters:
http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC programming - how should I start (on Linux)?
« Reply #23 on: January 19, 2014, 10:20:31 pm »
Quote
Still not understanding the question.

Why would a third party company support your use of a tool?

One more try:

Of those companies that make a living developing code for mcus (an application shop), which one uses linux as official development environment?

ie. this question is trying to get to the demand side of the equation: who uses linux development environment?
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC programming - how should I start (on Linux)?
« Reply #24 on: January 19, 2014, 10:23:30 pm »
Quote
I'm a one band man and I use Linux.

That I think is the case: Linux development tools are used mostly by individuals / small shops on smaller scales.

That contributes to the observation that most IDE vendors don't sell Linux environments.

I for one have never seeing a company utilizing Linux environments to develop mcus (officially). You will have individuals doing it on a one-off or off-work basis, however - and that makes total sense.
================================
https://dannyelectronics.wordpress.com/
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11714
  • Country: my
  • reassessing directives...
Re: PIC programming - how should I start (on Linux)?
« Reply #25 on: January 19, 2014, 11:00:55 pm »
The irony being that Windows is a pretty bad development environment. Everyone ends up having to install a ton of Unix emulation tools just to make it bearable.
what?! penguin strikes again.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Maxlor

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Re: PIC programming - how should I start (on Linux)?
« Reply #26 on: January 20, 2014, 01:02:17 am »
Returning back to the actual topic: The PICkit3 hasn't been 100% reliable for me either. Sometimes, it needs a reset by unplugging/replugging the USB cable. But it's happening rarely, so it doesn't bother me too much. Whenever it has happened, the issue has always been communication being lost between MPLABX and the PICkit3, I've never encountered any kind of corruption or misprogramming.

as for XC8: yeah, the code it generates is bad (using the free version). But... it doesn't really matter, imo. If you run against the constraints because your code runs too slowly or doesn't fit into the flash, you can usually just increase the clock speed or use a PIC with more flash. If you're already using the biggest and fastest PIC, well, ARM's probably going to work out better for you, because the next firmware revision will need to have even more features.

As for the PIC downsides, realistically, they're true, but most of the time they don't matter. This little dev setup that Microchip built gives you a huge amount of flexibility, letting you work with everything from small 6-pin micros to 32bit chips, with no other investment than a PICkit3, which is cheap. The docs are excellent. The chips... well, most bugs are usually fixed by the 3rd or 4th silicon revision (I just wonder why I see the same old bugs all over again whenever they release a new chip...) And there are faster chips out there, and ones that are easier to program in ASM. But usually you don't have quite the same selection of different parts, which might lead to having to use a bigger package than you really need for example. And most other setups don't have quite the same ease of use (unless you wan't to step into Arduino-land.) What I'm saying is, there's tradeoffs at every corner, I haven't found the perfect ecosystem yet. PICs are pretty nice, not exactly the holy grail, but not rubbish either. I enjoy using them.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC programming - how should I start (on Linux)?
« Reply #27 on: January 20, 2014, 02:42:20 am »
As long as we are dealing with computers / software, there will always be bugs, Microchip or otherwise.

I would say that Micorchip mcus are quite bug free, based on my experience. If you want to see buggy chips, pick the erratas for some of the Luminary chips.

As to XC8, unless you have to (for newer chips for example), I would say stay with your older Hi-tech non-ocg compilers - they produce better code, even the standard version, than the xc8 in free mode.
================================
https://dannyelectronics.wordpress.com/
 

Offline Monkeh

  • Super Contributor
  • ***
  • Posts: 8162
  • Country: gb
Re: PIC programming - how should I start (on Linux)?
« Reply #28 on: January 20, 2014, 06:10:00 am »
Quote
Still not understanding the question.

Why would a third party company support your use of a tool?

One more try:

Of those companies that make a living developing code for mcus (an application shop), which one uses linux as official development environment?

ie. this question is trying to get to the demand side of the equation: who uses linux development environment?

I'm sure there are many; I don't work for them. A random forum is not the place to ask.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28601
  • Country: nl
    • NCT Developments
Re: PIC programming - how should I start (on Linux)?
« Reply #29 on: January 20, 2014, 10:01:41 am »
Quote
Still not understanding the question.

Why would a third party company support your use of a tool?

One more try:

Of those companies that make a living developing code for mcus (an application shop), which one uses linux as official development environment?

ie. this question is trying to get to the demand side of the equation: who uses linux development environment?
One of my former employers used Linux for all embedded development. The company (>200 employees) got sold for 60 million euro a couple of years ago. Is that good enough?
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline meerweten

  • Contributor
  • Posts: 42
  • Country: be
    • Greendigit Electronics
Re: PIC programming - how should I start (on Linux)?
« Reply #30 on: January 22, 2014, 08:16:46 pm »
Starting with PIC's on linux isn't that easy, just tried it myself (due to problems with windows stability :BANG: )

Microchip actualy has a command line interface for the pickit 2 (don't know about the pickit 3, i only have the pickit 2 so don't bother looking for the pickit 3 support on linux), there are gui's out there on the big internet that work, but for most you need to start (run) them un root mode, cuss the pk2cmd is (on my computer) is only usable as a root user. but it took me 2-3 hours after i got it working, (even following a working tutorial)
the "handy" thing about the pickit 2 (and probably 3 to) is that you can just use it for all their chips (well support for the pickit 2 ended and no new devices are addad, but i don't need them)
in the pickit 2 there is a simple logic analizer included and a serial communication (didn't try them on linux yet, but works fine under windows).

i've tried working with the avr's but i always gone back to pic's, for the simple reason i can get them cheaper :D
Meerweten, Want meten is Weten
 

Offline BloodyCactus

  • Frequent Contributor
  • **
  • Posts: 482
  • Country: us
    • Kråketær
Re: PIC programming - how should I start (on Linux)?
« Reply #31 on: January 23, 2014, 03:39:05 pm »
I have no problem running MPLABX and PICKit3 on linux at all. Also run chipkit MPIDE /avrdude for the 'arduino' style pic boards with no issues.. shrug.

pic32prog works fine under linux, which supports pic32 chips using pickit2, which is nice if you have a pickit2 and not pickit3.
-- Aussie living in the USA --
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf