Follow our public account to not miss any updates!
This tutorial was originally published by the author strongerHuang in October 2018.
Tags: CAN, CANOpen, CanFestival
Copyright: Commercial use prohibited
Disclaimer:This document is for personal learning purposes only. Please contact the author through the public account for authorization to reproduce.
1Introduction
This article discusses the two major knowledge points described in the title. These two points are very important for beginners, and I hope friends who want to learn the CANOpen protocol will read this article carefully.
1.Discusses the Canfestival framework, a brief overview of the official website, and the basic knowledge of CANOpen source code derived from it;
2.Environment setup for the object dictionary generation tool based on the Canfestival framework.
2
About Canfestival
Canfestival is a free and open-source CANOpen protocol stack framework that follows ANSI-C and supports multiple platforms. We can fully utilize this open-source framework to learn CANOpen.
Official homepage:
https://canfestival.org/index.html.en
From the homepage above, we can see that the website mainly contains three parts: Code, Documentation, Applications.
This website is currently a bit slow to access, but it is still reachable. This may be due to the server being in France (IP address) and the fact that this protocol is free and open-source, lacking more financial support.
Below, I will focus on these three parts for beginners and highlight what we need to pay special attention to.
2.1 Code
Website: https://canfestival.org/code.html.en
The code provides four repositories (as shown above), and the CANOpen protocol source code is consistent across all four repositories. In simple terms, the protocol source code is largely the same.
The reason for recommending the second one is:
1.It is maintained and updated by someone, and the current version (2018) is the latest;
2.It provides driver code for STM32F0, F1, and F4 series;
(Download link is provided below)
2.2 Documentation
Website: https://canfestival.org/doc.html.en
This section mainly discusses some content within the Canfestival framework, such as compliance with licenses, and CanFestival provides some GUI and command-line tools to help create a new CANOpen node and edit the object dictionary for master-slave usage.
The important content we need to obtain is all in that PDF manual, which is recommended for download and careful reading. (This manual is also included in the source code package: manual_en.pdf)
2.3 Applications
Website: https://canfestival.org/apps.html.en
Here, the “Applications” does not mean teaching you how to write applications, but rather where Canfestival is applied. For example, in Product development and Research.
Beremiz is an open-source PLC programming tool developed by a French company. CanFestival is integrated into Beremiz (those who have dabbled in CANOpen would know Beremiz).
(You don’t need to delve too deeply into the “Applications” section.)
3
CANOpen Source Code Description and Download
3.1 CANOpen Source Code Description
Many beginners have this question: Do we have to use CanFestival for the CANOpen protocol source code?
Because the CANOpen protocol follows CiA301, 302, CiA401… as long as our source code complies with these protocol specifications, it is sufficient.
CANOpen protocol source code can also be written by ourselves, but it is time-consuming and labor-intensive, which is completely unnecessary. Therefore, we use the free and open-source CanFestival. Of course, you can also purchase commercial CANOpen protocol source code to develop products.
No matter whether we use the free CanFestival or purchased source code, as long as it supports the CANOpen protocol, we can communicate with devices that support the CANOpen protocol.
3.2 Download
We enter the “Code” section on the official website, where four options will appear. I recommend downloading the second one (the reasons for this are explained above). After entering, you will see some descriptions as shown below:
For my followers, most of you are using STM32. The relevant source code is provided for reference, which will surely enhance your learning interest.
This source code is updated and maintained by multiple people, so you will see many branches. We can simply download the latest version.
Download link:
https://bitbucket.org/Mongo/canfestival-3-asc/downloads
Baidu Cloud download:
https://pan.baidu.com/s/1b9K0vIzu_EVWK1BLURJEPQ
Extraction code: j2w2
4
Environment Setup for Object Dictionary Generation Tool
The environment setup can refer to the guidance in the Canfestival manual (manual_en.pdf), specifically in section 3.1.1: Object Dictionary Editor GUI.
We need to download and install the first two; the third one does not need to be downloaded separately.
Since we are developing on STM32, we can ignore the Linux section 3.1.2 and Windows section 3.1.3 in the manual.
4.1 Download Python and wxPython
Due to compatibility issues with other tools, I am currently using python-2.7.15 + wxPython2.8 on Win10.
I have tried other higher versions of Python 3, which seem not to work, and there are also differences between 32-bit and 64-bit versions. Here I provide the version I installed for download, and you can try downloading other versions from the official site when you have time.
1. Baidu Cloud
Link:
https://pan.baidu.com/s/1bRS403m4B31m4ovSJ-_HwA
Extraction code: 38sn
2. Official Download
Python: https://www.python.org/downloads
wxPython: https://wxpython.org/pages/downloads
wxPython mirror:
https://sourceforge.net/projects/wxpython/files/wxPython
4.2 Installation
1. Python Installation
There are two points to note during Python installation: 1. Run as administrator; 2. Add (environment variable) path.
For details, please refer to my previous article on the public account titled “Tool Download and Environment Setup” in section 3.2 Installing Python.
2. wxPython Installation
You can install it directly through the downloaded offline package or via the command line. (Please refer to the addresses provided above.)
4.3 How to Successfully Run
1.Unzip the Canfestival-3 downloaded in section 3.2;
2.Unzip Gnosis_Utils-current.tar.gz in the objdictgen directory;
3.Copy the ‘gnosis’ folder from the unzipped directory in step 2 to the objdictgen directory (pay attention to the path), as shown below:
4.Double-click or run objdictedit.py in the objdictgen directory. If the environment is set up correctly, the following interface will appear:
If the above interface does not appear, please check whether the environment has been set up successfully.
4
Notes
1. This document is for personal learning use only, copyright reserved, commercial use prohibited.
2. This article is edited and organized solely by me, and there may inevitably be some errors.
3. This article is included in the public account “strongerHuang”. Reply “CANOpen Series Tutorial” to view the complete series of tutorials.
5Conclusion
If you find this article helpful, remember to like and share it. (Your likes are a great support and encouragement for me)
Scan the QR code below to follow the public account and find more exciting content in the bottom menu!
Long press to identify the QR code in the image to follow

Appreciation is recognition and support for the author!