105 \renewcommand\labelitemii{{\textbullet}} |
105 \renewcommand\labelitemii{{\textbullet}} |
106 \renewcommand\labelitemiii{{\textbullet}} |
106 \renewcommand\labelitemiii{{\textbullet}} |
107 \renewcommand\labelitemiv{{\textbullet}} |
107 \renewcommand\labelitemiv{{\textbullet}} |
108 } |
108 } |
109 |
109 |
|
110 \newcommand{\canopen}{CANopen} |
|
111 |
110 \begin{document} |
112 \begin{document} |
111 |
113 |
112 {\centering\sffamily\Huge The CanFestival CANOpen stack manual.} |
114 {\centering\sffamily\Huge The CanFestival \canopen{} stack manual.} |
113 |
115 |
114 \renewcommand\contentsname{CanFestival v3.0 Manual} |
116 \renewcommand\contentsname{CanFestival v3.0 Manual} |
115 \setcounter{tocdepth}{2} |
117 \setcounter{tocdepth}{2} |
116 \tableofcontents |
118 \tableofcontents |
117 \section{Introduction} |
119 \section{Introduction} |
118 CanFestival is an OpenSource (LGPL and GPL) CANOpen framework. |
120 CanFestival is an OpenSource (LGPL and GPL) \canopen{} framework. |
119 |
121 |
120 \subsection{The CanFestival project} |
122 \subsection{The CanFestival project} |
121 This project, initiated by Edouard TISSERANT in 2001, as grown thanks to |
123 This project, initiated by Edouard TISSERANT in 2001, has grown thanks to |
122 Francis DUPIN and other contributors. |
124 Francis DUPIN and other contributors. |
123 |
125 |
124 Today, CanFestival focuses on providing an ANSI{}-C platform independent |
126 Today, CanFestival focuses on providing an ANSI{}-C platform independent |
125 CANOpen stack that can be implemented as master or slave nodes on PCs, |
127 \canopen{} stack that can be implemented as master or slave nodes on PCs, |
126 Real{}-time IPCs, and Microcontrollers. |
128 Real{}-time IPCs, and Microcontrollers. |
127 |
129 |
128 CanFestival is a project supported by Lolitech. |
130 CanFestival is a project supported by Lolitech. |
129 |
131 |
130 \subsection{What is CANopen} |
132 \subsection{What is \canopen{}} |
131 CANopen is a CAN based high level protocol. It defines some protocols to |
133 CANopen is a CAN based high level protocol. It defines some protocols to |
132 : |
134 : |
133 |
135 |
134 \liststyleLi |
136 \liststyleLi |
135 \begin{enumerate} |
137 \begin{enumerate} |
136 \item Configure a CAN network. |
138 \item Configure a CAN network. |
137 \item Transmit data to a specific node or in broadcast. |
139 \item Transmit data to a specific node or in broadcast. |
138 \item Administrate the network. For example detecting a not responding |
140 \item Administrate the network. For example detecting a not responding |
139 node. |
141 node. |
140 \end{enumerate} |
142 \end{enumerate} |
141 The documentation can be found in the Can in automation website : |
143 The documentation can be found on the CAN in Automation website : |
142 |
144 |
143 \href{http://www.can-cia.de/canopen}{http://www.can{}-cia.de/canopen} |
145 \href{http://www.can-cia.de/canopen}{http://www.can{}-cia.de/canopen} |
144 |
146 |
145 The most important document about CANopen is the normative CiA Draft |
147 The most important document about \canopen{} is the normative CiA Draft |
146 Standard 301, version 4.02. You can now download with no cost the |
148 Standard 301, version 4.02. You can now download the specification from the |
147 specification in Can in automation website. |
149 CAN in Automation website at no cost. |
148 |
150 |
149 To continue reading this document, let us assume that you have read some |
151 To continue reading this document, let us assume that you have read some |
150 papers introducing CANopen. |
152 papers introducing \canopen{}. |
151 |
153 |
152 \section{CanFestival Features} |
154 \section{CanFestival Features} |
153 \subsection{Tools } |
155 \subsection{Tools } |
154 The CANopen library is coming with some tools : |
156 The \canopen{} library is coming with some tools : |
155 |
157 |
156 \liststyleLii |
158 \liststyleLii |
157 \begin{enumerate} |
159 \begin{enumerate} |
158 \item Object Dictionary editor GUI. WxPython Model{}-View{}-Controler |
160 \item Object Dictionary editor GUI. WxPython Model{}-View{}-Controler |
159 based GUI, that help a lot in generating object dictionary source code |
161 based GUI, that help a lot in generating object dictionary source code |
160 for each node. |
162 for each node. |
161 \item A configure script, that let you chose compile time options such |
163 \item A configure script, that let you chose compile time options such |
162 as target CPU/HOST, CAN and TIMER drivers.\newline |
164 as target CPU/HOST, CAN and TIMER drivers.\newline |
163 This script have not been generated with autoconf, it have been made |
165 This script has not been generated with autoconf, it has been made |
164 keeping micro{}-controller target in mind. |
166 keeping micro{}-controller target in mind. |
165 \end{enumerate} |
167 \end{enumerate} |
166 \subsection{Standard conformance} |
168 \subsection{Standard conformance} |
167 \paragraph{Multi{}-Platform} |
169 \paragraph{Multi{}-Platform} |
168 \liststyleLiii |
170 \liststyleLiii |
343 implemented differently on {\textmu}C and OS.: |
345 implemented differently on {\textmu}C and OS.: |
344 |
346 |
345 \liststyleLvi |
347 \liststyleLvi |
346 \begin{enumerate} |
348 \begin{enumerate} |
347 \item {\textmu}C must provide interuption masking for timer and can |
349 \item {\textmu}C must provide interuption masking for timer and can |
348 receive IT\newline |
350 receive TI\newline |
349 \begin{center} |
351 \begin{center} |
350 \includegraphics[width=12cm]{Pictures/10000201000003CA0000016604E6A5EF.png} |
352 \includegraphics[width=12cm]{Pictures/10000201000003CA0000016604E6A5EF.png} |
351 \end{center} |
353 \end{center} |
352 \item OS must provide a receive thread, a timer thread and a mutex. CAN |
354 \item OS must provide a receive thread, a timer thread and a mutex. CAN |
353 reception is a bloking operation.\newline |
355 reception is a bloking operation.\newline |
354 \begin{center} |
356 \begin{center} |
355 \includegraphics[width=12cm]{Pictures/10000201000003F9000002CF8B0CDAEA.png} |
357 \includegraphics[width=12cm]{Pictures/10000201000003F9000002CF8B0CDAEA.png} |
356 \end{center} |
358 \end{center} |
357 \end{enumerate} |
359 \end{enumerate} |
358 \subsection{CanFestival events scheduling} |
360 \subsection{CanFestival events scheduling} |
359 A CanOpen node must be able to take delayed actions. |
361 A \canopen{} node must be able to take delayed actions. |
360 |
362 |
361 As exemples, periodic sync emission, heartbeat production or SDO timeout |
363 As exemples, periodic sync emission, heartbeat production or SDO timeout |
362 need to set some alarms that will be called later and do the job. |
364 need to set some alarms that will be called later and do the job. |
363 |
365 |
364 {\textmu}C generaly do not have enough free timers to handle all the |
366 {\textmu}C generaly do not have enough free timers to handle all the |
365 CanOpen needs directly. Moreover, CanFestival internal data may be |
367 \canopen{} needs directly. Moreover, CanFestival internal data may be |
366 corrupt by reentrant calls. |
368 corrupt by reentrant calls. |
367 |
369 |
368 CanFestival implement a micro{}-scheduler (timer.c). It uses only one |
370 CanFestival implement a micro{}-scheduler (timer.c). It uses only one |
369 timer to mimic many timers. It manage an alarm table, and call alarms |
371 timer to mimic many timers. It manage an alarm table, and call alarms |
370 at desired time. |
372 at desired time. |
1146 \section{Developing a new node} |
1148 \section{Developing a new node} |
1147 Using provided examples as a base for your new node is generally a good |
1149 Using provided examples as a base for your new node is generally a good |
1148 idea. You can also use the provided *.od files as a base for your node |
1150 idea. You can also use the provided *.od files as a base for your node |
1149 object dictionary. |
1151 object dictionary. |
1150 |
1152 |
1151 Creating a new CanOpen node implies to define the Object Dictionary of |
1153 Creating a new \canopen{} node implies to define the Object Dictionary of |
1152 this node. For that, developer have to provide a C file. This C file |
1154 this node. For that, developer has to provide a C file. This C file |
1153 contains the definition of all dictionary entries, and some kind of |
1155 contains the definition of all dictionary entries, and some kind of |
1154 index table that helps the stack to access some entries directly. |
1156 index table that helps the stack to access some entries directly. |
1155 |
1157 |
1156 \subsection{Using Dictionary Editor GUI} |
1158 \subsection{Using Dictionary Editor GUI} |
1157 The Object Dictionary Editor is a WxPython based GUI that is used to |
1159 The Object Dictionary Editor is a WxPython based GUI that is used to |
1158 create the C file needed to create a new CanOpen node. |
1160 create the C file needed to create a new \canopen{} node. |
1159 |
1161 |
1160 \subsubsection{Installation and usage on Linux} |
1162 \subsubsection{Installation and usage on Linux} |
1161 You first have to download and install Gnosis XML modules. This is |
1163 You first have to download and install Gnosis XML modules. This is |
1162 automated by a Makefile rule. |
1164 automated by a Makefile rule. |
1163 |
1165 |
1309 \section{FAQ} |
1311 \section{FAQ} |
1310 \subsection{General} |
1312 \subsection{General} |
1311 \subsubsection{Does the code compiles on Windows ?} |
1313 \subsubsection{Does the code compiles on Windows ?} |
1312 Yes, with both Cygwin and Visual Studio C++. |
1314 Yes, with both Cygwin and Visual Studio C++. |
1313 |
1315 |
1314 Because CANopen layer is coded with C, put a compilation option /TC or |
1316 Because \canopen{} layer is coded with C, put a compilation option /TC or |
1315 /TP if you plan to mix C++ files. See the MSDN documentation about |
1317 /TP if you plan to mix C++ files. See the MSDN documentation about |
1316 that. |
1318 that. |
1317 |
1319 |
1318 \subsubsection{How to fit the library to an other microcontr\^oler ?} |
1320 \subsubsection{How to fit the library to an other microcontr\^oler ?} |
1319 First, be sure that you have at least 40K bytes of program memory, and |
1321 First, be sure that you have at least 40K bytes of program memory, and |
1320 about 2k of RAM. |
1322 about 2k of RAM. |
1321 |
1323 |
1322 You have to create target specific interface to HW resources. Take model |
1324 You have to create target specific interface to HW resources. Take model |
1323 on bundled interfaces provided in drivers/ and create your own |
1325 on bundled interfaces provided in drivers/ and create your own |
1324 interface. You also have to update Makefile.in files for target |
1326 interface. You also have to update Makefile.in files for target |
1325 specific cflags and options. Chose {--}targer= configure switch to |
1327 specific cflags and options. Choose {--}target= configure switch to |
1326 compile your specific interface. |
1328 compile your specific interface. |
1327 |
1329 |
1328 You are welcome to contribute{}-back your own interfaces ! Other |
1330 You are welcome to contribute{}-back your own interfaces! Other |
1329 Canfestival users will use it and provide feedback, tests and |
1331 Canfestival users will use it and provide feedback, tests and |
1330 enhancements. |
1332 enhancements. |
1331 |
1333 |
1332 \subsubsection{Is CanFestival3 conform to DS301 v.4.02 ?} |
1334 \subsubsection{Is CanFestival3 conform to DS301 v.4.02 ?} |
1333 Thanks to Philippe Foureys (IUT of Valence), a slave node have been |
1335 Thanks to Philippe Foureys (IUT of Valence), a slave node have been |
1334 tested with the National Instrument CanOpen Conformance Test. It passed |
1336 tested with the National Instrument \canopen{} Conformance Test. It passed |
1335 the test with success. |
1337 the test with success. |
1336 |
1338 |
1337 Some very small unconformity have been found in very unusual situations, |
1339 Some very small unconformity have been found in very unusual situations, |
1338 for example in the SDO code response to wrong messages. |
1340 for example in the SDO code response to wrong messages. |
1339 |
1341 |
1441 \paragraph{Initialize function} |
1443 \paragraph{Initialize function} |
1442 \subparagraph{Code for GCC} |
1444 \subparagraph{Code for GCC} |
1443 {\ttfamily |
1445 {\ttfamily |
1444 void initCanHCS12 (void)\newline |
1446 void initCanHCS12 (void)\newline |
1445 \{ \space \newline |
1447 \{ \space \newline |
1446 \space //Init the HCS12 microcontroler for CanOpen \newline |
1448 \space //Init the HCS12 microcontroler for \canopen{} \newline |
1447 \space initHCS12();\newline |
1449 \space initHCS12();\newline |
1448 \space \space // Init the HCS12 \space CAN driver\newline |
1450 \space \space // Init the HCS12 \space CAN driver\newline |
1449 \space const canBusInit bi0 = \{\newline |
1451 \space const canBusInit bi0 = \{\newline |
1450 \space \space \space 0, \space \space \space /* no low power \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space */ |
1452 \space \space \space 0, \space \space \space /* no low power \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space */ |
1451 \newline |
1453 \newline |
1549 \item Newlib 1.10.0 Build 20030421 |
1551 \item Newlib 1.10.0 Build 20030421 |
1550 \item GNU Binutils 2.12.1 Build 20030427 |
1552 \item GNU Binutils 2.12.1 Build 20030427 |
1551 \end{enumerate} |
1553 \end{enumerate} |
1552 \section{Documentation resources\newline} |
1554 \section{Documentation resources\newline} |
1553 \paragraph{CIA : Can in Automation\newline} |
1555 \paragraph{CIA : Can in Automation\newline} |
1554 Many documentation on CANopen.\newline |
1556 Many documentation on \canopen{}.\newline |
1555 \href{http://www.can-cia.de/}{http://www.can{}-cia.de} |
1557 \href{http://www.can-cia.de/}{http://www.can{}-cia.de} |
1556 |
1558 |
1557 \paragraph{Resources and training in CANopen\newline} |
1559 \paragraph{Resources and training in \canopen{}\newline} |
1558 \href{http://www.esacademy.com/}{http://www.esacademy.com} |
1560 \href{http://www.esacademy.com/}{http://www.esacademy.com} |
1559 |
1561 |
1560 \paragraph{Elektronikladen HCS12 T{}-board\newline} |
1562 \paragraph{Elektronikladen HCS12 T{}-board\newline} |
1561 \href{http://www.elektronikladen.de/en_hcs12tb.html}{http://www.elektronikladen.de/en\_hcs12tb.html} |
1563 \href{http://www.elektronikladen.de/en_hcs12tb.html}{http://www.elektronikladen.de/en\_hcs12tb.html} |
1562 |
1564 |