1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

PIC development on Linux

Discussion in 'Embedded' started by Tim Wescott, May 5, 2014.

  1. Tim Wescott

    Tim Wescott Guest

    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.
     
    Tim Wescott, May 5, 2014
    #1
    1. Advertisements

  2. Tim Wescott

    Mel Wilson Guest

    I did one thing with the MPLAB IDE and PICkit3, running from Ubuntu 10.04.
    No complications as I recall, I just installed it and it did what it does.

    Mel.
     
    Mel Wilson, May 5, 2014
    #2
    1. Advertisements

  3. Tim Wescott

    Mel Wilson Guest

    A long time coming, but it's here now. And remember XKCD: whenever you
    assert something you make an ass of the Emergency Response Team.

    Mel.
     
    Mel Wilson, May 5, 2014
    #3
  4. Tim Wescott

    Paul Rubin Guest

    I think the low end AVR8's are more popular in some circles. There are
    some FOSS Linux tools around for them. I like the tiny packages and
    have never understood why they don't put more powerful cpus in packages
    like that. I'm not sure about the programming hardware.

    Data: http://www.atmel.com/devices/ATTINY4.aspx

    If you don't mind a bigger part, the TI MSP430 Launchpad board can
    program the Value Line DIP16/DIP20 processors and it's crazy cheap.
    They sold them for $4.30 for a long time though they're around $10 now.
     
    Paul Rubin, May 5, 2014
    #4
  5. Tim Wescott

    Tim Wescott Guest

    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. And they're
    available in SOT-23-6 packages, which is about as small as I'll ever need.

    From a hardware designer's perspective, the PIC is a lot sweeter than the
    Atmel, too -- not that I need it here, but the PIC can drive something
    like five times as much current per pin as the Atmel.

    Does anyone know if Atmel is better at delivery than they were a few
    years ago? I know they had a pretty bad rep, but then they changed
    management around 08 or so.
     
    Tim Wescott, May 5, 2014
    #5
  6. Tim Wescott

    Paul Rubin Guest

    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.
    Interesting and worth knowing about, thanks.
    Looks like distributors like Digikey and Mouser have plenty in stock.
     
    Paul Rubin, May 5, 2014
    #6
  7. Tim Wescott

    Tim Wescott Guest

    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.
     
    Tim Wescott, May 5, 2014
    #7
  8. Tim Wescott

    texane Guest

    Hi,

    I used SDCC and PK2CMD for PIC18F on LINUX and it worked well
    enough for small sized projects. For code instance, you can refer to:
    https://github.com/texane/slosyn/tree/master/device

    Then, I used the MPLABX toolchain. I think this is the way to go for
    MICROCHIP devices.
     
    texane, May 5, 2014
    #8
  9. Tim Wescott

    David Brown Guest

    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.
     
    David Brown, May 6, 2014
    #9
  10. Tim Wescott

    Joe Chisolm Guest

    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)
     
    Joe Chisolm, May 6, 2014
    #10
  11. Tim Wescott

    Tim Wescott Guest

    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, May 6, 2014
    #11
  12. Tim Wescott

    David Brown Guest

    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, May 6, 2014
    #12
  13. 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
     
    Theo Markettos, May 7, 2014
    #13
  14. Tim Wescott

    David Brown Guest

    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.
     
    David Brown, May 7, 2014
    #14
  15. 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.

    //Petter
     
    Petter Gustad, May 7, 2014
    #15
  16. 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, May 7, 2014
    #16
  17. +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, May 7, 2014
    #17
  18. Tim Wescott

    Mel Wilson Guest

    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.
     
    Mel Wilson, May 7, 2014
    #18
  19. Tim Wescott

    Ian Malcolm Guest

    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, May 7, 2014
    #19
  20. Tim Wescott

    Tim Wescott Guest

    OK. FINE. Be that way.

    The board is laid out using an LPC811M001JDH16. My BOM cost goal, in qty
    10, was $5. It's below that, even if I buy boards at $1.66 per square
    inch from OshPark (it's a little circuit, both in schematic and in actual
    size).

    As soon as I verify that OpenOCD works with the part (it doesn't look
    like version 0.7 does, but I have high hopes for version 0.8), I'll send
    stuff off to the board house.
     
    Tim Wescott, May 7, 2014
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.