c++embeddedqnxcan-buscanopen

How can I write a CANopen stack?


I have a similar problem to this: How to program a simple CANopen layer. I read the answers, but I have to program a CANopen layer on my own. I cannot get a commercial one. So are there any basics of writing a CANopen stack (or layer I'm not certain about the difference)? I don't know even where to start...

If it's required, here's some information:

My master device is a BeagleBone Black with QNX. QNX has a generic CAN library I think, but it is not specific to CANopen. And my slave is a militarized brushless motor controller. I'm writing in C++.

I have a documentation about the general requirements of my system. There are two RPDOs and four TPDOs, transmission is synchronous, there is no stopped mode (so no heart-beat and node guarding) and all message information are stated (size, format, related node IDs, etc.)


Solution

  • There are actually at least 4 open source projects that implement CANopen:

    I would have posted links, but apparently I don't have enough "reputation".

    openCANopen also includes some utilities such as a daemon for forwarding traffic over TCP and a program that interprets and dumps CANopen traffic to standard output.

    Lely CANopen is actually of pretty decent code quality and I might have used it if it'd been available when I started writing my own implementation. However, I have not tried using it, so I can't really say which implementation is "better". I can only say that they are different and one or the other may suit your needs better.

    Now, I doubt that any of those implementations will work straight out of the box on QNX. They will either have to be adapted or you can copy individual parts of the code into your own implementations. At least that should save you some time.