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.

Source code for CAN Implementations

Discussion in 'Embedded' started by raj, Jul 10, 2007.

  1. raj

    raj Guest

    Dear All

    I Kindly request the Source code links for CAN Implementation as I am
    very curious about insights. I had been working in CAN testing for
    Past two years. Now I desperately want to shift my self in to
    Implementation part to learn and exp more.

    I am thankful to every one, in encourage many members of this group
    in the learning process.

    Thanking you all

    Rajesh Maddukuri
    raj, Jul 10, 2007
    1. Advertisements

  2. raj

    dathome Guest

    Hi Raj,

    This depends on how much detail you need! I've written my own small drivers
    for C164 and have also used drivers from Vector. The Vector ones are pretty
    daunting to get started with and it's unlikely you'll be able to get hold of
    them anyway unless you know someone ;-). However it might be worth checking
    out these company sites and you may be able to get sample code, the Infineon
    site is probably a good bet as is Microchip, but the Microchip CAN
    peripheral isn't as good.

    Infineon -> Datasheets for the XC family are very good in the CAN
    Vector Informatik

    Are you working in a particular industry or is this for self study as a
    matter of interest.

    dathome, Jul 16, 2007
    1. Advertisements

  3. raj

    Urs Beeli Guest

    Unfortunately I am not aware of any CAN implementation that are open source
    or in the public domain.

    In my former job we have been using CAN on both an infineon C167/C164 and on
    a PPC5200. On the former we wrote our own CAN and CANopen library, on the
    latter we bought the Vector CAN/CANopen stack and had them adapt their CAN
    driver for our hardware.
    I doubt you would get them without dishing out some serious money! However,
    despite being daunting, they are a fine piece of software, I was very much
    impressed with them (both their performance and their source code). Also,
    their people are competent and helpful.
    Besides those, you might also want to check out http://www.can-cia.org/,
    they have some documentation both on CAN and CANopen, thought some of it is
    not available for free.

    Urs Beeli, Jul 18, 2007
  4. raj

    dathome Guest

    I've got to disagree somewhat with the comments regarding how good the
    Vector drivers were with particular reference to the coding standards used.
    They were littered with continue and break statements as well as having
    bunches of code that was compiled dependant on #defines. Not at all MISRA-C
    compliant despite being for vehicle platforms! Additionally the footprint
    was way bigger than necessary occupying about 8-9k on a 16bit micro. They
    obviously have very good sales teams to have got all the major car
    manufacturers to use it.

    When I asked them about MISRA compliance and SIL2 in particular they had no
    good answer and technically if you are using a non SIL2 compliant drivers in
    your application then you can't claim your system to be SIL2 even if all
    your code has been developed in this way. Bit of a problem when the
    customer stipulates both SIL2 and to use the Vector drivers!

    To be fair though the support was good including on one occasion that I
    visited them at short notice in their offices and sat with a developer to
    fix a problem I had, well worth the ~£1000 round trip cost as it was
    critical to the project. The execution time of the various tasks also
    seemed pretty good as well which suggests that a large amount of the code
    was never actually used.
    dathome, Jul 18, 2007
  5. raj

    Urs Beeli Guest

    Fair enough. As we were using CANopen in a non security critical environment
    MISRA-C and SIL2 were not something we cared about greatly :)

    What I tried to say was that I found the code well enough written to easily
    follow it, understand it, even make some modifications to it at a later
    stage where we needed some proprietary extensions. Compared to some other
    third party libraries I have seen in my time, that was a positive surprise.
    It might be a lack of competition. At the time we were looking for
    CAN/CANopen implementations under QNX and there was only one other company
    besides Vector that even had a product. It might be different for other
    OSes, though.
    Exactly my experience. Also, they were very patient with our management
    being very difficult about signing the contract. Had I been in their
    position I would have told my company to go stuff ourselves :)
    Yepp. My impression was, that their code base is fairly large in order to
    cover all options of the CANopen standard, very flexible and highly
    configurable but would only include the code that you actually activated
    using the proper defines.

    Urs Beeli, Jul 18, 2007
  6. Look for "can4linux", which supports both Intel and Philips CAN
    controllers on ISA/PCI boards.

    Paul Keinanen, Jul 18, 2007
  7. raj

    Chris Hills Guest

    Why not use MISRA-C anyway?
    Once you are using it there is no overhead.
    Chris Hills, Jul 19, 2007
  8. raj

    raj Guest


    I appreciate for you kind information Paul

    I would be more thankful if you could direct as in right path, so that
    we can learn better and faster


    Starting with understanding of hard ware registers
    Understanding can physical and data link layer implementations etc.

    Could you please give us a Skelton structure to follow?

    Thanking you

    Rajesh Maddukuri
    raj, Jul 21, 2007
    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.