如何编写一个CanOpen堆栈? [英] How to write a CanOpen stack?

查看:313
本文介绍了如何编写一个CanOpen堆栈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此也有类似的问题. 如何对简单的CANopen层进行编程. 我阅读了答案,但我必须自己编写一个CANopen层,但我无法获得商业层.那么编写CANopen堆栈是否有任何基础知识(或者我不确定其中的区别)?我什至不知道从哪里开始.

如果需要,这里是一些信息:

我的主设备是带有QNX的小猎犬黑.我认为QNX有一个通用的CAN库,但不是特定于CANopen的.我的奴隶是一个军事化的无刷电机控制器.我正在用C ++编写. 我有关于系统一般要求的文档. 有2个RPDO和4个TPDO,传输是同步的,没有停止模式(因此没有心跳和节点保护),并且所有消息信息都已声明(大小,格式,相关节点ID等)

解决方案

实际上至少有4个实现CANopen的开源项目:

  • CanFestival是最早的并且可能是最成熟的解决方案.许可证:LGPLv2.
  • CANopenNode是针对微控制器的.许可证:GPLv2.
  • Lely CANopen是一个用于实现CANopen主站和从站的库.许可证:Apache版本2.
  • openCANopen是在Linux上运行的主机.许可证:ISC.注意:我是这个项目的作者.

我会发布链接,但是显然我没有足够的声誉".

openCANopen还包括一些实用程序,例如用于通过TCP转发流量的守护程序以及一个将CANopen流量解释并转储到标准输出的程序.

Lely CANopen实际上具有相当不错的代码质量,如果在我开始编写自己的实现时可以使用的话,我可能会使用它.但是,我没有尝试使用它,所以我不能真正说出哪个实现更好.我只能说它们是不同的,并且其中一种可能更适合您的需求.

现在,我怀疑这些实现中的任何一种都可以在QNX上直接使用.它们要么必须进行修改,要么您可以将代码的各个部分复制到自己的实现中.至少那应该为您节省一些时间.

I have a similar problem with 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 beagle bone black with QNX. QNX has a generic CAN library I think but 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 2 RPDOs and 4 TPDOs, transmission is synchronous, there is no stopped mode( so no heart-beat and node guarding) and all message informations are stated (size, format, related node IDs etc.)

解决方案

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

  • CanFestival is the oldest and might be the most mature solution. License: LGPLv2.
  • CANopenNode is aimed at micro-controllers. License: GPLv2.
  • Lely CANopen is a library for implementing CANopen masters and slaves. License: Apache version 2.
  • openCANopen is a master that runs on Linux. License: ISC. Note: I am the author of this project.

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.

这篇关于如何编写一个CanOpen堆栈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆