EmbeddedRelated.com
Forums
The 2026 Embedded Online Conference

PIC development on Linux

Started by Tim Wescott May 5, 2014
On Mon, 05 May 2014 14:14:51 -0500, Tim Wescott wrote:

> On Mon, 05 May 2014 12:10:07 -0700, Paul Rubin wrote: > >> Tim Wescott <tim@seemywebsite.really> writes: >>> I looked in the DigiKey catalog for microprocessors and sorted by >>> price. The PIC parts are at the absolute bottom of the list, and >>> $0.40/each, qty 10. The next-cheapest is an STM8 for half again as >>> much. >> >> I figured in a short run product, saving a few hours of engineering >> would matter more than a few cents difference in parts costs, but ok. > > It's a short-run HOBBY project, so I can be an unreasonable tight wad if > I want to. But yes, that's a good point.
If your project grows to more than just a few to the 50s or 100s look at having Microchip program them for you. I did this a few years ago. Granted my device was probably a lot larger than what you are planning to use but it saved me a lot of time. You can order directly from Microchip, buy.microchip.com (also a good place to look if the distributor is out of stock or does not carry the package you want) -- Chisolm Republic of Texas
On Tue, 06 May 2014 01:03:41 +0200, David Brown wrote:

> On 05/05/14 18:46, Tim Wescott wrote: >> Is anyone in the group doing PIC development on Linux? >> >> I've got a project that really demands a sort of turbocharged 555, for >> which a PIC 10xxx or 12xxx would be perfect. I'm pretty sure it's >> small enough that it's sensible to write it entirely in assembly, or >> possibly in just a few lines of C. >> >> This is for a short-run product, so I not only need to know how to do >> development, but information on device programmers that do a >> "production ready" job would be nice, too. >> >> TIA. >> >> > I never really thought of PIC's as being "perfect" for any job - it's a > great many years since I happily said goodbye to them. There are lots > of small micros for incredibly low prices - you can even get a Cortex > M0+ device for under half a dollar, or AVR ATTINY devices at even less. > So unless you are using tens of thousands of these devices, PIC's > don't make any sort of economic sense. > > If you are looking for something more fun, try "greenpak" devices from > <http://www.silego.com/>. They should fit the bill for a "turbocharged > 555", and are very cheap. I haven't tried them myself - I'm still > looking for an excuse to play with them.
I understand that DigiKey is an expensive place to buy electronics (but oh, the convenience!). The cheapest Cortex M0 part they have in qty 10 is $1.05 (a Freescale MKL02Z8VFG4), going down to $0.80 in qty 500, while the cheapest microcontroller they have (PIC10F200T-I/OT) is $0.40 in qty 10, going down to $0.35 in qty 100. Maybe if I were buying 10000 at a time, straight from the factory, I could get a half-dollar M0+. But I'm not, and I don't think I can. (I may go with the M0 part anyway, if I can still meet my BOM-cost goals.) -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On 06/05/14 22:59, Tim Wescott wrote:
> On Tue, 06 May 2014 01:03:41 +0200, David Brown wrote: > >> On 05/05/14 18:46, Tim Wescott wrote: >>> Is anyone in the group doing PIC development on Linux? >>> >>> I've got a project that really demands a sort of turbocharged 555, for >>> which a PIC 10xxx or 12xxx would be perfect. I'm pretty sure it's >>> small enough that it's sensible to write it entirely in assembly, or >>> possibly in just a few lines of C. >>> >>> This is for a short-run product, so I not only need to know how to do >>> development, but information on device programmers that do a >>> "production ready" job would be nice, too. >>> >>> TIA. >>> >>> >> I never really thought of PIC's as being "perfect" for any job - it's a >> great many years since I happily said goodbye to them. There are lots >> of small micros for incredibly low prices - you can even get a Cortex >> M0+ device for under half a dollar, or AVR ATTINY devices at even less. >> So unless you are using tens of thousands of these devices, PIC's >> don't make any sort of economic sense. >> >> If you are looking for something more fun, try "greenpak" devices from >> <http://www.silego.com/>. They should fit the bill for a "turbocharged >> 555", and are very cheap. I haven't tried them myself - I'm still >> looking for an excuse to play with them. > > I understand that DigiKey is an expensive place to buy electronics (but > oh, the convenience!). The cheapest Cortex M0 part they have in qty 10 > is $1.05 (a Freescale MKL02Z8VFG4), going down to $0.80 in qty 500, while > the cheapest microcontroller they have (PIC10F200T-I/OT) is $0.40 in qty > 10, going down to $0.35 in qty 100. > > Maybe if I were buying 10000 at a time, straight from the factory, I > could get a half-dollar M0+. But I'm not, and I don't think I can. > > (I may go with the M0 part anyway, if I can still meet my BOM-cost goals.) >
The point is, if you are buying in quantities of 10, who cares if it is $1 or $0.50 per part? Why do you care if it is $20 per part? The time you spend looking up different prices on digikey and reading the datasheets of the different chips is worth far more than all the microcontrollers put together - even if they are $20 each. If you can sell your time at $100 per hour, and using a real microcontroller rather than a PIC saves you 2 days work, then you are better off buying $1 Cortex M0 rather than $0.40 PIC's even if you are making 2500 boards. Do the maths, and figure this out. Quibbling about cents for the critical component does not make economic sense unless you are a starving student or making hundreds of thousands of devices. Even if you are doing this for fun and not getting paid, your time is still worth more than these chips.
David Brown <david.brown@hesbynett.no> wrote:
> If you can sell your time at $100 per hour, and using a real > microcontroller rather than a PIC saves you 2 days work, then you are > better off buying $1 Cortex M0 rather than $0.40 PIC's even if you are > making 2500 boards.
The elephant in this room is the software. You'll burn more time trying to figure out why it doesn't work, becaues you didn't notice that page 397 of the datasheet says you have to set bit 17 of RTIMFLG0 at least 119us before you clear bit 23 of GLCPLOP, otherwise the data will be incorrectly latched/lost/set on fire. Or that erratum note #294322 on the website points out that they forgot to mention in the datasheet and marketing material that the first serial port has never actually worked. So far I haven't got a good handle on whose architecture is least prone to these kinds of fiddly details. Some of them try to mask it with config software generation - I'm uncertain how well they manage it. Theo
On 07/05/14 01:59, Theo Markettos wrote:
> David Brown <david.brown@hesbynett.no> wrote: >> If you can sell your time at $100 per hour, and using a real >> microcontroller rather than a PIC saves you 2 days work, then you are >> better off buying $1 Cortex M0 rather than $0.40 PIC's even if you are >> making 2500 boards. > > The elephant in this room is the software. You'll burn more time trying to > figure out why it doesn't work, becaues you didn't notice that page 397 of > the datasheet says you have to set bit 17 of RTIMFLG0 at least 119us before > you clear bit 23 of GLCPLOP, otherwise the data will be incorrectly > latched/lost/set on fire. Or that erratum note #294322 on the website > points out that they forgot to mention in the datasheet and marketing > material that the first serial port has never actually worked. >
That is absolutely true - and again shows why fussing about the price of sub-dollar parts is irrelevant here. (Of course this concerns only the complicated parts such as the microcontroller - shaving cents off the price of resistors, LEDs, etc., is often worth the effort.) Development time is a far bigger cost than the stock of microcontrollers. Reliability of the parts, development tools, familiarity and experience of the developers are all vital. The PICs have a good reputation for reliability, and few issues with weird errata (AFAIK), but they are a mess to program. With a Cortex chip, you can use a proper compiler, write normal C (or C++), and have a selection of quality development tools. And since the OP is familiar with Cortex development, that familiarity alone will make the difference.
> So far I haven't got a good handle on whose architecture is least prone to > these kinds of fiddly details. Some of them try to mask it with config > software generation - I'm uncertain how well they manage it. > > Theo >
Tim Wescott <tim@seemywebsite.really> writes:

> Is anyone in the group doing PIC development on Linux?
I did some in the previous century. From the Makefile I can tell that I was using gpasm. Unfortunately I don't have it (gputils) installed on my current Linux system, but it's available on sourceforge.
> I've got a project that really demands a sort of turbocharged 555, for > which a PIC 10xxx or 12xxx would be perfect. I'm pretty sure it's small > enough that it's sensible to write it entirely in assembly, or possibly > in just a few lines of C. > > This is for a short-run product, so I not only need to know how to do > development, but information on device programmers that do a "production > ready" job would be nice, too.
For more professional work I did ISP through the devices connected to the PIC (FPGA/JTAG). For some of my hobby projects I used the NOPPP (No parts pic programmer) with the programmer running on Linux. //Petter -- .sig removed by request.
On 2014-05-06, David Brown <david.brown@hesbynett.no> wrote:
> > The point is, if you are buying in quantities of 10, who cares if it is > $1 or $0.50 per part? Why do you care if it is $20 per part? The time > you spend looking up different prices on digikey and reading the > datasheets of the different chips is worth far more than all the > microcontrollers put together - even if they are $20 each. > > If you can sell your time at $100 per hour, and using a real > microcontroller rather than a PIC saves you 2 days work, then you are > better off buying $1 Cortex M0 rather than $0.40 PIC's even if you are > making 2500 boards.
But design effort cuts both ways in short runs. If you're making three of a circuit that has a low chip count then the ability to put it on stripboard can save a decent of board design work as well as time and/or expense getting those boards fabricated. 5V and 0.1" pitch through hole are still very desirable for that kind of situation. PICs are very amenable in that regard since they're available in DIP from PIC10 all the way up to the more capable PIC18 units. ARM isn't anywhere near as convenient. -- Andrew Smallshaw andrews@sdf.lonestar.org
On 2014-05-07, Petter Gustad <newsmailcomp6@gustad.com> wrote:
> Tim Wescott <tim@seemywebsite.really> writes: > >> Is anyone in the group doing PIC development on Linux? > > I did some in the previous century. From the Makefile I can tell that I > was using gpasm. Unfortunately I don't have it (gputils) installed on my > current Linux system, but it's available on sourceforge.
> For more professional work I did ISP through the devices connected to > the PIC (FPGA/JTAG). For some of my hobby projects I used the NOPPP (No > parts pic programmer) with the programmer running on Linux.
+1 for gpasm. Persoanlly I've had far less trouble with it inthe past than MPASM which has had me tearing my hair out with unnecessary silliness in the past. One issue that comes to mind are an absurdly short limit on the absolute pathname of any input file - it was raised in one revision perhaps five years ago, but even that raised limit was still too low. Come on, this is pure amateurism. Another was that you can't hang a label on a macro invocation. Personally I can't see any legitimate reason for that to be the case other than pure idleness. Two isolated examples to be sure, but they create an impression of a toy rather than a tool to rely on. Gpasm has no such silliness. -- Andrew Smallshaw andrews@sdf.lonestar.org
David Brown wrote:

> On 07/05/14 01:59, Theo Markettos wrote: >> David Brown <david.brown@hesbynett.no> wrote: >>> If you can sell your time at $100 per hour, and using a real >>> microcontroller rather than a PIC saves you 2 days work, then you are >>> better off buying $1 Cortex M0 rather than $0.40 PIC's even if you are >>> making 2500 boards. >> >> The elephant in this room is the software. You'll burn more time trying >> to figure out why it doesn't work, becaues you didn't notice that page >> 397 of the datasheet says you have to set bit 17 of RTIMFLG0 at least >> 119us before you clear bit 23 of GLCPLOP, otherwise the data will be >> incorrectly >> latched/lost/set on fire. Or that erratum note #294322 on the website >> points out that they forgot to mention in the datasheet and marketing >> material that the first serial port has never actually worked. >> > > That is absolutely true - and again shows why fussing about the price of > sub-dollar parts is irrelevant here. (Of course this concerns only the > complicated parts such as the microcontroller - shaving cents off the > price of resistors, LEDs, etc., is often worth the effort.) Development > time is a far bigger cost than the stock of microcontrollers.
OTOH, I was attracted back to PIC by application note AN1298, describing a way to do capacitive touch-sensing with practically nothing, and that was ideal for a particular project. The whole PIC application was programmed and tested with about the same level of effort that it took to get the clocks set up on a Cortex, as I saw when I started looking at doing the port. IMHO, Cortex is a high-effort architecture, and I want to see a corresponding return before I approach it. The Cortex port will be worth it if it manages to also replace the other controller that runs beside the PIC. Mel.
Andrew Smallshaw <andrews@sdf.lonestar.org> wrote:

> But design effort cuts both ways in short runs. If you're making > three of a circuit that has a low chip count then the ability to > put it on stripboard can save a decent of board design work as well > as time and/or expense getting those boards fabricated. 5V and 0.1" > pitch through hole are still very desirable for that kind of > situation. PICs are very amenable in that regard since they're > available in DIP from PIC10 all the way up to the more capable PIC18 > units. ARM isn't anywhere near as convenient. >
There are even 16 bit PIC24F and dsPIC30F devices in DIP packages that run at 5V. There's 17 to choose from in packages fom 18 to 40 pins. The XC8 and XC16 compilers for the 8 and 16 bit PIC families are usable in free mode (althogh most optimizations are disabled) and are even legal to use commercially. -- Ian Malcolm. London, ENGLAND. (NEWSGROUP REPLY PREFERRED) ianm[at]the[dash]malcolms[dot]freeserve[dot]co[dot]uk [at]=@, [dash]=- & [dot]=. *Warning* HTML & >32K emails --> NUL
The 2026 Embedded Online Conference