{"id":13720449,"url":"https://github.com/zephyrproject-rtos/canopennode","last_synced_at":"2025-05-08T22:06:39.609Z","repository":{"id":43467071,"uuid":"234373971","full_name":"zephyrproject-rtos/canopennode","owner":"zephyrproject-rtos","description":"Zephyr repository tracking https://github.com/CANopenNode/CANopenNode","archived":false,"fork":false,"pushed_at":"2023-10-06T13:59:00.000Z","size":1211,"stargazers_count":10,"open_issues_count":0,"forks_count":13,"subscribers_count":7,"default_branch":"zephyr","last_synced_at":"2025-05-08T22:06:30.628Z","etag":null,"topics":["can","module"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zephyrproject-rtos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-01-16T17:27:20.000Z","updated_at":"2024-08-06T16:43:30.000Z","dependencies_parsed_at":"2024-01-10T07:03:13.771Z","dependency_job_id":"2d06586e-2859-40b7-861a-06f5d491de31","html_url":"https://github.com/zephyrproject-rtos/canopennode","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephyrproject-rtos%2Fcanopennode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephyrproject-rtos%2Fcanopennode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephyrproject-rtos%2Fcanopennode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephyrproject-rtos%2Fcanopennode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zephyrproject-rtos","download_url":"https://codeload.github.com/zephyrproject-rtos/canopennode/tar.gz/refs/heads/zephyr","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253154974,"owners_count":21862622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["can","module"],"created_at":"2024-08-03T01:01:03.932Z","updated_at":"2025-05-08T22:06:39.546Z","avatar_url":"https://github.com/zephyrproject-rtos.png","language":"C","funding_links":[],"categories":["Libraries"],"sub_categories":["Networking \u0026 Protocols"],"readme":"CANopenNode\n===========\n\nCANopenNode is free and open source CANopen Stack.\n\nCANopen is the internationally standardized (EN 50325-4)\n([CiA301](http://can-cia.org/standardization/technical-documents))\nCAN-based higher-layer protocol for embedded control system. For more\ninformation on CANopen see http://www.can-cia.org/\n\nCANopenNode is written in ANSI C in object-oriented way. It runs on\ndifferent microcontrollers, as standalone application or with RTOS.\nStack includes master functionalities. For Linux implementation with\nCANopen master functionalities see\nhttps://github.com/CANopenNode/CANopenSocket.\n\nVariables (communication, device, custom) are ordered in CANopen Object\nDictionary and are accessible from both: C code and from CAN network.\n\nCANopenNode homepage is https://github.com/CANopenNode/CANopenNode\n\n\nCANopen Features\n----------------\n - NMT slave to start, stop, reset device. Simple NMT master.\n - Heartbeat producer/consumer error control.\n - PDO linking and dynamic mapping for fast exchange of process variables.\n - SDO expedited, segmented and block transfer for service access to all parameters.\n - SDO master.\n - Emergency message.\n - Sync producer/consumer.\n - Time protocol (producer/consumer).\n - Non-volatile storage.\n - LSS master and slave, LSS fastscan\n\n### RTR\nRTR (remote transmission request) is a feature of CAN bus. Usage of RTR\nis not recommended for CANopen and it is not implemented in CANopenNode.\n\n### Self start\nObject **0x1F80** from Object Dictionary enables the NMT slaves to start\nautomatically or allows it to start the whole network. It is specified in\nDSP302-2 standard. Standard allows two values for slaves for object 0x1F80:\n- Object 0x1F80, value = **0x8** - \"NMT slave shall enter the NMT state\n  Operational after the NMT state Initialization autonomously (self starting)\"\n- Object 0x1F80, value = **0x2** - \"NMT slave shall execute the NMT service\n  start remote node with node-ID set to 0\"\n\nNote: When node is stated (in NMT operational state), it is allowed to send or\nreceive Process Data Objects (PDO). If Error Register (object 0x1001) is set,\nthen NMT operational state is not allowed.\n\n\nUsage of the CANopenNode\n------------------------\nCANopenNode itself doesn't have complete working code for any microcontroller.\nIt is only the library with the stack It has example, which should compile\non any system with template driver (drvTemplate), which actually doesn't\naccess CAN hardware. CANopenNode should be used as a git submodule included\nin a project with specific hardware and specific application.\n\n\nDocumentation, support and contributions\n----------------------------------------\nCode is documented in header files. Running [doxygen](http://www.doxygen.nl/)\nor `make doc` in project base folder will produce complete html documentation.\nJust open CANopenNode/doc/html/index.html in browser.\n\nReport issues on https://github.com/CANopenNode/CANopenNode/issues\n\nOlder and still active discussion group is on Sourceforge\nhttp://sourceforge.net/p/canopennode/discussion/387151/\n\nFor some implementations of CANopenNode on real hardware see\n[Device support](#device-support) section.\n[CANopenSocket](https://github.com/CANopenNode/CANopenSocket) is nice\nimplementation for Linux devices. It includes command line interface for\nmaster access of the CANopen network. There is also some Getting started.\n\nContributions are welcome. Best way to contribute your code is to fork\na project, modify it and then send a pull request. Some basic formatting\nrules should be followed: Linux style with indentation of 4 spaces. There\nis also a configuration file for `clang-format` tool.\n\n\nFlowchart of a typical CANopenNode implementation\n-------------------------------------------------\n~~~\n                            -----------------------\n                           |     Program start     |\n                            -----------------------\n                                       |\n                            -----------------------\n                           |     CANopen init      |\n                            -----------------------\n                                       |\n                            -----------------------\n                           |     Start threads     |\n                            -----------------------\n                                 |     |     |\n             --------------------      |      --------------------\n            |                          |                          |\n -----------------------    -----------------------    -----------------------\n| CAN receive thread    |  | Timer interval thread |  | Mainline thread       |\n|                       |  |                       |  |                       |\n| - Fast response.      |  | - Realtime thread with|  | - Processing of time  |\n| - Detect CAN ID.      |  |   constant interval,  |  |   consuming tasks     |\n| - Partially process   |  |   typically 1ms.      |  |   in CANopen objects: |\n|   messages and copy   |  | - Network synchronized|  |    - SDO server,      |\n|   data to target      |  | - Copy inputs (RPDOs, |  |    - Emergency,       |\n|   CANopen objects.    |  |   HW) to Object Dict. |  |    - Network state,   |\n|                       |  | - May call application|  |    - Heartbeat.       |\n|                       |  |   for some processing.|  | - May cyclically call |\n|                       |  | - Copy variables from |  |   application code.   |\n|                       |  |   Object Dictionary to|  |                       |\n|                       |  |   outputs (TPDOs, HW).|  |                       |\n -----------------------    -----------------------    -----------------------\n\n              -----------------------\n             | SDO client (optional) |\n             |                       |\n             | - Can be called by    |\n             |   external application|\n             | - Can read or write   |\n             |   any variable from   |\n             |   Object Dictionary   |\n             |   from any node in the|\n             |   CANopen network.    |\n              -----------------------\n\n              -----------------------\n             | LSS client (optional) |\n             |                       |\n             | - Can be called by    |\n             |   external application|\n             | - Can do LSS requests |\n             | - Can request node    |\n             |   enumeration         |\n              -----------------------\n\n\n~~~\n\n\nFile structure\n--------------\n - **CANopen.h/.c** - Initialization and processing of CANopen objects. Most\n   usual implementation of CANopen device.\n - **stack** - Directory with all CANopen objects in separate files.\n   - **CO_Emergency.h/.c** - CANopen Emergency object.\n   - **CO_NMT_Heartbeat.h/.c** - CANopen Network slave and Heartbeat producer object.\n   - **CO_HBconsumer.h/.c** - CANopen Heartbeat consumer object.\n   - **CO_LSS.h** - CANopen LSS common. This is common to LSS master and slave.\n   - **CO_LSSmaster.h/.c** - CANopen LSS master functionality.\n   - **CO_LSSslave.h/.c** - CANopen LSS slave functionality.\n   - **CO_SYNC.h/.c** - CANopen SYNC producer and consumer object.\n   - **CO_TIME.h/.c** - CANopen TIME protocol object.\n   - **CO_SDO.h/.c** - CANopen SDO server object. It serves data from Object dictionary.\n   - **CO_PDO.h/.c** - CANopen PDO object. It configures, receives and transmits CANopen process data.\n   - **CO_SDOmaster.h/.c** - CANopen SDO client object (master functionality).\n   - **CO_trace.h/.c** - Trace object with timestamp for monitoring variables from Object Dictionary (optional).\n   - **crc16-ccitt.h/.c** - CRC calculation object.\n   - **drvTemplate** - Directory with microcontroller specific files. In this\n     case it is template for new implementations. It is also documented, other\n     directories are not.\n     - **CO_driver.h/.c** - Microcontroller specific objects for CAN module.\n     - **eeprom.h/.c** - Functions for storage of Object dictionary, optional.\n     - **helpers.h/.c** - Some optional files with specific helper functions.\n   - **socketCAN** - Directory for Linux socketCAN interface.\n   - **PIC32** - Directory for PIC32 devices from Microchip.\n   - **PIC24_dsPIC33** - Directory for PIC24 and dsPIC33 devices from Microchip.\n   - **dsPIC30F** - Directory for dsPIC30F devices from Microchip.\n   - **eCos** - Directory for all devices supported by eCos RTOS.\n   - **SAM3X** - Directory for SAM3X ARM Cortex M3 devices with ASF library from Atmel.\n   - **STM32** - Directory for STM32 ARM devices from ST.\n   - **LPC177x_8x** - Directory for LPC177x (Cortex M3) devices with FreeRTOS from NXP.\n   - **MCF5282** - Directory for MCF5282 (ColdFire V2) device from Freescale.\n - **codingStyle** - Description of the coding style.\n - **Doxyfile** - Configuration file for the documentation generator *doxygen*.\n - **Makefile** - Basic makefile.\n - **LICENSE** - License.\n - **README.md** - This file.\n - **example** - Directory with basic example.\n   - **main.c** - Mainline and other threads - example template.\n   - **application.h/.c** - Separate file with some functions, which are\n     called from main.c. May be used for application specific code.\n   - **CO_OD.h/.c** - CANopen Object dictionary. Automatically generated files.\n   - **IO.eds** - Standard CANopen EDS file, which may be used from CANopen\n     configuration tool. Automatically generated file.\n   - _ **project.xml** - XML file contains all data for CANopen Object dictionary.\n     It is used by *Object dictionary editor* application, which generates other\n     files.\n   - _ **project.html** - *Object dictionary editor* launcher.\n\n\n### Object dictionary editor\nObject Dictionary is one of the most important parts of CANopen. Its\nimplementation in CANopenNode is quite outdated and there are efforts to\nrewrite it. Anyway, currently it is fully operational and works well.\n\nTo customize the Object Dictionary it is necessary to use the\nexternal application. There are two:\n - [libedssharp](https://github.com/robincornelius/libedssharp) -\n   recommended, can be used with mono.\n - [Object_Dictionary_Editor](http://sourceforge.net/p/canopennode/code_complete/) -\n   originally part of CANopenNode. It is still operational, but requiers\n   very old version of Firefox to run.\n\n\nDevice support\n--------------\nCANopenNode can be implemented on many different devices. It is\nnecessary to implement interface to specific hardware, so called 'driver'.\nCurrently driver files are part of CANopenNode, but they will be split from\nit in the future.\n\nMost up to date information on device support can be found on\n[CANopenNode/wiki](https://github.com/CANopenNode/CANopenNode/wiki).\n\n\n### Note for contributors\nFor the driver developers, who wish to share and cooperate, I recommend the following approach:\n1. Make own git repo for the Device specific demo project on the Github or somewhere.\n2. Add https://github.com/CANopenNode/CANopenNode into your project (or at side of your project).\n   For example, include it in your project as a git submodule:\n   `git submodule add https://github.com/CANopenNode/CANopenNode`\n3. Add specific driver and other files.\n4. **Add a note** about your specific implementation here on\n   [CANopenNode/wiki](https://github.com/CANopenNode/CANopenNode/wiki) with some\n   basic description and status. Write a note, even it has an Alpha status.\n5. Make a demo folder, which contains project files, etc., necessary to run the demo.\n6. Write a good README.md file, where you describe your project, specify demo board, tools used, etc.\n\n\nHistory of the project\n----------------------\nProject was initially hosted on http://sourceforge.net/projects/canopennode/\nIt started in 2004 with PIC18F microcontrollers from Microchip.\nFresh, cleaned repository of CANopenNode stack started on 25.7.2015.\nFor older history see http://sourceforge.net/p/canopennode/code_complete/\n\n\nLicense\n-------\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzephyrproject-rtos%2Fcanopennode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzephyrproject-rtos%2Fcanopennode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzephyrproject-rtos%2Fcanopennode/lists"}