1 \documentclass[a4paper,12pt]{book}
2 \usepackage[ascii]{inputenc}
3 \usepackage[T1]{fontenc}
4 \usepackage[french,english]{babel}
5 \usepackage{amsmath,amssymb,amsfonts,textcomp}
12 \DeclareGraphicsExtensions{.jpg}
13 \DeclareGraphicsExtensions{.png}
14 \hypersetup{colorlinks=true, linkcolor=blue, filecolor=blue, pagecolor=blue, urlcolor=blue}
16 %%%%\%%%%%%%% titre, auteurs, date, etc...%%%%%%%%%%%%%%%%%%
17 \title{\Huge The CanFestival CANOpen stack manual}
18 \author{Edouard TISSERANT}
22 %\newcommand\textstyleTeletype[1]{\texttt{#1}}
24 \setcounter{secnumdepth}{5}
25 \renewcommand\thesection{\arabic{section} -}
26 \renewcommand\thesubsection{\arabic{section}.\arabic{subsection})}
27 \renewcommand\thesubsubsection{\arabic{section}.\arabic{subsection}.\arabic{subsubsection})}
28 \renewcommand\theparagraph{\alph{paragraph})}
29 \renewcommand\thesubparagraph{\roman{subparagraph})}
31 \newcommand\liststyleLi{%
32 \renewcommand\labelitemi{{--}}
33 \renewcommand\labelitemii{{--}}
34 \renewcommand\labelitemiii{{--}}
35 \renewcommand\labelitemiv{{--}}
37 \newcommand\liststyleLii{%
38 \renewcommand\labelitemi{{--}}
39 \renewcommand\labelitemii{{--}}
40 \renewcommand\labelitemiii{{--}}
41 \renewcommand\labelitemiv{{--}}
43 \newcommand\liststyleLiii{%
44 \renewcommand\labelitemi{{--}}
45 \renewcommand\labelitemii{{--}}
46 \renewcommand\labelitemiii{{--}}
47 \renewcommand\labelitemiv{{--}}
49 \newcommand\liststyleLiv{%
50 \renewcommand\labelitemi{{--}}
51 \renewcommand\labelitemii{{--}}
52 \renewcommand\labelitemiii{{--}}
53 \renewcommand\labelitemiv{{--}}
55 \newcommand\liststyleLv{%
56 \renewcommand\labelitemi{{--}}
57 \renewcommand\labelitemii{{--}}
58 \renewcommand\labelitemiii{{--}}
59 \renewcommand\labelitemiv{{--}}
61 \newcommand\liststyleLvi{%
62 \renewcommand\labelitemi{{--}}
63 \renewcommand\labelitemii{{--}}
64 \renewcommand\labelitemiii{{--}}
65 \renewcommand\labelitemiv{{--}}
67 \newcommand\liststyleLvii{%
68 \renewcommand\labelitemi{{--}}
69 \renewcommand\labelitemii{{--}}
70 \renewcommand\labelitemiii{{--}}
71 \renewcommand\labelitemiv{{--}}
73 \newcommand\liststyleLviii{%
74 \renewcommand\labelitemi{{--}}
75 \renewcommand\labelitemii{{--}}
76 \renewcommand\labelitemiii{{--}}
77 \renewcommand\labelitemiv{{--}}
79 \newcommand\liststyleLix{%
80 \renewcommand\labelitemi{{--}}
81 \renewcommand\labelitemii{{--}}
82 \renewcommand\labelitemiii{{--}}
83 \renewcommand\labelitemiv{{--}}
85 \newcommand\liststyleLx{%
86 \renewcommand\labelitemi{{--}}
87 \renewcommand\labelitemii{{--}}
88 \renewcommand\labelitemiii{{--}}
89 \renewcommand\labelitemiv{{--}}
91 \newcommand\liststyleLxi{%
92 \renewcommand\labelitemi{{--}}
93 \renewcommand\labelitemii{{--}}
94 \renewcommand\labelitemiii{{--}}
95 \renewcommand\labelitemiv{{--}}
97 \newcommand\liststyleLxii{%
98 \renewcommand\labelitemi{{--}}
99 \renewcommand\labelitemii{{--}}
100 \renewcommand\labelitemiii{{--}}
101 \renewcommand\labelitemiv{{--}}
103 \newcommand\liststyleLxiii{%
104 \renewcommand\labelitemi{{\textbullet}}
105 \renewcommand\labelitemii{{\textbullet}}
106 \renewcommand\labelitemiii{{\textbullet}}
107 \renewcommand\labelitemiv{{\textbullet}}
110 \newcommand{\canopen}{CANopen}
114 {\centering\sffamily\Huge The CanFestival \canopen{} stack manual.}
116 \renewcommand\contentsname{CanFestival v3.0 Manual}
117 \setcounter{tocdepth}{2}
119 \section{Introduction}
120 CanFestival is an OpenSource (LGPL and GPL) \canopen{} framework.
122 \subsection{The CanFestival project}
123 This project, initiated by Edouard TISSERANT in 2001, has grown thanks to
124 Francis DUPIN and other contributors.
126 Today, CanFestival focuses on providing an ANSI{}-C platform independent
127 \canopen{} stack that can be implemented as master or slave nodes on PCs,
128 Real{}-time IPCs, and Microcontrollers.
130 CanFestival is a project supported by Lolitech.
132 \subsection{What is \canopen{}}
133 CANopen is a CAN based high level protocol. It defines some protocols to
138 \item Configure a CAN network.
139 \item Transmit data to a specific node or in broadcast.
140 \item Administrate the network. For example detecting a not responding
143 The documentation can be found on the CAN in Automation website :
145 \href{http://www.can-cia.de/canopen}{http://www.can{}-cia.de/canopen}
147 The most important document about \canopen{} is the normative CiA Draft
148 Standard 301, version 4.02. You can now download the specification from the
149 CAN in Automation website at no cost.
151 To continue reading this document, let us assume that you have read some
152 papers introducing \canopen{}.
154 \section{CanFestival Features}
156 The \canopen{} library is coming with some tools :
160 \item Object Dictionary editor GUI. WxPython Model{}-View{}-Controler
161 based GUI, that help a lot in generating object dictionary source code
163 \item A configure script, that let you chose compile time options such
164 as target CPU/HOST, CAN and TIMER drivers.\newline
165 This script has not been generated with autoconf, it has been made
166 keeping micro{}-controller target in mind.
168 \subsection{Standard conformance}
169 \paragraph{Multi{}-Platform}
172 \item Library source code is C{}-ANSI.
173 \item Driver and examples coding conventions merely depend on target
174 specific contributor/compiler.
175 \item Unix compatible interfaces and examples should compile and run on
176 any Unix system (tested on GNU/Linux and GNU/FreeBSD).
178 \paragraph{\canopen{} conformance}
184 \item Should conform to DS301. V.4.02 13 february 2002.
185 \item Master and Slave functionality implemented.
186 \item Sending SYNC implemented.
187 \item 1 SDO server per node. (update: more than one possible. To be more
189 \item Unlimited SDO client.
190 \item SDO transmission mode : normal, expedited download and upload.
191 \item Unlimited PDO receive.
192 \item Unlimited PDO transmit.
193 \item Object Data type implemented : 8, 16, 32 bits values, and fixed
195 \item Slave state full implemented.
196 \item NMT to change slave{\textquotesingle}s state implemented.
197 \item PDO transmission mode : on request, every reception of 0 to n
199 \item NMT Heartbeat implemented : A node can be either heartbeat
200 producer or receiver.
201 \item NMT NodeGuard implemented : Not fully implemented.
202 \item TIME (time Stamp) : Not implemented.
203 \item EMCY (emergency objects) : Sending and reception of EMCY objectos (without manufacturer specific error field).
204 \item PDO Mapping bit per bit implemented.
211 \item Concise \space DFC : implemented.
213 \section{How to start}
214 \subsection{Host requirements}
215 What you need on your development workstation.
217 \subsubsection{Object Dictionary Editor GUI}
221 \item wxPyhon modules installed (at least version 2.6.3).
222 \item Gnosis xml tools. (Optional can also be installed locally to the
223 project automatically with the help of a Makefile. Please see
224 \hyperlink{a91UsingDictionaryEditorGUIoutline}{9.1) Using Dictionary
227 \subsubsection[\space Linux and Unix{}-likes]{\space Linux and Unix{}-likes}
230 \item Linux, FreeBSD, Cygwin or any Unix environment with GNU toolchain.
231 \item The GNU C compiler (gcc) or any other ANSI{}-C compiler for your
233 \item Xpdf, and the official 301\_v04000201.pdf file in order to get GUI
234 context sensitive help. Download the ds301 at\newline
235 \href{http://www.can-cia.org/downloads/ciaspecifications/?1390}{http://www.can{}-cia.org/downloads/ciaspecifications/?1390}.
239 \subsubsection{Windows (for native win32 target)}
242 \item Visual Studio Express 2005 or worst.
243 \item Microsoft platform SDK (requires Genuine Advantage)
244 \item Cygwin (for configuration only)
246 \subsection{How to get CanFestival}
247 Please always use CVS, this is the best way to get the most reactive
248 support from the developer community :
250 cvs {}-d:pserver:anonymous@lolitech.dyndns.org:/canfestival
252 (type return, without entering a password)
254 Then, enter : \newline
255 cvs {}-z3 {}-d:pserver:anonymous@lolitech.dyndns.org:/canfestival co
258 \section{Understanding Canfestival}
259 \subsection{CanFestival Project tree layout}
260 Simplified directory structure.
263 ./src ANSI{}-C source of \canopen{} stack}
266 \space /include Exportables Header files}
269 ./drivers Interfaces to specific platforms/HW}
272 ./drivers/unix Linux and Cygwin OS interface}
275 ./drivers/win32 Native Win32 OS interface}
278 ./drivers/timers\_xeno Xenomai timers/threads (Linux only)}
281 ./drivers/timers\_kernel Linux kernel timer/threads}
284 ./drivers/timers\_unix Posix timers/threads (Linux, Cygwin)}
287 ./drivers/can\_virtual\_kernel Fake CAN network (kernel space)}
290 ./drivers/can\_peak\_linux PeakSystem CAN library interface}
293 ./drivers/can\_peak\_win32 PeakSystem PCAN{}-Light interface}
296 ./drivers/can\_uvccm\_win32 Acacetus{\textquotesingle}s RS232
297 ``CAN{}-uVCCM'' interface}
300 ./drivers/can\_virtual Fake CAN network (Linux, Cygwin)}
303 ./drivers/hcs12 HCS12 full target interface}
309 ./examples/TestMasterSlave 2 nodes, NMT SYNC SDO PDO, win32+unix}
312 ./examples/TestMasterMicroMod 1 node, control Peak I/O Module, unix}
315 ./examples/gene\_SYNC\_HCS12 Just send periodic SYNC on HCS12}
318 ./examples/win32test Ask some DS301 infos to a node (\textbf{win32)}}
321 ./objdictgen Object Dictionary editor GUI}
324 ./objdictgen/config Pre{}-defined OD profiles}
327 ./objdictgen/examples Some examples/test OD}
330 ./doc Project and \canopen{} doc}
332 \subsection{Implement CanFestival in your application}
335 \includegraphics[width=12cm]{Pictures/10000201000003F9000002CF880931E7.png}
340 \subsection{CanFestival CAN interfaces}
341 Because most CAN controllers and drivers implement FIFOs, CanFestival
342 consider sending message as a non bloking operation.
344 In order to prevent reentrent calls to the stack, messages reception is
345 implemented differently on {\textmu}C and OS.:
349 \item {\textmu}C must provide interuption masking for timer and can
352 \includegraphics[width=12cm]{Pictures/10000201000003CA0000016604E6A5EF.png}
354 \item OS must provide a receive thread, a timer thread and a mutex. CAN
355 reception is a bloking operation.\newline
357 \includegraphics[width=12cm]{Pictures/10000201000003F9000002CF8B0CDAEA.png}
360 \subsection{CanFestival events scheduling}
361 A \canopen{} node must be able to take delayed actions.
363 As exemples, periodic sync emission, heartbeat production or SDO timeout
364 need to set some alarms that will be called later and do the job.
366 {\textmu}C generaly do not have enough free timers to handle all the
367 \canopen{} needs directly. Moreover, CanFestival internal data may be
368 corrupt by reentrant calls.
370 CanFestival implement a micro{}-scheduler (timer.c). It uses only one
371 timer to mimic many timers. It manage an alarm table, and call alarms
375 \includegraphics[width=12cm]{Pictures/100000000000022C000000DEDAD2140C.png}
378 Scheduler can handle short clock value ranges limitation found on some
379 {\textmu}C. As an example, value range for a 16bit clock counter with
380 4{\textmu}s tick is crossed within 0.26 seconds... Long alarms must be
383 Chronogram illustrate a long alarm (A) and a short periodic alarm (B),
384 with a A value {\textgreater} clock range {\textgreater} B value.
385 Values t0...t8 are successive setTimer call parameter values. t1
386 illustrates an intermediate call to TimeDispatch, caused by a delay
387 longer than clock range. Because of long alarm segmentation, at the end
388 of t1, TimeDispatch call will not trig any alarm callback.
391 \includegraphics[width=12cm]{Pictures/1000000000000396000000FFC42573DA.png}
394 \section{Linux Target}
395 Linux target is default configure target.
397 \subsection{Linux Compilation and installation}
398 Call ./configure {--}help to see all available compile time options.
400 After invoking ./configure with your platform specific switches, just
404 ./configure [options]}
412 \subsubsection{Standard Linux node}
418 To do a \canopen{} node running on PC{}-Linux, you need :
422 \item A working linux distribution
423 \item One or more Peak system PC CAN interface and the last Peak Linux
426 \subsubsection{Real{}-Time Linux node}
432 To do a \canopen{} node running on PC{}-Linux, you need :
436 \item A working Linux distribution patched with XENOMAI 2.1 or greater.
437 \item One or more Peak system PC CAN interface and the last Peak Real
438 Time Linux driver installed.
441 \subsubsection{Linux kernel node}
442 To do a CANopen node running on PC-Linux in kernel space, you need:
444 \paragraph{A working Linux distribution with pre-built 2.6.x.x kernel sources}
445 \paragraph{A CAN card driver compatible with CanFestival}
447 \subsubsection{CAN devices}
448 Curently supported CAN devices and corresponding configure switch:
450 \paragraph{Peak systems}
454 {}-{}-can=peak\_linux}
456 PeakSystems CAN interface is automatically chosen as default CAN
457 interface if libpcan is present in the system.
459 Please download driver at
460 \href{http://www.peak-system.com/linux}{http://www.peak{}-system.com/linux}
461 and follow instructions in order to install driver on your system.
463 \paragraph{Socket{}-Can (http://socketcan.berlios.de)}
475 \paragraph{Virtual CAN interfaces (for test/debug)}
479 {}-{}-can=virtual (in user space)}
482 {}-{}-can=virtual\_kernel (in kernel space)}
485 Virtual CAN interface use Unix pipes to emulate a virtual CAN network.
486 Each message issued from a node is repeat to all other nodes. Currently
487 only works with nodes running in the same process, and does not support
490 \subsection{Testing your CanFestival installation}
491 Sample provided in /example/TestMasterSlave is installed into your
492 system during installation.
497 Default CAN driver library is libcanfestival\_can\_virtual.so., which
498 will simply pass CAN messages through Unix pipes between Master and
501 You may also want to specify different can interface and define some CAN
502 ports. Another example using Peak{\textquotesingle}s dual PCMCIA
503 (configure and install with {--}can=peak) :
506 TestMasterSlave {}-l libcanfestival\_can\_peak.so {}-s 40 {}-m 41}
510 It's based on TestMasterSlave example and has the same functionality. Uses virtual can driver as default too. After successfull installation you can insert the module by typing:
512 Module control is done by simple console 'canf\_ktest\_console' which is used to start/stop sending data.
514 \section{Windows Targets}
515 CanFestival can be compiled and run on Windows platform. It is possible
516 to use both Cygwin and win32 native runtime environment.
518 \subsection{Object Dictionary Editor GUI installation.}
520 \hyperlink{a821UsingDictionaryEditorGUIoutline}{8.2.1)Using Dictionary
524 \subsubsection{Requirements}
525 Cygwin have to be installed with those packages :
534 Currently, the only supported CAN devices are PeakSystems ones, with
535 PcanLight driver and library.
537 Please download driver at
538 \href{http://www.peak-system.com/themen/download_gb.html}{http://www.peak{}-system.com/themen/download\_gb.html}
539 \space and follow instructions in order to install driver on your system.
541 Install Cygwin as required, and the driver for your Peak CAN device.
543 Open a Cygwin terminal, and follow those instructions:
545 \subsubsection{Cygwin configuration and compilation}
546 \paragraph{A single node with PcanLight and Peak CAN{}-USB adapter}
547 Download the PCAN{}-Light Zip file for your HW ( URL from download page
551 wget http://www.peak{}-system.com/files/usb.zip}
553 Extract its content into your cygwin home (it will create a ``Disk''
559 Configure CanFestival3 providing path to the desired PcanLight
566 export PCAN\_INCLUDE=\~{}/Disk/PCAN{}-Light/Api/}
569 export PCAN\_HEADER=Pcan\_usb.h}
572 export PCAN\_LIB=\~{}/Disk/PCAN{}-Light/Lib/Visual{\textbackslash}
576 ./configure {}-{--}can=peak\_win32}
581 In order to test, you have to use another CanFestival node, connect with
585 cp \~{}/Disk/PCAN{}-Light/Pcan\_usb.dll .}
588 ./examples/TestMasterSlave/TestMasterSlave {\textbackslash}}
591 {}-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll
597 Then, on the other node :
600 ./TestMasterSlave {}-l my\_driver.so {}-S none {}-M 500K}
602 Now messages are beeing exchanged between master and slave node.
604 \paragraph{Two nodes with PcanLight and Peak dual PCMCIA{}-CAN adapter}
605 Download the PCAN{}-Light Zip file for your HW ( URL from download page
609 wget http://www.peak{}-system.com/files/pccard.zip}
611 Extract its content into your cygwin home (it will create a ``Disk''
617 The configure CanFestival3 providing path to the desired PcanLight
621 export PCAN\_INCLUDE=\~{}/Disk/PCAN{}-Light/Api/\newline
622 export PCAN\_HEADER=Pcan\_pcc.h\newline
623 export PCAN\_LIB=\~{}/Disk/PCAN{}-Light/Lib/Visual{\textbackslash}
624 C++/Pcan\_pcc.lib\newline
625 export PCAN2\_HEADER=Pcan\_2pcc.\newline
626 export PCAN2\_LIB=\~{}/Disk/PCAN{}-Light/Lib/Visual{\textbackslash}
629 In order to test, just connect together both CAN ports of the PCMCIA
630 card. Don{\textquotesingle}t forget 120ohms terminator.
633 cp \~{}/Disk/PCAN{}-Light/Pcan\_pcc.dll .}
636 cp \~{}/Disk/PCAN{}-Light/Pcan\_2pcc.dll .}
639 ./examples/TestMasterSlave/TestMasterSlave {\textbackslash}}
642 {}-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll}
644 Messages are then exchanged between master and slave node, both inside
645 TestMasterSlave{\textquotesingle}s process.
647 \subsection{Visual Studio C++}
648 \subsubsection{Requirements}
649 Minimal Cygwin installation is required at configuration time in order
650 to create specific header files (config.h and cancfg.h). Once this
651 files created, cygwin is not necessary any more.
653 Project and solution files have been created and tested with Visual
654 Studio Express 2005. Be sure to have installed Microsoft Platform SDK,
655 as recommended at the end of Visual Studio installation.
657 \subsubsection{Configuration with cygwin}
658 Follow instructions given at
659 \hyperlink{Cygwin configuration and compilation}{Cygwin
660 configuration and compilation}, but do neither call make nor do tests,
661 just do configuration steps. This will create headers files accordingly
662 to your configuration parameters, and the desired CAN hardware.
664 \subsubsection{Compilation with Visual Studio}
665 You can either load independents ``*.vcproj'' project files along your
666 own projects in your own solution or load the provided
667 ``CanFestival{}-3.vc8.sln'' solution files directly.
669 Build CanFestival{}-3 project first.
671 \paragraph{PcanLight and the can\_peak\_win32 project.}
672 Chosen Pcan\_xxx.lib and eventually Pcan\_2xxx.lib files must be added
673 to can\_peak\_win32 \space \space project before build of the DLL.
675 \subsubsection{Testing}
676 Copy eventually needed dlls (ie : Pcan\_Nxxx.lib) into Release or Debug
677 directory, and run the test program:
680 TestMasterSlave.exe {}-l can\_peak\_win32.dll}
685 \subsubsection{Requirements}
687 Download from : http://sourceforge.net/project/showfiles.php?group\_id=2435
690 \item MSYS-1.0.10.exe
691 \item MinGW-5.1.3.exe
692 \item mingwPORT (which contains wget-1.9.1)
694 Please download driver at http://www.peak-system.com/themen/download\_gb.html
695 and follow instructions in order to install driver on your system.
696 Install MSYS and MingW as required, and the driver for your Peak CAN
697 device. Open a MSYS terminal, and follow those instructions:\\
701 \item extract wget-1.9.1-mingwPORT.tar.bz2
702 \item copy wget.exe in c:\textbackslash{}msys\textbackslash{}1.0\textbackslash{}bin\textbackslash{}
703 \item start MSYS and check the file /etc/fstab contain the line c:/MinGW
707 \subsubsection{MSYS configuration and compilation}
709 Instructions for compilation are nearly the same as CYGWIN part.
712 \paragraph{A single node with PcanLight and Peak CAN-USB adapter}
714 Download the PCAN-Light Zip file for your HW ( URL from download page
717 \texttt{wget http://www.peak-system.com/files/usb.zip}~\\
720 Extract its content into your MSYS's home (it will create a \char`\"{}Disk\char`\"{}
723 \texttt{unzip usb.zip}~\\
726 Configure CanFestival3 providing path to the desired PcanLight implementation:
728 \texttt{cd CanFestival-3}
730 \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN-Light/Api/}
732 \texttt{export PCAN\_HEADER=Pcan\_usb.h}
734 \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN-Light/Lib/Visual\textbackslash{}
737 \texttt{./configure -{}-can=peak\_win32}
742 In order to test, you have to use another CanFestival node, connect
745 \texttt{cp \~{ }/Disk/PCAN-Light/Pcan\_usb.dll .}
747 \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}}
749 \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll \textbackslash{}}
751 \texttt{-S 500K -M none}~\\
754 Then, on the other node :
756 \texttt{./TestMasterSlave -l my\_driver.so -S none -M 500K -m 0}
758 Now messages are beeing exchanged between master and slave node.
761 \paragraph{Two nodes with PcanLight and Peak dual PCMCIA-CAN adapter}
763 Download the PCAN-Light Zip file for your HW ( URL from download page
766 \texttt{wget http://www.peak-system.com/files/pccard.zip}~\\
768 Extract its content into your MSYS's home (it will create a \char`\"{}Disk\char`\"{}
771 \texttt{unzip pccard.zip}~\\
773 The configure CanFestival3 providing path to the desired PcanLight
777 \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN-Light/Api/}
779 \texttt{export PCAN\_HEADER=Pcan\_pcc.h}
781 \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN-Light/Lib/Visual\textbackslash{}
784 \texttt{export PCAN2\_HEADER=Pcan\_2pcc.h}
786 \texttt{export PCAN2\_LIB=\~{ }/Disk/PCAN-Light/Lib/Visual\textbackslash{}
787 C++/Pcan\_2pcc.lib}~\\
790 In order to test, just connect together both CAN ports of the PCMCIA
791 card. Don't forget 120ohms terminator.
793 \texttt{cp\~{ }/Disk/PCAN-Light/Pcan\_pcc.dll ~.}
795 \texttt{cp \~{ }/Disk/PCAN-Light/Pcan\_2pcc.dll ~.}
797 \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}}
799 \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll -m 0 -s
803 Messages are then exchanged between master and slave node, both inside
804 TestMasterSlave's process.
806 \section{Motorola HCS12}
807 The examples have been tested on a MC9S12DG255 mounted on a
808 Elektronikladen HCS12 T{}-board.
810 Beware that there are few differences in the MSCAN module of the
811 68HC12 and HCS12 microcontroller. For a HC12, you must adapt the driver
812 that we provide for \space the HCS12.
814 For the difference MSCAN HC12/HCS12, see the Motorola application note
822 To do a \canopen{} node running on a microncontroller Motorola MC9S12DP256,
827 \item The compiler GNU gcc for HC11, HC12, HCS12 : m6811{}-elf. \newline
828 Download the \textbf{release 3.1} at :
829 \space \href{http://m68hc11.serveftp.org/m68hc11_pkg_rpm.php}{http://m68hc11.serveftp.org/m68hc11\_pkg\_rpm.php}
831 \item A board with this chip. We are using the T{}-board from
833 \item At least about 40 kBytes of program memory.
834 \item A tool to flash the memory. (We are using the hight cost
835 Lauterbach debugger).
837 \subsection{Running a HCS12 node}
838 \subsubsection{Compiling Canfestival:}
840 ./configure {--}target=hcs12}
842 \subsubsection{Compiling and building an example}
843 Enter in the folder of an HCS12 example,
848 \subsubsection{Flashing the memory :}
849 Use your prefered loader ! If you are using a debugger Lauterbach, you
850 can load the bash file : trace32\_flash\_programmer.cmm. It loads
851 directly the elf file.
853 \subsubsection{Connecting to a serial RS232 console :}
854 Connect the portS(TxD0) of the HCS12 to a console configured at 19200
855 bauds 8N1, via a Max232 chip to adapt the electricals levels. On Linux,
856 you can use minicom. Connecting to a console is usefull to read the
857 messages, but not required.
859 \subsubsection{Connecting to the CAN network :}
860 Connect the port CAN0 (pin PM0, PM1) to the network via a CAN
861 controller. On our board, the CAN controler is a PCA82C250 chip.
863 \subsubsection{starting the node :}
864 Press the reset of your HCS12 board.
866 \section{Example and test program:}
867 The ``examples'' directory contains some test program you can use as
868 example for your own developments.
870 \subsection{TestMasterSlave}
872 **************************************************************\space}
875 * \space TestMasterSlave
876 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
880 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
883 * \space A simple example for PC. It does implement 2 \canopen{} \space \space \space \space \space *}
886 * \space nodes in the same process. A master and a slave. Both \space \space \space \space *}
889 * \space communicate together, exchanging periodically NMT, SYNC, \space *}
892 * \space SDO and PDO. Master configure heartbeat producer time \space \space \space \space *}
895 * \space at 1000 ms for slave node{}-id 0x02 by concise DCF.
896 \space \space \space \space \space \space \space \space *}
900 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
903 * \space \space Usage:
904 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
907 * \space \space ./TestMasterSlave \space [OPTIONS]
908 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
912 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
915 * \space \space OPTIONS:
916 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
919 * \space \space \space \space {}-l : Can library
920 [{\textquotedbl}libcanfestival\_can\_virtual.so{\textquotedbl}]
921 \space \space \space \space *}
925 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
928 * \space \space \space Slave:
929 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
932 * \space \space \space \space {}-s : bus name [{\textquotedbl}0{\textquotedbl}]
933 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
936 * \space \space \space \space {}-S : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) \space *}
940 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
943 * \space \space \space Master:
944 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
947 * \space \space \space \space {}-m : bus name [{\textquotedbl}1{\textquotedbl}]
948 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
951 * \space \space \space \space {}-M : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) \space *}
955 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
958 **************************************************************}
964 Notes for Concise DCF :}
970 In this example, Master configure \space heartbeat producer time at 1000 ms
971 for slave node{}-id 0x02 by concise DCF according DS{}-302 profile. }
977 Index 0x1F22 , sub{}-index 0x00 of the master OD, correspond to the
978 number of entries. This equal to the maximum possible nodeId (127).
979 Each sub{}-index points to the Node{}-ID of the device, to which the
980 configuration belongs. }
986 To add more parameters configurations to the slave, the value at
987 sub{}-index 0x02 must be a binary stream (little{}-endian) following
988 this structure :\newline
990 (UNS32) nb of entries\newline
991 (UNS16) index parameter 1\newline
992 (UNS8) sub{}-index parameter 1\newline
993 (UNS32) size data parameter 1\newline
994 (DOMAIN) data parameter 1\newline
995 (UNS16) index parameter 2\newline
996 (UNS8) sub{}-index parameter 2\newline
997 (UNS32) size data parameter 2\newline
998 (DOMAIN) data parameter 2\newline
999 \space \space \space \space \space ....\newline
1000 (UNS16) index parameter n\newline
1001 (UNS8) sub{}-index parameter n\newline
1002 (UNS32) size data parameter n\newline
1003 (DOMAIN) data parameter n\newline
1008 So the binary value stream to configure heartbeat producer time must be
1010 0100000017100002000000e803}
1013 The slave node is configured just before the Master entering in
1014 Pre\_operational state.}
1016 \subsection{gene\_SYNC\_HCS12 :}
1017 This is a simple \canopen{} node that only send cyclic SYNC message. It
1018 demonstrate implementation on HCS12 based board.
1022 \subsection{kerneltest :}
1024 Example based on TestMasterSlave slightly modified to suit kernel space requisites. It will do the same as TestMasterSlave but in kernel space sending kernel messages (displayed by dmesg for example). It is designed as external kernel module implemented as character device. There is a shell script called 'insert.sh', which will insert the module and create a new device file /dev/canf\_ktest (used to sending commands to module). To actual sending commands you can use simple console named 'canf\_ktest\_console'.
1025 The module is dependent on a another separate module 'canfestival.ko' implementing CanOpen stack which exports requisite functions. Canfestival.ko module is then dependent on CAN card driver module, by default CAN virtual driver will be loaded. After installing modules (make install), all dependencies are solved automatically by kernel.
1026 To run the example type:
1029 It will insert required modules, start console, and after quitting console it'll remove modules from kernel.
1033 \subsection{TestMasterMicroMod }
1035 **************************************************************}
1038 * \space TestMasterMicroMod
1039 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1043 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1046 * \space A simple example for PC.
1047 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1050 * \space A \canopen{} master that control a MicroMod module:
1051 \space \space \space \space \space \space \space \space \space *}
1054 * \space {}- setup module TPDO 1 transmit type
1055 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1058 * \space {}- setup module RPDO 1 transmit type
1059 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1062 * \space {}- setup module hearbeatbeat period
1063 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1066 * \space {}- disable others TPDOs
1067 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1070 * \space {}- set state to operational
1071 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1074 * \space {}- send periodic SYNC
1075 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1078 * \space {}- send periodic RPDO 1 to Micromod (digital output) \space \space \space \space \space \space *}
1081 * \space {}- listen Micromod{\textquotesingle}s TPDO 1 (digital input)
1082 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1085 * \space {}- Mapping RPDO 1 bit per bit (digital input)
1086 \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1090 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1093 * \space \space Usage:
1094 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1097 * \space \space ./TestMasterMicroMod \space [OPTIONS]
1098 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1102 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1105 * \space \space OPTIONS:
1106 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1109 * \space \space \space \space {}-l : Can library
1110 [{\textquotedbl}libcanfestival\_can\_virtual.so{\textquotedbl}]
1111 \space \space \space \space *}
1115 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1118 * \space \space \space Slave:
1119 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1122 * \space \space \space \space {}-i : Slave Node id format [0x01 , 0x7F]
1123 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1127 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1130 * \space \space \space Master:
1131 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1134 * \space \space \space \space {}-m : bus name [{\textquotedbl}1{\textquotedbl}]
1135 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1138 * \space \space \space \space {}-M : 1M,500K,250K,125K,100K,50K,20K,10K
1139 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1143 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space *}
1146 **************************************************************}
1148 \section{Developing a new node}
1149 Using provided examples as a base for your new node is generally a good
1150 idea. You can also use the provided *.od files as a base for your node
1153 Creating a new \canopen{} node implies to define the Object Dictionary of
1154 this node. For that, developer has to provide a C file. This C file
1155 contains the definition of all dictionary entries, and some kind of
1156 index table that helps the stack to access some entries directly.
1158 \subsection{Using Dictionary Editor GUI}
1159 The Object Dictionary Editor is a WxPython based GUI that is used to
1160 create the C file needed to create a new \canopen{} node.
1162 \subsubsection{Installation and usage on Linux}
1163 You first have to download and install Gnosis XML modules. This is
1164 automated by a Makefile rule.
1172 Now start the editor.
1175 python objdictedit.py [od files...]}
1177 \subsubsection{Installation and usage on Windows}
1178 Install Python (at least version 2.4) and wxPython (at least version
1181 Cygwin users can install Gnosis XML utils the same as Linux use. Just
1190 Others will have to download and intall Gnosis XML by hand :
1196 http://freshmeat.net/projects/gnosisxml/}
1199 http://www.gnosis.cx/download/Gnosis\_Utils.More/Gnosis\_Utils{}-1.2.1.win32{}-py24.exe}
1202 Get latest version.}
1204 Download CanFestival archive and uncompress it. Use windows file
1205 explorer to go into CanFestival3{\textbackslash}objdicgten, and
1206 double{}-click on objdictedit.py.
1208 \subsubsection{About}
1209 The Object Dictionary editor GUI is a python application that use the
1210 Model{}-View{}-Controller design pattern. It depends on WxPython to
1211 display view on any supported platform.
1214 \includegraphics[width=7cm]{Pictures/10000201000001FC000001E5D65E8766.png}
1217 \subsubsection{Main view}
1218 Top list let you choose dictionary section, bottom left list is the
1219 selected index in that dictionary, and bottom right list are edited
1223 \includegraphics[width=12cm]{Pictures/10000201000003E7000001C7B0296577.png}
1227 \includegraphics[width=3cm]{Pictures/10000000000000B6000000DF1EDD1E73.png}
1230 \includegraphics[width=3cm]{Pictures/10000000000000AC000000C9C3F53FA6.png}
1233 \includegraphics[width=3cm]{Pictures/100000000000006D000000A31EC8CB54.png}
1236 \includegraphics[width=3cm]{Pictures/10000000000000AA0000006014F74635.png}
1239 \subsubsection{New node}
1240 Edit your node name, ID and type. Choose your inherited specific
1244 \includegraphics[width=11cm]{Pictures/10000201000001CB0000015F4FC09B68.png}
1247 \subsubsection{Node info}
1248 Edit your node name, ID and type.
1251 \includegraphics[width=7cm]{Pictures/10000201000001010000011DA724D25C.png}
1254 \subsubsection{Profile editor}
1255 Chose the used profile to edit.\newline
1257 \includegraphics[width=4cm]{Pictures/10000000000000AB000000C88F594413.png}
1260 Pick up optional chosen profile entries.\newline
1262 \includegraphics[width=11cm]{Pictures/10000201000002DE000001D82D89C224.png}
1265 \subsubsection{User types}
1266 Use User Types to implement value boundaries, and string lentgth\newline
1268 \includegraphics[width=11cm]{Pictures/10000201000001C40000010766961D7F.png}
1271 \subsubsection{Mapped variable}
1272 Add your own specific dictionary entries and associated mapped
1275 \includegraphics[width=11cm]{Pictures/10000201000001C4000000DD129D4661.png}
1278 \subsubsection{Integrated help}
1279 Using F1 key, you can get context sensitive help.\newline
1281 \includegraphics[width=12cm]{Pictures/10000201000002F30000020B23ED7F67.png}
1284 In order to do that, official 301\_v04000201.pdf file must be placed
1285 into doc/ directory, and xpdf must be present on your system.
1287 F2 key open HTML CanFestival help.\newline
1289 \includegraphics[width=12cm]{Pictures/10000201000003440000025ACC3FD2F1.png}
1292 \subsection{Generating the object Dictionary}
1293 Once object dictionary has been edited and saved, you have to generate
1294 object dictionary C code for your CanFestival node.
1296 \subsubsection{With GUI}
1297 Menu entry ``File/Build Dictionary''.
1300 \includegraphics[width=4cm]{Pictures/10000201000000B7000000C66AF89CD5.png}
1303 Choose C file to create or overwrite. Header file will be also created
1304 with the same prefix as C file.
1306 \subsubsection{With command line}
1308 Usage of objdictgen.py :\newline
1309 python objdictgen.py XMLFilePath CfilePath}
1312 \subsection{General}
1313 \subsubsection{Does the code compiles on Windows ?}
1314 Yes, with both Cygwin and Visual Studio C++.
1316 Because \canopen{} layer is coded with C, put a compilation option /TC or
1317 /TP if you plan to mix C++ files. See the MSDN documentation about
1320 \subsubsection{How to fit the library to an other microcontr\^oler ?}
1321 First, be sure that you have at least 40K bytes of program memory, and
1324 You have to create target specific interface to HW resources. Take model
1325 on bundled interfaces provided in drivers/ and create your own
1326 interface. You also have to update Makefile.in files for target
1327 specific cflags and options. Choose {--}target= configure switch to
1328 compile your specific interface.
1330 You are welcome to contribute{}-back your own interfaces! Other
1331 Canfestival users will use it and provide feedback, tests and
1334 \subsubsection{Is CanFestival3 conform to DS301 v.4.02 ?}
1335 Thanks to Philippe Foureys (IUT of Valence), a slave node have been
1336 tested with the National Instrument \canopen{} Conformance Test. It passed
1337 the test with success.
1339 Some very small unconformity have been found in very unusual situations,
1340 for example in the SDO code response to wrong messages.
1343 \subsubsection{How to use a Peaksystem CAN board ?}
1344 Just install peak driver and then compile and install Canfestival. Peak
1345 driver is detected at compile time.
1347 \subsubsection{How to use an unsupported CAN board ?}
1348 You have to install the specific driver on your system, with necessary
1351 Use can\_peak.c/h or can\_virtual.c/h as an example, and adapt it to
1354 Execute configure script and choose {}-{}-can=mydriver
1361 \item Code was compiled MS VisualStudio 2003.NET and VisualStudio
1362 2005.NET for WindowsXP \space with ANSI and UNICODE configurations and for
1364 \item Some preliminary testing was done, but not enough to be used in
1365 mission critical projects.
1367 Additional Features:
1371 \item Non{}-integral integers support implementation UNS24, UNS40, UNS48
1373 \item When enable debug output with DEBUG\_WAR\_CONSOLE\_ON or
1374 DEBUG\_ERR\_CONSOLE\_ON, you can navigate in CanFestival source code by
1375 double clicking at diagnostic lines in VisualStudio.NET 200X Debug
1378 Custom size integral types such as INTEGER24, UNS40, INTEGER56 etc. have
1379 been defined as 64 bits integers. You will need to replace sizeof(TYPE)
1380 operators to sizeof\_TYPE definitions in generated code, i.e. replace
1381 sizeof(UNS40) with sizeof\_UNS40.
1387 \subsubsection{Which board are you using ?}
1388 A T{}-board from elektronikladen with a MC9S12DP256 or MC9S12DG256.
1390 \subsubsection{Does the code compile with an other compiler than GNU gcc
1392 It is known to work with Metrowerks CodeWarrior. Here are some tips from
1395 \paragraph{Interrupt functions}
1396 \subparagraph{Code for GCC:}
1398 // prototype\newline
1399 void \_\_attribute\_\_((interrupt))timer3Hdl(void):\newline
1401 void \_\_attribute\_\_((interrupt))timer3Hdl(void)\{...\}}
1403 \subparagraph{Code for CodeWarrior}
1406 void interrupt timer3Hdl(void);\newline
1408 pragma CODE\_SEG\_\_NEAR\_SEG\_NON\_BANKED\newline
1409 void interrupt timer3Hdl(void)\newline
1411 pragma CODE\_SEG\_DEFAULT}
1413 \paragraph{Interrupt lock, unlock}
1414 \subparagraph{Code for GCC}
1416 void unlock (void)\newline
1419 \_\_volatile\_\_({\textquotedbl}cli{\textquotedbl});\newline
1421 void lock (void)\newline
1423 \space unsigned short mask;\newline
1425 \_\_volatile\_\_({\textquotedbl}tpa{\textbackslash}n{\textbackslash}tsei{\textquotedbl}:{\textquotedbl}=d{\textquotedbl}(mask));\newline
1428 \subparagraph{Code for CodeWarrior}
1430 void unlock (void)\newline
1432 \space \_\_asm({\textquotedbl}cli{\textquotedbl});\newline
1434 void lock (void)\newline
1436 \space unsigned short mask;\newline
1437 \space \_\_asm\newline
1439 \space tpa:tsei:{\textquotedbl}=d{\textquotedbl}(mask);\newline
1443 \paragraph{Initialize function}
1444 \subparagraph{Code for GCC}
1446 void initCanHCS12 (void)\newline
1448 \space //Init the HCS12 microcontroler for \canopen{} \newline
1449 \space initHCS12();\newline
1450 \space \space // Init the HCS12 \space CAN driver\newline
1451 \space const canBusInit bi0 = \{\newline
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 */
1454 \space \space \space 0, \space \space \space /* no time stamp
1455 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space */\newline
1456 \space \space \space 1, \space \space \space /* enable MSCAN
1457 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space */\newline
1458 \space \space \space 0, \space \space \space /* clock source : oscillator (In fact, it is not used)
1459 \space \space */\newline
1460 \space \space \space 0, \space \space \space /* no loop back
1461 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space */\newline
1462 \space \space \space 0, \space \space \space /* no listen only
1463 \space \space \space \space \space \space \space \space \space \space \space \space \space \space */\newline
1464 \space \space \space 0, \space \space \space /* no low pass filter for wk up */\newline
1465 \space CAN\_Baudrates[CAN\_BAUDRATE\_250K],\newline
1466 \space \space \space \{\newline
1467 \space \space \space \space \space 0x00, \space \space \space /* Filter on 16 bits.\newline
1468 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space See Motorola Block Guide V02.14 fig
1470 \space \space \space \space \space 0x00, 0xFF, /* filter 0 hight accept all msg
1471 \space \space \space \space \space */\newline
1472 \space \space \space \space \space 0x00, 0xFF, /* filter 0 low accept all msg
1473 \space \space \space \space \space \space \space */\newline
1474 \space \space \space \space \space 0x00, 0xFF, /* filter 1 hight filter all of \space msg
1476 \space \space \space \space \space 0x00, 0xFF, /* filter 1 low filter all of \space msg
1477 \space \space \space */\newline
1478 \space \space \space \space \space 0x00, 0xFF, /* filter 2 hight filter most of \space msg
1480 \space \space \space \space \space 0x00, 0xFF, /* filter 2 low filter most of \space msg
1481 \space \space */\newline
1482 \space \space \space \space \space 0x00, 0xFF, /* filter 3 hight filter most of \space msg
1484 \space \space \space \space \space 0x00, 0xFF, /* filter 3 low filter most of \space msg
1485 \space \space */\newline
1486 \space \space \space \}\newline
1489 \subparagraph{Code for CodeWarrior}
1491 void initCanHCS12 (void)\newline
1493 \space //Init the HCS12 microcontroler for \canopen{} \newline
1494 \space initHCS12();\newline
1495 \space \space // Init the HCS12 \space CAN driver\newline
1496 \space const canBusInit bi0 = \{\newline
1497 \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 */
1499 \space \space \space 0, \space \space \space /* no time stamp
1500 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space */\newline
1501 \space \space \space 1, \space \space \space /* enable MSCAN
1502 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space */\newline
1503 \space \space \space 0, \space \space \space /* clock source : oscillator (In fact, it is not used)
1504 \space \space */\newline
1505 \space \space \space 0, \space \space \space /* no loop back
1506 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space */\newline
1507 \space \space \space 0, \space \space \space /* no listen only
1508 \space \space \space \space \space \space \space \space \space \space \space \space \space \space */\newline
1509 \space \space \space 0, \space \space \space /* no low pass filter for wk up */\newline
1510 \space \space \space \{\newline
1511 \space \space \space \space 1, /* clksrc */\newline
1512 \space \space \space \space 3, /* brp \space \space \space */\newline
1513 \space \space \space \space 0, /* sjw \space \space \space */\newline
1514 \space \space \space \space 0, /* samp \space \space */\newline
1515 \space \space \space \space 1, /* tseg2 \space */\newline
1516 \space \space \space \space 12,/* tseg1 \space */\newline
1517 \space \space \space \},\newline
1518 \space \space \space \{\newline
1519 \space \space \space \space \space 0x00, \space \space \space /* Filter on 16 bits.\newline
1520 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space See Motorola Block Guide V02.14 fig
1522 \space \space \space \space \space 0x00, 0xFF, /* filter 0 hight accept all msg
1523 \space \space \space \space \space */\newline
1524 \space \space \space \space \space 0x00, 0xFF, /* filter 0 low accept all msg
1525 \space \space \space \space \space \space \space */\newline
1526 \space \space \space \space \space 0x00, 0xFF, /* filter 1 hight filter all of \space msg
1528 \space \space \space \space \space 0x00, 0xFF, /* filter 1 low filter all of \space msg
1529 \space \space \space */\newline
1530 \space \space \space \space \space 0x00, 0xFF, /* filter 2 hight filter most of \space msg
1532 \space \space \space \space \space 0x00, 0xFF, /* filter 2 low filter most of \space msg
1533 \space \space */\newline
1534 \space \space \space \space \space 0x00, 0xFF, /* filter 3 hight filter most of \space msg
1536 \space \space \space \space \space 0x00, 0xFF, /* filter 3 low filter most of \space msg
1537 \space \space */\newline
1538 \space \space \space \}\newline
1541 \subsubsection{Does the code works in banked memory ?}
1542 No. Today it seems that the port of gcc is bogged for using the banked
1543 memory. So, unfortunately, we are limited to 48 Kbytes of memory code.
1545 \subsubsection{What GCC version are you using ?}
1546 We are using the stable RPM release 2.2 :
1550 \item GNU Gcc 3.0.4. Build 20030501
1551 \item Newlib 1.10.0 Build 20030421
1552 \item GNU Binutils 2.12.1 Build 20030427
1554 \section{Documentation resources\newline}
1555 \paragraph{CIA : Can in Automation\newline}
1556 Many documentation on \canopen{}.\newline
1557 \href{http://www.can-cia.de/}{http://www.can{}-cia.de}
1559 \paragraph{Resources and training in \canopen{}\newline}
1560 \href{http://www.esacademy.com/}{http://www.esacademy.com}
1562 \paragraph{Elektronikladen HCS12 T{}-board\newline}
1563 \href{http://www.elektronikladen.de/en_hcs12tb.html}{http://www.elektronikladen.de/en\_hcs12tb.html}
1565 \paragraph{Gnu gcc compiler for HC12\newline}
1566 \href{http://m68hc11.serveftp.org/m68hc11_port.php}{http://m68hc11.serveftp.org/m68hc11\_port.php}
1568 \paragraph{Motorola documentation on HC12\newline}
1569 \href{http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MC9S12DP256}{http://www.freescale.com/webapp/sps/site/prod\_summary.jsp?code=MC9S12DP256}
1571 \paragraph{Lauterbach debugger for HC12\newline}
1572 \href{http://www.lauterbach.com/}{http://www.lauterbach.com}
1574 \paragraph{Python language\newline}
1575 \href{http://www.python.org/}{http://www.python.org}
1577 \clearpage\section{About the project}
1578 \subsection{Contributors }
1580 \includegraphics[width=10cm]{Pictures/1000020100000258000000832C6FFAB4.png}
1583 Unit\'e mixte de recherche INRETS{}-LCPC
1585 sur les Interractions V\'ehicule{}-Infrastructure{}-Conducteur
1587 14, route de la mini\`ere
1593 Tel : +33 1 40 43 29 01
1595 \href{http://www.inrets.fr/ur/livic}{http://www.inrets.fr/ur/livic}
1597 \textbf{Contributors :} Francis DUPIN
1607 \includegraphics[width=10cm]{Pictures/100002010000013A0000004A96B0C1FF.png}
1612 204, rue du Haut du Pin
1614 88470 Saint{}-Michel sur Meurthe
1618 Tel : +33 3 29 52 95 67
1620 \href{http://www.lolitech.fr/}{http://www.lolitech.fr}
1623 Contributors : \textmd{Edouard TISSERANT (Original author)}}
1631 Many thanks to the other contributors for their great work:
1633 \textmd{ }Raphael ZULLIGER
1635 \textmd{ }David DUMINY (st\'e A6R)
1637 \textmd{ }Zakaria BELAMRI
1639 \subsection{Getting support}
1640 Send your feedback and bug reports to
1641 \href{mailto:canfestival-devel@lists.sourceforge.net}{canfestival{}-devel@lists.sourceforge.net}.
1643 For commercial support, \space training and specific integration and
1644 developments, please ask LOLITECH (see contributors).
1646 \subsection{Contributing}
1647 You are free to contribute your specific interfaces back to the project.
1648 This way, you can hope to get support from CanFestival users community.
1650 Please send your patch to
1651 \href{mailto:canfestival-devel@lists.sourceforge.net}{canfestival{}-devel@lists.sourceforge.net}.
1653 Feel free to create some new predefined DS{}-4xx profiles (*.prf) in
1654 objdictgen/config, as much as possible respectful to the official
1657 \subsection{License}
1658 All the project is licensed with LGPL. This mean you can link
1659 CanFestival with any code without being obliged to publish it.
1662 \#This file is part of CanFestival, a library implementing \canopen{}
1665 \#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD
1668 \#See COPYING file for copyrights details. \newline
1670 \#This library is free software; you can redistribute it and/or \newline
1671 \#modify it under the terms of the GNU Lesser General Public \newline
1672 \#License as published by the Free Software Foundation; either \newline
1673 \#version 2.1 of the License, or (at your option) any later version.
1676 \#This library is distributed in the hope that it will be useful,
1678 \#but WITHOUT ANY WARRANTY; without even the implied warranty of
1680 \#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \space See the GNU
1682 \#Lesser General Public License for more details. \newline
1684 \#You should have received a copy of the GNU Lesser General Public
1686 \#License along with this library; if not, write to the Free Software
1688 \#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1689 \space 02111{}-1307 \space USA }