ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

CANOPEN介绍

2022-05-04 09:32:17  阅读:326  来源: 互联网

标签:use code CANOPEN library project 介绍 Easy CANopen


1.CIA(CAN IN AUTOMINIION)

CIA官网

2.CANOPEN的开源代码库

CANOPEN开源库

有关stm32的移植应用

3.github的质量不错的一个库

Easy CANopen

Easy CANopen is a protocol for shaping the CAN-bus message in a specific way that suits industrail automation.

CANopen is a very difficult protocol to use, due to the complexitivity of CANopen. So therefore I’m writing a Easy CANopen protocol available for free to use on any embedded systems such as STM32, Arduino, AVR, PIC etc or PC.

To learn to build on this project, you need to use my examples. I have written this project in C language because C is an industry standard. The C language dialect I have chosen is C99 and I don't use dynamical memory allocation in this library. So it will work with MISRA C standard.

With this library, you can communicate with valves, engines, actuators, machinery, hardware and all other things that are suitable for industrial automation. I have build up a basic structure of the project and the purpose with my basic structure is to make Easy CANopen work for very small embedded CAN-bus systems.

Looking for SAE J1939 library? https://github.com/DanielMartensson/Open-SAE-J1939/

Getting started

Learn the structure of the project, else you won't be able to understand Easy CANopen. The project structure follows the same pattern. After you have got a basic understanding of the project, you are able to build on it. Keep it simple and follow how the manufatures implement the their CANopen protocol. I don't recomend to implement the complete protocol from CiA beacause they are too heavy. Only use the documents from CiA as reference manual.

After you have understand the structure of the project, then select processor choice in Hardware -> Hardware.h file. Here you can select for example STM32ArduinoPICAVR etc. or if you want to run it on PC first, then select PROCESSOR_CHOICE 0 and run some examples. That's the debugging mode for internal CAN feedback.

How to use the project

  • Step 1: Download this repository
  • Step 2: Go to Hardware -> Hardware.h and select your processor, if it's not available, please write code for it and send me a pull request
  • Step 3: Copy over the Src folder to your project folder inside your IDE. Rename Src to for example Easy CANopen. That's a good name.
  • Step 4: Use the Examples -> Startup.txt example as your initial starting code for an Easy CANopen project.
#include <stdlib.h>
#include <stdio.h>

/* Include Easy CANopen */
#include "Easy_CANopen/Easy_CANopen.h"

int main() {

	/* Code will update soon */

	return 0;
}

See the examples in Examples folder for more examples.

The structure of the project

a

Easy CANopen functionality

  • User functions:
    • Set node ID address
    • Get node ID address
    • Set vendor ID, product code, revision number and serial number
    • Get vendor ID, product code, revision number and serial number
    • Check if vendor ID, product code, revision number low, revision number high, serial number low, serial number high exist
    • Set baud rate
    • Activate baud rate
    • Save baude rate and node ID
    • Check if there are non configured node ID
    • Send guard status request
  • Internal functions:
    • EMCY message produce and consume
    • Send bootup message
    • Send heartbeat status

Questions and answers

  • Q: Can this library be used with C++?
    • A: Yes it can be used with C++
  • Q: I want to build on this library, what should I do?
    • A: First you need to know C99 and bitwise operations. Then you need to understand the Easy CANopen structure.
  • Q: Can I use this on my Arduino?
    • A: Yes, this C code is 100% pure C code and only using C standard library and also the code does not take account of what hardware you are using.
  • Q: Do I need to install the library for to use the library?
    • A: No, just copy over the .c and .h files to your project and compile. I have used this with QT framework.
  • Q: This project is quite old now and not so much updates, is it still worth to use it?
    • A: Yes, this library only updates when I or other includes more functionality from Easy CANopen. The reason why I wrote this in C99 is because it's an industry standard and will you will always be able to compile this library and use it.
  • Q: What is your plan with the library?
    • A: To make CANopen easy to use
  • Q: I don't have CAN-bus, but can I use this library anyway with UART, USB, WiFi etc?
    • A: Yes. This is only a way to shape a massage in a specific way.
  • Q: Can I send data with this library, even if I don't have CAN-bus?
    • A: Yes. There are something called PDO transfer. Use that if you want to transfer data in an industrial way.
  • Q: Can I send multi package messages from from multiple nodes to one node at the same time?
    • A: No. If you starting to send multipackages from multiple nodes to another node, then that node cannot understand the message.

标签:use,code,CANOPEN,library,project,介绍,Easy,CANopen
来源: https://www.cnblogs.com/breakr-yu/p/16220379.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有