CANopen and Machinekit

435 views
Skip to first unread message

Janez Paternoster

unread,
Apr 23, 2015, 7:04:32 PM4/23/15
to machi...@googlegroups.com
Hello everybody,

I'm a fan of CANopen and author of CANopenNode. Michael invited me here after a long conversation.

CANopenNode runs perfectly on microcontrollers (16bit+) and now is aproaching to Linux. It has some master functionality. A "competitor" is CANfestival. Both are free software.

CANopen is widely used by small to medium sized manufacturers. It has a large set of standards - device profiles for: automation devices (generic IO, drives, encoders), lifts, medical devices, plastic machinery and much more. For a relative small fee for membership company gets full access to all standards with no restrictions. Some standards are freely available, like CiA301(main standard), CiA401(generic IO), etc. Unfortunately CiA402(drives) is not free for public, but some manufacturers provide very well description of that standard for their drives (for example EPOS2). CiA402 is also internationally standardized under DIN EN 61800-7-1, DIN EN 61800-7-201:2015(most important) and DIN EN 61800-7-301. Here is preview of older edition (There are two editions of the standards and also of the CiA402, quite different)

There is a myth, that CAN suffer from bandwidth. It is not true. Well, it depends, how smart communication is implemented. If there is still lack of bandwidth, then CAN FD was freshly developed (flexible data rate, higher bandwidth, more data in single CAN message). CAN chips are cheap as they are produced in large quantities. They are smart - once the device successfully transmits a message, it can be sure it was successfully received on all other (healthy) devices.

CANopen device according to CiA402 is capable of autonomous positioning. There are different capabilities in different devices. Besides homing, velocity and torque modes there are three positioning modes possible. In each case drive receives Target position and controlword and transmits actual position and statusword:
  1. Profile position mode: Drive receives one target position and start signal. It calculates ramps and drive autonomously. Reports "position reached". Simple to use, but not suitable to synchronized movement of multiple axes.
  2. Interpolated positioning mode: Interesting mode, will be described below.
  3. Cyclic synchronous position mode: Quite simple, requires higher bandwidth.


How do I suggest to implement CANopen drives in machinekit:

Machinekit generates trajectory for each axis. It sends interpolation points (delta time, position, velocity, 8bytes) to drives. It is third order curve, so not much points are necessary. They are sent ahead (10 to 100 ms), so there is no need for hard real time. Controlword is faster and it starts movement of all drives simultaneously. Controlword can also perform a quick stop in case of emergency. Of course all drives are perfectly synchronized. This is possible with Interpolated positioning mode. Very nice description is in EPOS2-Firmware-Specification from the link above, page 48. I can help with some equations, if there will be interest. It is also easy to get fine interpolation points from spline, so implementation of the CANopen (and Arduino) based (stepper) drive is not so unreachable.

Bas de Bruijn

unread,
Apr 24, 2015, 12:47:48 AM4/24/15
to Janez Paternoster, machi...@googlegroups.com
Hi Janez,
Welcome!

I'm very interested in getting CAN into MK. This will be a big leap forwards for MK. 

Thanks for sharing your knowledge.

Bas
--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.
Visit this group at http://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Michael Haberler

unread,
Apr 25, 2015, 3:59:07 AM4/25/15
to Janez Paternoster, machi...@googlegroups.com
Hi Janez,

first - welcome here!

second - your post below sets the record for starting from 'hi!' to mapping out the field, all the way to an implementation outline for machinekit in a single mail ;)

So I'm very happy to have you on board!

best regards

Michael

Uwe Kindler

unread,
Apr 25, 2015, 8:29:36 AM4/25/15
to machi...@googlegroups.com
Hi Janez, hello everybody,

Michael also asked me to give a little support on the CANopen topic in this mailing list. Like Janez I'm a fan of CANopen with 10 years experience in implementing CANopen based motion control solutions and CANopen master / slave software. I'm also a fan of open source software and contributed the complete CAN I/O layer and several CAN device drivers for the open source RTOS eCos. I also supported Janez CANopenNode project with a driver for the eCos CAN framework. As a member and chairman of the CANopen SIG (Special Interest Group) laboratory automation, I was actively involved in the creation of CANopen profiles for laboratory automation. I'm also a great fan of the BeagleBone Black and happy to use it in my daily job to implement Linux based CANopen control solutions.

So I'm quite exited by the ideas of Michael, to add CANopen support to Machinekit and hope, I can help a little bit with answering CANopen related questions here.

Uwe Kindler

Bas de Bruijn

unread,
Apr 25, 2015, 8:42:03 AM4/25/15
to Uwe Kindler, machi...@googlegroups.com
Hi Uwe,

Welcome!
Good to see so much professionals and knowledge coming to the list.
I’m looking forward to MK having CAN support. I’m positive I’ll be asking CAN related questions in the future :)

Bas

Michael Haberler

unread,
Apr 27, 2015, 3:47:11 AM4/27/15
to Uwe Kindler, machi...@googlegroups.com
Hello Uwe,
Welcome! I'm delighted to have you on board - and it makes me more sure this effort actually will yield useful results!

Bas and me have started an issue on the CANopen effort here: https://github.com/machinekit/machinekit/issues/589 - this might be the best venue for focused discussions.

best regards

Michael

Timothy March

unread,
Apr 28, 2015, 2:22:23 AM4/28/15
to machi...@googlegroups.com, incredi...@googlemail.com





Hi Michael
I want to thank you for starting this effort.

Would like to point something out, with the work that I do, we use Devicenet a form of Can. I only deal with errored systems and finding the problems with nodes, wiring or terminating resistors. But the Controls Engineers that I work with use a sniffer program, (as you have mentioned in other venue like Wireshark) but I think Wireshark has more functionality than what they use. Then they also use ladder logic to program to program nodes on the network. I have seen ladder logic option in stepconf wizard. I know it would be down the road but that option would be really neat.

I have ordered one of these with advertised speeds similar as USBtin.

http://www.elecfreaks.com/store/canbus-shield-p-746.html

And one of these, not much info on specs. I am hoping Linux driver will automatically detected as virtual serial port.

http://www.amazon.com/gp/product/B00N71Z66C/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

Was also wondering about wiring up network I found this group, a robotics team using RJ12 for there Can network and if wiring would be heavy enough for my mill-3dprinter size 1000mm x 1000mm so runs would be short. Plus modular cable ends would make connections simple.

http://team2168.org/index.php/resources/electrical/210-can-jaguars

When you or anyone reading with some knowledge of this topic would please take a gander at these items and post you opinion.

I decided to post here because this is not programming related and did not want to muck up other venue.


Tim

Michael Haberler

unread,
Apr 28, 2015, 2:49:17 AM4/28/15
to Machinekit List
Hi Tim,

> Am 28.04.2015 um 08:22 schrieb Timothy March <timoth...@gmail.com>:
>
>
>
> On Monday, April 27, 2015 at 2:47:11 AM UTC-5, Michael Haberler wrote:
> Hello Uwe,
>
>> Am 25.04.2015 um 14:29 schrieb Uwe Kindler <incredi...@googlemail.com>:
>>
>> Hi Janez, hello everybody,
>>
>> Michael also asked me to give a little support on the CANopen topic in this mailing list. Like Janez I'm a fan of CANopen with 10 years experience in implementing CANopen based motion control solutions and CANopen master / slave software. I'm also a fan of open source software and contributed the complete CAN I/O layer and several CAN device drivers for the open source RTOS eCos. I also supported Janez CANopenNode project with a driver for the eCos CAN framework. As a member and chairman of the CANopen SIG (Special Interest Group) laboratory automation, I was actively involved in the creation of CANopen profiles for laboratory automation. I'm also a great fan of the BeagleBone Black and happy to use it in my daily job to implement Linux based CANopen control solutions.
>>
>> So I'm quite exited by the ideas of Michael, to add CANopen support to Machinekit and hope, I can help a little bit with answering CANopen related questions here.
>>
>> Uwe Kindler
>
> Welcome! I'm delighted to have you on board - and it makes me more sure this effort actually will yield useful results!
>
> Bas and me have started an issue on the CANopen effort here: https://github.com/machinekit/machinekit/issues/589 - this might be the best venue for focused discussions.
>
> best regards
>
> Michael
>
>>
>> --
>> website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
>> ---
>> You received this message because you are subscribed to the Google Groups "Machinekit" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/machinekit.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
>
> Hi Michael
> I want to thank you for starting this effort.
>
> Would like to point something out, with the work that I do, we use Devicenet a form of Can. I only deal with errored systems and finding the problems with nodes, wiring or terminating resistors. But the Controls Engineers that I work with use a sniffer program, (as you have mentioned in other venue like Wireshark) but I think Wireshark has more functionality than what they use. Then they also use ladder logic to program to program nodes on the network. I have seen ladder logic option in stepconf wizard. I know it would be down the road but that option would be really neat.
>
> I have ordered one of these with advertised speeds similar as USBtin.
>
> http://www.elecfreaks.com/store/canbus-shield-p-746.html

I got a few similar shields off fleabay and the looked like a great deal at 10€ or so
turns out their pinout doesnt work stock with post-Arduino-Uno boards, so some wire patching required: http://static.mah.priv.at/public/seedstudio-canbus-shield.jpg


there seem to be many knockoffs of the 'Seedstudio CAN shield design' out there, and there's also a software library for it of somewhat dubious quality
https://github.com/jgeisler0303/CAN_BUS_Shield might be worth trying as a start instead, the author seems to have worked through some bugs already

another puzzling thing is - the original library assumes a 16Mhz crystal; my board however has an 8Mhz crystal, and this might be related to the fact that I couldnt get this to work at 1Mbit (rates below ok)

could well be a case of 'shenzen quality control'.. and the reason why it looked such a great deal

>
> And one of these, not much info on specs. I am hoping Linux driver will automatically detected as virtual serial port.
>
> http://www.amazon.com/gp/product/B00N71Z66C/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

Assuming it is a serial device, it's likely it speaks the serial line CAN protocol
the USBtin does, and it easily hooks into linux: http://www.fischl.de/usbtin/linux_can_socketcan/

I didnt find a formal spec of the slcan wire encoding yet, but at least this is what the Linux slcan module expects: http://lxr.free-electrons.com/source/drivers/net/can/slcan.c#L100

> Was also wondering about wiring up network I found this group, a robotics team using RJ12 for there Can network and if wiring would be heavy enough for my mill-3dprinter size 1000mm x 1000mm so runs would be short. Plus modular cable ends would make connections simple.
>
> http://team2168.org/index.php/resources/electrical/210-can-jaguars
>
> When you or anyone reading with some knowledge of this topic would please take a gander at these items and post you opinion.

well, let's collect CAN-related stuff around the abovementioned issue - I collected some links there; go ahead and post your experience once you get there!

- Michael

>
> I decided to post here because this is not programming related and did not want to muck up other venue.
>
>
> Tim
>

Jani Paternoster

unread,
Apr 28, 2015, 2:34:38 PM4/28/15
to machi...@googlegroups.com
I'm diving into SocketCAN now. I think, I could offer some master
functionality then and demonstrate CANopen a little. I'm used to
microcontrollers, I had never problems with realtime, I wonder, what can
we get from SocketCan.

I have one question. I have a very new USB-to CAN interface from Peak. I
know, that newest Linux Kernel(4.0) has support for it, but olders
doesn't. Is there an easy way, to include it's driver to my latest Ubuntu?

Timothy March

unread,
Apr 28, 2015, 3:20:56 PM4/28/15
to machi...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages