etisserant@393: %% LyX 1.5.1 created this file. For more info, see http://www.lyx.org/. etisserant@393: %% Do not edit unless you really know what you are doing. etisserant@393: \documentclass[12pt,english,a4paper]{book} nico@208: \usepackage[T1]{fontenc} etisserant@393: \usepackage[latin9]{inputenc} etisserant@393: \setcounter{secnumdepth}{5} etisserant@393: \setcounter{tocdepth}{3} etisserant@393: \usepackage{graphicx} etisserant@393: \usepackage{amsfonts} etisserant@393: \usepackage{textcomp} nico@208: \usepackage{color} nico@208: \usepackage{calc} nico@208: \usepackage{longtable} nico@208: \usepackage{hyperref} nico@208: \usepackage{graphics} nico@208: \DeclareGraphicsExtensions{.jpg} nico@208: \DeclareGraphicsExtensions{.png} nico@208: \hypersetup{colorlinks=true, linkcolor=blue, filecolor=blue, pagecolor=blue, urlcolor=blue} nico@208: nico@208: %%%%\%%%%%%%% titre, auteurs, date, etc...%%%%%%%%%%%%%%%%%% etisserant@249: \title{\Huge The CanFestival CANOpen stack manual} nico@208: \author{Edouard TISSERANT} nico@208: \date{\today} nico@208: etisserant@393: \newcommand{\canopen}{CANopen } etisserant@392: nico@208: \begin{document} etisserant@393: {\centering\textsf{\huge The CanFestival \canopen stack manual.}} etisserant@393: etisserant@393: \renewcommand{\contentsname}{CanFestival v3.0 Manual} etisserant@393: \setcounter{tocdepth}{2} \tableofcontents{} etisserant@393: etisserant@393: \clearpage{} etisserant@393: nico@208: \section{Introduction} etisserant@393: etisserant@393: CanFestival is an OpenSource (LGPL and GPL) \canopen framework. nico@208: nico@208: \subsection{The CanFestival project} etisserant@393: etisserant@393: This project, initiated by Edouard TISSERANT in 2001, has grown thanks etisserant@393: to Francis DUPIN and other contributors. etisserant@393: etisserant@393: Today, CanFestival focuses on providing an ANSI-C platform independent etisserant@393: \canopen stack that can be implemented as master or slave nodes on etisserant@393: PCs, Real-time IPCs, and Microcontrollers. nico@208: nico@208: CanFestival is a project supported by Lolitech. nico@208: etisserant@393: etisserant@393: \subsection{What is \canopen} etisserant@393: etisserant@393: CANopen is a CAN based high level protocol. It defines some protocols etisserant@393: to : etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item Configure a CAN network. etisserant@393: \item Transmit data to a specific node or in broadcast. etisserant@393: \item Administrate the network. For example detecting a not responding node. nico@208: \end{enumerate} etisserant@392: The documentation can be found on the CAN in Automation website : nico@208: etisserant@393: \href{http://www.can-cia.de/canopen}{http://www.can-cia.de/canopen} etisserant@393: etisserant@393: The most important document about \canopen is the normative CiA Draft etisserant@393: Standard 301, version 4.02. You can now download the specification etisserant@393: from the CAN in Automation website at no cost. etisserant@393: etisserant@393: To continue reading this document, let us assume that you have read etisserant@393: some papers introducing \canopen . etisserant@393: nico@208: nico@208: \section{CanFestival Features} etisserant@393: etisserant@393: nico@208: \subsection{Tools } etisserant@393: etisserant@393: The \canopen library is coming with some tools : etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item Object Dictionary editor GUI. WxPython Model-View-Controler based etisserant@393: GUI, that help a lot in generating object dictionary source code for etisserant@393: each node. etisserant@393: \item A configure script, that let you chose compile time options such as etisserant@393: target CPU/HOST, CAN and TIMER drivers.\\ etisserant@393: This script has not been generated with autoconf, it has been made etisserant@393: keeping micro-controller target in mind. nico@208: \end{enumerate} etisserant@393: nico@208: \subsection{Standard conformance} etisserant@393: etisserant@393: etisserant@393: \subsubsection{Multi-Platform} etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item Library source code is C-ANSI. etisserant@393: \item Driver and examples coding conventions merely depend on target specific etisserant@393: contributor/compiler. nico@208: \item Unix compatible interfaces and examples should compile and run on etisserant@393: any Unix system (tested on GNU/Linux and GNU/FreeBSD). nico@208: \end{enumerate} etisserant@393: etisserant@393: \subsubsection{\canopen conformance} etisserant@393: etisserant@393: etisserant@393: \paragraph{DS-301} etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item Should conform to DS301. V.4.02 13 february 2002. etisserant@393: \item Master and Slave functionality implemented. etisserant@393: \item Sending SYNC implemented. nico@208: \item 1 SDO server per node. (update: more than one possible. To be more etisserant@393: tested) etisserant@393: \item Unlimited SDO client. etisserant@393: \item SDO transmission mode : normal, expedited download and upload. etisserant@393: \item Unlimited PDO receive. etisserant@393: \item Unlimited PDO transmit. etisserant@393: \item Object Data type implemented : 8, 16, 32 bits values, and fixed length etisserant@393: strings. etisserant@393: \item Slave state full implemented. etisserant@393: \item NMT to change slaves state implemented. etisserant@393: \item PDO transmission mode : on request, every reception of 0 to n SYNC, etisserant@393: on event. etisserant@393: \item NMT Heartbeat implemented : A node can be either heartbeat producer etisserant@393: or receiver. etisserant@393: \item NMT NodeGuard implemented : Not fully implemented. etisserant@393: \item TIME (time Stamp) : Not implemented. etisserant@393: \item EMCY (emergency objects) : Sending and reception of EMCY objectos etisserant@393: (without manufacturer specific error field). etisserant@393: \item PDO Mapping bit per bit implemented. nico@208: \end{enumerate} etisserant@393: etisserant@393: \paragraph{DS-302} etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item Concise DFC : implemented. nico@208: \end{enumerate} etisserant@393: nico@208: \section{How to start} etisserant@393: etisserant@393: nico@208: \subsection{Host requirements} etisserant@393: nico@208: What you need on your development workstation. nico@208: etisserant@393: nico@208: \subsubsection{Object Dictionary Editor GUI} etisserant@393: nico@208: \begin{enumerate} nico@208: \item Python, with nico@208: \item wxPyhon modules installed (at least version 2.6.3). etisserant@393: \item Gnosis xml tools. (Optional can also be installed locally to the project etisserant@393: automatically with the help of a Makefile. Please see {}``Using Dictionary etisserant@393: Editor GUI'' ) nico@208: \end{enumerate} etisserant@393: etisserant@393: \subsubsection{Linux and Unix-likes} etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item Linux, FreeBSD, Cygwin or any Unix environment with GNU toolchain. etisserant@393: \item The GNU C compiler (gcc) or any other ANSI-C compiler for your target etisserant@393: platform. nico@208: \item Xpdf, and the official 301\_v04000201.pdf file in order to get GUI etisserant@393: context sensitive help. etisserant@393: \item GNU Make etisserant@393: \item Bash and sed nico@208: \end{enumerate} etisserant@393: nico@208: \subsubsection{Windows (for native win32 target)} etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item Visual Studio Express 2005 or worst. etisserant@393: \item Microsoft platform SDK (requires Genuine Advantage) etisserant@393: \item Cygwin (for configuration only) nico@208: \end{enumerate} etisserant@393: nico@208: \subsection{How to get CanFestival} etisserant@393: nico@208: Please always use CVS, this is the best way to get the most reactive nico@208: support from the developer community : nico@208: etisserant@393: cvs -d:pserver:anonymous@lolitech.dyndns.org:/canfestival login\\ etisserant@393: (type return, without entering a password) etisserant@393: etisserant@393: Then, enter : \\ etisserant@393: cvs -z3 -d:pserver:anonymous@lolitech.dyndns.org:/canfestival co etisserant@393: -P CanFestival-3 etisserant@393: nico@208: nico@208: \section{Understanding Canfestival} etisserant@393: etisserant@393: nico@208: \subsection{CanFestival Project tree layout} etisserant@393: nico@208: Simplified directory structure. nico@208: etisserant@393: \texttt{\textbf{./src ANSI-C source of \canopen stack}} etisserant@393: etisserant@393: \texttt{\textbf{./include Exportables Header files}} etisserant@393: etisserant@393: \texttt{\textbf{./drivers Interfaces to specific platforms/HW}} etisserant@393: etisserant@393: \texttt{./drivers/unix Linux and Cygwin OS interface} etisserant@393: etisserant@393: \texttt{./drivers/win32 Native Win32 OS interface} etisserant@393: etisserant@393: \texttt{./drivers/timers\_xeno Xenomai timers/threads (Linux only)} etisserant@393: etisserant@393: \texttt{./drivers/timers\_kernel Linux kernel timer/threads} etisserant@393: etisserant@393: \texttt{./drivers/timers\_unix Posix timers/threads (Linux, Cygwin)} etisserant@393: etisserant@393: \texttt{./drivers/can\_virtual\_kernel Fake CAN network (kernel space)} etisserant@393: etisserant@393: \texttt{./drivers/can\_peak\_linux PeakSystem CAN library interface} etisserant@393: etisserant@393: \texttt{./drivers/can\_peak\_win32 PeakSystem PCAN -Light interface} etisserant@393: etisserant@393: \texttt{./drivers/can\_uvccm\_win32 Acacetus{\textquotesingle}s etisserant@393: RS232 {}``CAN -uVCCM'' interface} etisserant@393: etisserant@393: \texttt{./drivers/can\_virtual Fake CAN network (Linux, Cygwin)} etisserant@393: etisserant@393: \texttt{./drivers/hcs12 HCS12 full target interface} etisserant@393: etisserant@393: \texttt{\textbf{./examples Examples}} etisserant@393: etisserant@393: \texttt{./examples/TestMasterSlave 2 nodes, NMT SYNC SDO PDO, win32+unix} etisserant@393: etisserant@393: \texttt{./examples/TestMasterMicroMod 1 node, control Peak I/O Module, etisserant@393: unix} etisserant@393: etisserant@393: \texttt{./examples/gene\_SYNC\_HCS12 Just send periodic SYNC on HCS12} etisserant@393: etisserant@393: \texttt{./examples/win32test Ask some DS301 infos to a node (}\texttt{\textbf{win32)}} etisserant@393: etisserant@393: \texttt{\textbf{./objdictgen Object Dictionary editor GUI}} etisserant@393: etisserant@393: \texttt{./objdictgen/config Pre -defined OD profiles} etisserant@393: etisserant@393: \texttt{./objdictgen/examples Some examples/test OD} etisserant@393: etisserant@393: \texttt{\textbf{./doc Project and \canopen doc}} etisserant@393: nico@208: nico@208: \subsection{Implement CanFestival in your application} etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=12cm]{Pictures/10000201000003F9000002CF880931E7} etisserant@393: \par\end{center} etisserant@393: etisserant@393: \bigskip{} etisserant@393: etisserant@393: nico@208: nico@208: \subsection{CanFestival CAN interfaces} etisserant@393: nico@208: Because most CAN controllers and drivers implement FIFOs, CanFestival nico@208: consider sending message as a non bloking operation. nico@208: etisserant@393: In order to prevent reentrent calls to the stack, messages reception etisserant@393: is implemented differently on {\textmu}C and OS.: etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item {\textmu}C must provide interuption masking for timer and can receive etisserant@393: TI\\ etisserant@393: etisserant@393: etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=12cm]{Pictures/10000201000003CA0000016604E6A5EF} etisserant@393: \par\end{center} etisserant@393: nico@208: \item OS must provide a receive thread, a timer thread and a mutex. CAN etisserant@393: reception is a bloking operation.\\ etisserant@393: etisserant@393: etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=12cm]{Pictures/10000201000003F9000002CF8B0CDAEA} etisserant@393: \par\end{center} etisserant@393: nico@208: \end{enumerate} etisserant@393: nico@208: \subsection{CanFestival events scheduling} etisserant@393: etisserant@393: A \canopen node must be able to take delayed actions. nico@208: nico@208: As exemples, periodic sync emission, heartbeat production or SDO timeout nico@208: need to set some alarms that will be called later and do the job. nico@208: etisserant@393: {\textmu}C generaly do not have enough free timers to handle all etisserant@393: the \canopen needs directly. Moreover, CanFestival internal data etisserant@393: may be corrupt by reentrant calls. etisserant@393: etisserant@393: CanFestival implement a micro -scheduler (timer.c). It uses only one nico@208: timer to mimic many timers. It manage an alarm table, and call alarms nico@208: at desired time. nico@208: nico@208: \begin{center} etisserant@393: \includegraphics[width=12cm]{Pictures/100000000000022C000000DEDAD2140C} etisserant@393: \par\end{center} etisserant@393: etisserant@393: Scheduler can handle short clock value ranges limitation found on etisserant@393: some {\textmu}C. As an example, value range for a 16bit clock counter etisserant@393: with 4{\textmu}s tick is crossed within 0.26 seconds... Long alarms etisserant@393: must be segmented. etisserant@393: etisserant@393: Chronogram illustrate a long alarm (A) and a short periodic alarm etisserant@393: (B), with a A value {\textgreater} clock range {\textgreater} etisserant@393: B value. Values t0...t8 are successive setTimer call parameter values. etisserant@393: t1 illustrates an intermediate call to TimeDispatch, caused by a delay etisserant@393: longer than clock range. Because of long alarm segmentation, at the etisserant@393: end of t1, TimeDispatch call will not trig any alarm callback. etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=12cm]{Pictures/1000000000000396000000FFC42573DA} etisserant@393: \par\end{center} etisserant@393: nico@208: nico@208: \section{Linux Target} etisserant@393: nico@208: Linux target is default configure target. nico@208: etisserant@393: nico@208: \subsection{Linux Compilation and installation} etisserant@393: etisserant@393: Call ./configure -- help to see all available compile time options. nico@208: nico@208: After invoking ./configure with your platform specific switches, just nico@208: type make. nico@208: etisserant@393: \texttt{./configure {[}options]} etisserant@393: etisserant@393: \texttt{make} etisserant@393: etisserant@393: \texttt{make install} etisserant@393: nico@208: nico@208: \subsubsection{Standard Linux node} etisserant@393: nico@208: Configure switch: nico@208: etisserant@393: \texttt{- -timers=unix} etisserant@393: etisserant@393: To do a \canopen node running on PC -Linux, you need : etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item A working linux distribution etisserant@393: \item One or more Peak system PC CAN interface and the last Peak Linux driver etisserant@393: installed. nico@208: \end{enumerate} etisserant@393: etisserant@393: \subsubsection{Real -Time Linux node} etisserant@393: nico@208: Configure switch: nico@208: etisserant@393: \texttt{- -timers=xeno} etisserant@393: etisserant@393: To do a \canopen node running on PC -Linux, you need : etisserant@393: nico@208: \begin{enumerate} etisserant@393: \item A working Linux distribution patched with XENOMAI 2.1 or greater. etisserant@393: \item One or more Peak system PC CAN interface and the last Peak Real Time etisserant@393: Linux driver installed. nico@208: \end{enumerate} etisserant@391: etisserant@391: \subsubsection{Linux kernel node} etisserant@393: etisserant@391: To do a CANopen node running on PC-Linux in kernel space, you need: etisserant@391: etisserant@393: etisserant@391: \paragraph{A working Linux distribution with pre-built 2.6.x.x kernel sources} etisserant@393: etisserant@393: etisserant@391: \paragraph{A CAN card driver compatible with CanFestival} etisserant@391: etisserant@393: nico@208: \subsubsection{CAN devices} etisserant@393: nico@208: Curently supported CAN devices and corresponding configure switch: nico@208: etisserant@393: nico@208: \paragraph{Peak systems} etisserant@393: nico@208: Configure switch: nico@208: etisserant@393: \texttt{- -can=peak\_linux} etisserant@393: etisserant@393: PeakSystems CAN interface is automatically chosen as default CAN interface etisserant@393: if libpcan is present in the system. etisserant@393: etisserant@393: Please download driver at \href{http://www.peak-system.com/linux}{http://www.peak etisserant@393: -system.com/linux} and follow instructions in order to install driver etisserant@393: on your system. etisserant@393: etisserant@393: etisserant@393: \paragraph{Socket -Can (http://socketcan.berlios.de)} etisserant@393: nico@208: Configure switch: nico@208: etisserant@393: \texttt{- -can=socket} etisserant@393: nico@208: nico@208: \paragraph{LinCan} etisserant@393: nico@208: Configure switch: nico@208: etisserant@393: \texttt{- -can=lincan} etisserant@393: nico@208: nico@208: \paragraph{Virtual CAN interfaces (for test/debug)} etisserant@393: nico@208: Configure switch: nico@208: etisserant@393: \texttt{- -can=virtual (in user space)} etisserant@393: etisserant@393: \texttt{- -can=virtual\_kernel (in kernel space)} nico@208: nico@208: Virtual CAN interface use Unix pipes to emulate a virtual CAN network. nico@208: Each message issued from a node is repeat to all other nodes. Currently nico@208: only works with nodes running in the same process, and does not support nico@208: work with Xenomai. nico@208: etisserant@393: nico@208: \subsection{Testing your CanFestival installation} etisserant@393: nico@208: Sample provided in /example/TestMasterSlave is installed into your nico@208: system during installation. nico@208: etisserant@393: \texttt{TestMasterSlave} nico@208: etisserant@392: Default CAN driver library is libcanfestival\_can\_virtual.so., which nico@208: will simply pass CAN messages through Unix pipes between Master and etisserant@393: Slave. etisserant@393: etisserant@393: You may also want to specify different can interface and define some etisserant@393: CAN ports. Another example using Peak{\textquotesingle}s dual PCMCIA etisserant@393: (configure and install with --can=peak) : etisserant@393: etisserant@393: \texttt{TestMasterSlave -l libcanfestival\_can\_peak.so -s 40 -m 41} etisserant@393: etisserant@393: \texttt{example/kerneltest} It's based on TestMasterSlave example etisserant@393: and has the same functionality. Uses virtual can driver as default etisserant@393: too. After successfull installation you can insert the module by typing: etisserant@393: modprobe canf\_ktest Module control is done by simple console 'canf\_ktest\_console' etisserant@393: which is used to start/stop sending data. etisserant@393: etisserant@391: nico@208: \section{Windows Targets} etisserant@393: nico@208: CanFestival can be compiled and run on Windows platform. It is possible nico@208: to use both Cygwin and win32 native runtime environment. nico@208: etisserant@393: nico@208: \subsection{Object Dictionary Editor GUI installation.} etisserant@393: etisserant@393: Please refer to \hyperlink{a821UsingDictionaryEditorGUIoutline}{8.2.1)Using etisserant@393: Dictionary Editor GUI} etisserant@393: nico@208: nico@208: \subsection{CYGWIN} etisserant@393: etisserant@393: nico@208: \subsubsection{Requirements} etisserant@393: nico@208: Cygwin have to be installed with those packages : nico@208: nico@208: \begin{enumerate} etisserant@393: \item gcc etisserant@393: \item unzip etisserant@393: \item wget etisserant@393: \item make nico@208: \end{enumerate} nico@208: Currently, the only supported CAN devices are PeakSystems ones, with etisserant@393: PcanLight driver and library. etisserant@393: etisserant@393: Please download driver at \href{http://www.peak-system.com/themen/download_gb.html}{http://www.peak etisserant@393: -system.com/themen/download\_gb.html} \ and follow instructions etisserant@393: in order to install driver on your system. nico@208: nico@208: Install Cygwin as required, and the driver for your Peak CAN device. nico@208: nico@208: Open a Cygwin terminal, and follow those instructions: nico@208: etisserant@393: nico@208: \subsubsection{Cygwin configuration and compilation} etisserant@393: etisserant@393: etisserant@393: \paragraph{A single node with PcanLight and Peak CAN -USB adapter} etisserant@393: etisserant@393: Download the PCAN -Light Zip file for your HW ( URL from download etisserant@393: page ): etisserant@393: etisserant@393: \texttt{wget http://www.peak -system.com/files/usb.zip} etisserant@393: etisserant@393: Extract its content into your cygwin home (it will create a {}``Disk'' nico@208: directory): nico@208: etisserant@393: \texttt{unzip usb.zip} etisserant@393: etisserant@393: Configure CanFestival3 providing path to the desired PcanLight implementation: etisserant@393: etisserant@393: \texttt{cd CanFestival -3} etisserant@393: etisserant@393: \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN -Light/Api/} etisserant@393: etisserant@393: \texttt{export PCAN\_HEADER=Pcan\_usb.h} etisserant@393: etisserant@393: \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN -Light/Lib/Visual\textbackslash{} nico@208: C++/Pcan\_usb.lib} nico@208: etisserant@393: \texttt{./configure -{}-can=peak\_win32} etisserant@393: etisserant@393: \texttt{make} etisserant@393: etisserant@393: In order to test, you have to use another CanFestival node, connect etisserant@393: with a CAN cable. etisserant@393: etisserant@393: \texttt{cp \~{ }/Disk/PCAN -Light/Pcan\_usb.dll .} etisserant@393: etisserant@393: \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}} etisserant@393: etisserant@393: \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll \textbackslash{}} etisserant@393: etisserant@393: \texttt{-S 500K -M none} nico@208: nico@208: Then, on the other node : nico@208: etisserant@393: \texttt{./TestMasterSlave -l my\_driver.so -S none -M 500K} nico@208: nico@208: Now messages are beeing exchanged between master and slave node. nico@208: etisserant@393: etisserant@393: \paragraph{Two nodes with PcanLight and Peak dual PCMCIA -CAN adapter} etisserant@393: etisserant@393: Download the PCAN -Light Zip file for your HW ( URL from download etisserant@393: page ): etisserant@393: etisserant@393: \texttt{wget http://www.peak -system.com/files/pccard.zip} etisserant@393: etisserant@393: Extract its content into your cygwin home (it will create a {}``Disk'' nico@208: directory): nico@208: etisserant@393: \texttt{unzip pccard.zip} nico@208: nico@208: The configure CanFestival3 providing path to the desired PcanLight nico@208: implementation: nico@208: etisserant@393: \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN -Light/Api/} etisserant@393: etisserant@393: \texttt{export PCAN\_HEADER=Pcan\_pcc.h} etisserant@393: etisserant@393: \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN -Light/Lib/Visual\textbackslash{} etisserant@393: C++/Pcan\_pcc.lib} etisserant@393: etisserant@393: \texttt{export PCAN2\_HEADER=Pcan\_2pcc.h} etisserant@393: etisserant@393: \texttt{export PCAN2\_LIB=\~{ }/Disk/PCAN -Light/Lib/Visual\textbackslash{} nico@208: C++/Pcan\_2pcc.lib} nico@208: nico@208: In order to test, just connect together both CAN ports of the PCMCIA nico@208: card. Don{\textquotesingle}t forget 120ohms terminator. nico@208: etisserant@393: \texttt{cp \~{ }/Disk/PCAN -Light/Pcan\_pcc.dll .} etisserant@393: etisserant@393: \texttt{cp \~{ }/Disk/PCAN -Light/Pcan\_2pcc.dll .} etisserant@393: etisserant@393: \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}} etisserant@393: etisserant@393: \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll} nico@208: nico@208: Messages are then exchanged between master and slave node, both inside nico@208: TestMasterSlave{\textquotesingle}s process. nico@208: etisserant@393: nico@208: \subsection{Visual Studio C++} etisserant@393: etisserant@393: nico@208: \subsubsection{Requirements} etisserant@393: nico@208: Minimal Cygwin installation is required at configuration time in order nico@208: to create specific header files (config.h and cancfg.h). Once this nico@208: files created, cygwin is not necessary any more. nico@208: nico@208: Project and solution files have been created and tested with Visual etisserant@393: Studio Express 2005. Be sure to have installed Microsoft Platform etisserant@393: SDK, as recommended at the end of Visual Studio installation. etisserant@393: nico@208: nico@208: \subsubsection{Configuration with cygwin} etisserant@393: etisserant@393: Follow instructions given at \hyperlink{Cygwin configuration and compilation}{Cygwin nico@208: configuration and compilation}, but do neither call make nor do tests, nico@208: just do configuration steps. This will create headers files accordingly nico@208: to your configuration parameters, and the desired CAN hardware. nico@208: etisserant@393: nico@208: \subsubsection{Compilation with Visual Studio} etisserant@393: etisserant@393: You can either load independents {}``{*}.vcproj'' project files etisserant@393: along your own projects in your own solution or load the provided etisserant@393: {}``CanFestival -3.vc8.sln'' solution files directly. etisserant@393: etisserant@393: Build CanFestival -3 project first. etisserant@393: nico@208: nico@208: \paragraph{PcanLight and the can\_peak\_win32 project.} etisserant@393: nico@208: Chosen Pcan\_xxx.lib and eventually Pcan\_2xxx.lib files must be added etisserant@393: to can\_peak\_win32 \ \ project before build of the DLL. etisserant@393: nico@208: nico@208: \subsubsection{Testing} etisserant@393: etisserant@393: Copy eventually needed dlls (ie : Pcan\_Nxxx.lib) into Release or etisserant@393: Debug directory, and run the test program: etisserant@393: etisserant@393: \texttt{TestMasterSlave.exe -l can\_peak\_win32.dll} etisserant@393: nico@208: greg@282: \subsection{MSYS} greg@282: greg@282: greg@282: \subsubsection{Requirements} greg@282: greg@282: Download from : http://sourceforge.net/project/showfiles.php?group\_id=2435 greg@282: greg@282: \begin{enumerate} etisserant@393: \item MSYS-1.0.10.exe etisserant@393: \item MinGW-5.1.3.exe etisserant@393: \item mingwPORT (which contains wget-1.9.1) greg@282: \end{enumerate} greg@282: Please download driver at http://www.peak-system.com/themen/download\_gb.html greg@282: and follow instructions in order to install driver on your system. greg@282: Install MSYS and MingW as required, and the driver for your Peak CAN greg@282: device. Open a MSYS terminal, and follow those instructions:\\ greg@282: greg@282: greg@282: \begin{itemize} etisserant@393: \item extract wget-1.9.1-mingwPORT.tar.bz2 etisserant@393: \item copy wget.exe in c:\textbackslash{} msys\textbackslash{} 1.0\textbackslash{} etisserant@393: bin\textbackslash{} greg@282: \item start MSYS and check the file /etc/fstab contain the line c:/MinGW etisserant@393: /mingw greg@282: \end{itemize} greg@282: greg@282: \subsubsection{MSYS configuration and compilation} greg@282: etisserant@393: Instructions for compilation are nearly the same as CYGWIN part. greg@282: greg@282: greg@282: \paragraph{A single node with PcanLight and Peak CAN-USB adapter} greg@282: greg@282: Download the PCAN-Light Zip file for your HW ( URL from download page greg@282: ): greg@282: etisserant@393: \begin{quotation} etisserant@393: \texttt{wget http://www.peak-system.com/files/usb.zip} etisserant@393: \end{quotation} etisserant@393: Extract its content into your MSYS's home (it will create a \char`\"{} etisserant@393: Disk\char`\"{} directory): etisserant@393: etisserant@393: \begin{quotation} etisserant@393: \texttt{unzip usb.zip} etisserant@393: \end{quotation} greg@282: Configure CanFestival3 providing path to the desired PcanLight implementation: greg@282: etisserant@393: \begin{quotation} greg@282: \texttt{cd CanFestival-3} greg@282: greg@282: \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN-Light/Api/} greg@282: greg@282: \texttt{export PCAN\_HEADER=Pcan\_usb.h} greg@282: greg@282: \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN-Light/Lib/Visual\textbackslash{} greg@282: C++/Pcan\_usb.lib} greg@282: etisserant@393: \texttt{./configure - -can=peak\_win32} etisserant@393: etisserant@393: \texttt{make} etisserant@393: \end{quotation} greg@282: In order to test, you have to use another CanFestival node, connect greg@282: with a CAN cable. greg@282: etisserant@393: \begin{quotation} greg@282: \texttt{cp \~{ }/Disk/PCAN-Light/Pcan\_usb.dll .} greg@282: greg@282: \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}} greg@282: greg@282: \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll \textbackslash{}} greg@282: etisserant@393: \texttt{-S 500K -M none} etisserant@393: \end{quotation} greg@282: Then, on the other node : greg@282: etisserant@393: \begin{quotation} etisserant@393: \texttt{./TestMasterSlave -l my\_driver.so -S none -M 500K -m 0} etisserant@393: \end{quotation} greg@282: Now messages are beeing exchanged between master and slave node. greg@282: greg@282: greg@282: \paragraph{Two nodes with PcanLight and Peak dual PCMCIA-CAN adapter} greg@282: greg@282: Download the PCAN-Light Zip file for your HW ( URL from download page greg@282: ): greg@282: etisserant@393: \begin{quotation} etisserant@393: \texttt{wget http://www.peak-system.com/files/pccard.zip} etisserant@393: \end{quotation} etisserant@393: Extract its content into your MSYS's home (it will create a \char`\"{} etisserant@393: Disk\char`\"{} directory): etisserant@393: etisserant@393: \begin{quotation} etisserant@393: \texttt{unzip pccard.zip} etisserant@393: \end{quotation} greg@282: The configure CanFestival3 providing path to the desired PcanLight etisserant@393: implementation: etisserant@393: etisserant@393: \begin{quotation} greg@282: \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN-Light/Api/} greg@282: greg@282: \texttt{export PCAN\_HEADER=Pcan\_pcc.h} greg@282: greg@282: \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN-Light/Lib/Visual\textbackslash{} greg@282: C++/Pcan\_pcc.lib} greg@282: greg@282: \texttt{export PCAN2\_HEADER=Pcan\_2pcc.h} greg@282: greg@282: \texttt{export PCAN2\_LIB=\~{ }/Disk/PCAN-Light/Lib/Visual\textbackslash{} etisserant@393: C++/Pcan\_2pcc.lib} etisserant@393: \end{quotation} greg@282: In order to test, just connect together both CAN ports of the PCMCIA greg@282: card. Don't forget 120ohms terminator. greg@282: etisserant@393: \begin{quotation} greg@282: \texttt{cp\~{ }/Disk/PCAN-Light/Pcan\_pcc.dll ~.} greg@282: greg@282: \texttt{cp \~{ }/Disk/PCAN-Light/Pcan\_2pcc.dll ~.} greg@282: greg@282: \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}} greg@282: greg@282: \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll -m 0 -s etisserant@393: 1} etisserant@393: \end{quotation} greg@282: Messages are then exchanged between master and slave node, both inside greg@282: TestMasterSlave's process. greg@282: etisserant@393: nico@208: \section{Motorola HCS12} etisserant@393: etisserant@393: The examples have been tested on a MC9S12DG255 mounted on a Elektronikladen etisserant@393: HCS12 T -board. etisserant@393: etisserant@393: Beware that there are few differences in the MSCAN module of the 68HC12 etisserant@393: and HCS12 microcontroller. For a HC12, you must adapt the driver that etisserant@393: we provide for \ the HCS12. etisserant@393: etisserant@393: For the difference MSCAN HC12/HCS12, see the Motorola application etisserant@393: note AN2011/D. nico@208: nico@208: Configure switch: nico@208: etisserant@393: \texttt{-{}-target=hcs12} etisserant@393: etisserant@393: To do a \canopen node running on a microncontroller Motorola MC9S12DP256, nico@208: you need : nico@208: nico@208: \begin{enumerate} etisserant@393: \item The compiler GNU gcc for HC11, HC12, HCS12 : m6811 -elf. \\ etisserant@393: Download the \textbf{release 3.1} at : \href{http://m68hc11.serveftp.org/m68hc11_pkg_rpm.php}{http://m68hc11.serveftp.org/m68hc11\_pkg\_rpm.php} etisserant@393: \item A board with this chip. We are using the T -board from Electronikladden. etisserant@393: \item At least about 40 kBytes of program memory. etisserant@393: \item A tool to flash the memory. (We are using the hight cost Lauterbach etisserant@393: debugger). nico@208: \end{enumerate} etisserant@393: nico@208: \subsection{Running a HCS12 node} etisserant@393: etisserant@393: nico@208: \subsubsection{Compiling Canfestival:} etisserant@393: etisserant@393: \texttt{./configure -{}-target=hcs12} etisserant@393: nico@208: nico@208: \subsubsection{Compiling and building an example} etisserant@393: etisserant@393: Enter in the folder of an HCS12 example, etisserant@393: etisserant@393: \texttt{make all} etisserant@393: nico@208: nico@208: \subsubsection{Flashing the memory :} etisserant@393: etisserant@393: Use your prefered loader ! If you are using a debugger Lauterbach, etisserant@393: you can load the bash file : trace32\_flash\_programmer.cmm. It loads nico@208: directly the elf file. nico@208: etisserant@393: nico@208: \subsubsection{Connecting to a serial RS232 console :} etisserant@393: nico@208: Connect the portS(TxD0) of the HCS12 to a console configured at 19200 nico@208: bauds 8N1, via a Max232 chip to adapt the electricals levels. On Linux, nico@208: you can use minicom. Connecting to a console is usefull to read the nico@208: messages, but not required. nico@208: etisserant@393: nico@208: \subsubsection{Connecting to the CAN network :} etisserant@393: etisserant@393: Connect the port CAN0 (pin PM0, PM1) to the network via a CAN controller. etisserant@393: On our board, the CAN controler is a PCA82C250 chip. etisserant@393: nico@208: nico@208: \subsubsection{starting the node :} etisserant@393: nico@208: Press the reset of your HCS12 board. nico@208: etisserant@393: nico@208: \section{Example and test program:} etisserant@393: etisserant@393: The {}``examples'' directory contains some test program you can etisserant@393: use as example for your own developments. etisserant@393: nico@208: nico@208: \subsection{TestMasterSlave} etisserant@393: etisserant@393: \texttt{{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}\ } etisserant@393: etisserant@393: \texttt{{*} \ TestMasterSlave \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ A simple example for PC. It does implement 2 \canopen etisserant@393: \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ nodes in the same process. A master and a slave. Both etisserant@393: \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ communicate together, exchanging periodically NMT, etisserant@393: SYNC, \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ SDO and PDO. Master configure heartbeat producer time etisserant@393: \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ at 1000 ms for slave node -id 0x02 by concise DCF. \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ Usage: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ ./TestMasterSlave \ {[}OPTIONS] \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ OPTIONS: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ -l : Can library {[}{\textquotedbl}libcanfestival\_can\_virtual.so{\textquotedbl}] etisserant@393: \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ Slave: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ -s : bus name {[}{\textquotedbl}0{\textquotedbl}] etisserant@393: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ -S : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) etisserant@393: \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ Master: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ -m : bus name {[}{\textquotedbl}1{\textquotedbl}] etisserant@393: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ -M : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) etisserant@393: \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}} etisserant@393: etisserant@393: \bigskip{} etisserant@393: etisserant@393: etisserant@393: \textsf{Notes for Concise DCF :} etisserant@393: etisserant@393: \bigskip{} etisserant@393: etisserant@393: etisserant@393: \textsf{In this example, Master configure \ heartbeat producer time etisserant@393: at 1000 ms for slave node -id 0x02 by concise DCF according DS -302 etisserant@393: profile.} etisserant@393: etisserant@393: \textsf{Index 0x1F22 , sub -index 0x00 of the master OD, correspond etisserant@393: to the number of entries. This equal to the maximum possible nodeId etisserant@393: (127). Each sub -index points to the Node -ID of the device, to which etisserant@393: the configuration belongs.} etisserant@393: etisserant@393: \bigskip{} etisserant@393: etisserant@393: etisserant@393: \textsf{To add more parameters configurations to the slave, the value etisserant@393: at sub -index 0x02 must be a binary stream (little -endian) following etisserant@393: this structure :}\\ etisserant@393: \textsf{ \{ (UNS32) nb of entries}\\ etisserant@393: \textsf{ (UNS16) index parameter 1}\\ etisserant@393: \textsf{ (UNS8) sub -index parameter 1}\\ etisserant@393: \textsf{ (UNS32) size data parameter 1}\\ etisserant@393: \textsf{ (DOMAIN) data parameter 1}\\ etisserant@393: \textsf{ (UNS16) index parameter 2}\\ etisserant@393: \textsf{ (UNS8) sub -index parameter 2}\\ etisserant@393: \textsf{ (UNS32) size data parameter 2}\\ etisserant@393: \textsf{ (DOMAIN) data parameter 2}\\ etisserant@393: \textsf{ \ \ \ \ \ ....}\\ etisserant@393: \textsf{ (UNS16) index parameter n}\\ etisserant@393: \textsf{ (UNS8) sub -index parameter n}\\ etisserant@393: \textsf{ (UNS32) size data parameter n}\\ etisserant@393: \textsf{ (DOMAIN) data parameter n}\\ etisserant@393: \textsf{ \}} etisserant@393: etisserant@393: \textsf{So the binary value stream to configure heartbeat producer etisserant@393: time must be :}\\ etisserant@393: \textsf{ 0100000017100002000000e803} etisserant@393: etisserant@393: \textsf{The slave node is configured just before the Master entering etisserant@393: in Pre\_operational state.} etisserant@393: nico@208: nico@208: \subsection{gene\_SYNC\_HCS12 :} etisserant@393: etisserant@393: This is a simple \canopen node that only send cyclic SYNC message. etisserant@393: It demonstrate implementation on HCS12 based board. etisserant@393: etisserant@393: \bigskip{} etisserant@393: etisserant@393: etisserant@393: etisserant@391: \subsection{kerneltest :} etisserant@391: etisserant@393: Example based on TestMasterSlave slightly modified to suit kernel etisserant@393: space requisites. It will do the same as TestMasterSlave but in kernel etisserant@393: space sending kernel messages (displayed by dmesg for example). It etisserant@393: is designed as external kernel module implemented as character device. etisserant@393: There is a shell script called 'insert.sh', which will insert the etisserant@393: module and create a new device file /dev/canf\_ktest (used to sending etisserant@393: commands to module). To actual sending commands you can use simple etisserant@393: console named 'canf\_ktest\_console'. The module is dependent on a etisserant@393: another separate module 'canfestival.ko' implementing CanOpen stack etisserant@393: which exports requisite functions. Canfestival.ko module is then dependent etisserant@393: on CAN card driver module, by default CAN virtual driver will be loaded. etisserant@393: After installing modules (make install), all dependencies are solved etisserant@393: automatically by kernel. To run the example type: \texttt{sh run.sh} etisserant@393: It will insert required modules, start console, and after quitting etisserant@393: console it'll remove modules from kernel. etisserant@393: etisserant@393: \bigskip{} etisserant@393: etisserant@393: nico@208: nico@208: \subsection{TestMasterMicroMod } etisserant@393: etisserant@393: \texttt{{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}} etisserant@393: etisserant@393: \texttt{{*} \ TestMasterMicroMod \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ A simple example for PC. \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ A \canopen master that control a MicroMod module: \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ - setup module TPDO 1 transmit type \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ - setup module RPDO 1 transmit type \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ - setup module hearbeatbeat period \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ - disable others TPDOs \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ - set state to operational \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ - send periodic SYNC \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ - send periodic RPDO 1 to Micromod (digital output) etisserant@393: \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ - listen Micromod{\textquotesingle}s TPDO 1 (digital etisserant@393: input) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ - Mapping RPDO 1 bit per bit (digital input) \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ Usage: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ ./TestMasterMicroMod \ {[}OPTIONS] \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ OPTIONS: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ -l : Can library {[}{\textquotedbl}libcanfestival\_can\_virtual.so{\textquotedbl}] etisserant@393: \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ Slave: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ -i : Slave Node id format {[}0x01 , 0x7F] etisserant@393: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ Master: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ -m : bus name {[}{\textquotedbl}1{\textquotedbl}] etisserant@393: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ -M : 1M,500K,250K,125K,100K,50K,20K,10K \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} etisserant@393: etisserant@393: \texttt{{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}} etisserant@393: nico@208: nico@208: \section{Developing a new node} etisserant@393: etisserant@393: Using provided examples as a base for your new node is generally a etisserant@393: good idea. You can also use the provided {*}.od files as a base for etisserant@393: your node object dictionary. etisserant@393: etisserant@393: Creating a new \canopen node implies to define the Object Dictionary etisserant@393: of this node. For that, developer has to provide a C file. This C etisserant@393: file contains the definition of all dictionary entries, and some kind etisserant@393: of index table that helps the stack to access some entries directly. etisserant@393: nico@208: nico@208: \subsection{Using Dictionary Editor GUI} etisserant@393: etisserant@393: The Object Dictionary Editor is a WxPython based GUI that is used etisserant@393: to create the C file needed to create a new \canopen node. etisserant@393: nico@208: nico@208: \subsubsection{Installation and usage on Linux} etisserant@393: nico@208: You first have to download and install Gnosis XML modules. This is nico@208: automated by a Makefile rule. nico@208: etisserant@393: \texttt{cd objdictgen} etisserant@393: etisserant@393: \texttt{make} nico@208: nico@208: Now start the editor. nico@208: etisserant@393: \texttt{python objdictedit.py {[}od files...]} etisserant@393: nico@208: nico@208: \subsubsection{Installation and usage on Windows} etisserant@393: nico@208: Install Python (at least version 2.4) and wxPython (at least version nico@208: 2.6.3.2). nico@208: nico@208: Cygwin users can install Gnosis XML utils the same as Linux use. Just nico@208: call make. nico@208: etisserant@393: \texttt{cd objdictgen} etisserant@393: etisserant@393: \texttt{make} nico@208: nico@208: Others will have to download and intall Gnosis XML by hand : nico@208: etisserant@393: \texttt{Gnosis Utils:} etisserant@393: etisserant@393: \texttt{http://freshmeat.net/projects/gnosisxml/} etisserant@393: etisserant@393: \texttt{http://www.gnosis.cx/download/Gnosis\_Utils.More/Gnosis\_Utils etisserant@393: -1.2.1.win32 -py24.exe} etisserant@393: etisserant@393: \texttt{Get latest version.} etisserant@393: etisserant@393: Download CanFestival archive and uncompress it. Use windows file explorer etisserant@393: to go into CanFestival3\textbackslash{}objdicgten, and double -click etisserant@393: on objdictedit.py. etisserant@393: nico@208: nico@208: \subsubsection{About} etisserant@393: etisserant@393: The Object Dictionary editor GUI is a python application that use etisserant@393: the Model-View-Controller design pattern. It depends on WxPython to nico@208: display view on any supported platform. nico@208: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=7cm]{Pictures/10000201000001FC000001E5D65E8766} etisserant@393: \par\end{center} etisserant@393: nico@208: nico@208: \subsubsection{Main view} etisserant@393: nico@208: Top list let you choose dictionary section, bottom left list is the nico@208: selected index in that dictionary, and bottom right list are edited etisserant@393: sub -indexes. etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=12cm]{Pictures/10000201000003E7000001C7B0296577} etisserant@393: \par\end{center} etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=3cm]{Pictures/10000000000000B6000000DF1EDD1E73} etisserant@393: \par\end{center} etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=3cm]{Pictures/10000000000000AC000000C9C3F53FA6} etisserant@393: \par\end{center} etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=3cm]{Pictures/100000000000006D000000A31EC8CB54} etisserant@393: \par\end{center} etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=3cm]{Pictures/10000000000000AA0000006014F74635} etisserant@393: \par\end{center} etisserant@393: nico@208: nico@208: \subsubsection{New node} etisserant@393: etisserant@393: Edit your node name, ID and type. Choose your inherited specific profile. etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=11cm]{Pictures/10000201000001CB0000015F4FC09B68} etisserant@393: \par\end{center} etisserant@393: nico@208: nico@208: \subsubsection{Node info} etisserant@393: nico@208: Edit your node name, ID and type. nico@208: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=7cm]{Pictures/10000201000001010000011DA724D25C} etisserant@393: \par\end{center} etisserant@393: nico@208: nico@208: \subsubsection{Profile editor} etisserant@393: etisserant@393: Chose the used profile to edit. etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=4cm]{Pictures/10000000000000AB000000C88F594413} etisserant@393: \par\end{center} etisserant@393: etisserant@393: Pick up optional chosen profile entries. etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=11cm]{Pictures/10000201000002DE000001D82D89C224} etisserant@393: \par\end{center} etisserant@393: nico@208: nico@208: \subsubsection{User types} etisserant@393: etisserant@393: Use User Types to implement value boundaries, and string lentgth etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=11cm]{Pictures/10000201000001C40000010766961D7F} etisserant@393: \par\end{center} etisserant@393: nico@208: nico@208: \subsubsection{Mapped variable} etisserant@393: etisserant@393: Add your own specific dictionary entries and associated mapped variables. etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=11cm]{Pictures/10000201000001C4000000DD129D4661} etisserant@393: \par\end{center} etisserant@393: nico@208: nico@208: \subsubsection{Integrated help} etisserant@393: etisserant@393: Using F1 key, you can get context sensitive help. etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=12cm]{Pictures/10000201000002F30000020B23ED7F67} etisserant@393: \par\end{center} nico@208: nico@208: In order to do that, official 301\_v04000201.pdf file must be placed nico@208: into doc/ directory, and xpdf must be present on your system. nico@208: etisserant@393: F2 key open HTML CanFestival help. etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=12cm]{Pictures/10000201000003440000025ACC3FD2F1} etisserant@393: \par\end{center} etisserant@393: nico@208: nico@208: \subsection{Generating the object Dictionary} etisserant@393: nico@208: Once object dictionary has been edited and saved, you have to generate nico@208: object dictionary C code for your CanFestival node. nico@208: etisserant@393: nico@208: \subsubsection{With GUI} etisserant@393: etisserant@393: Menu entry {}``File/Build Dictionary''. etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=4cm]{Pictures/10000201000000B7000000C66AF89CD5} etisserant@393: \par\end{center} nico@208: nico@208: Choose C file to create or overwrite. Header file will be also created nico@208: with the same prefix as C file. nico@208: etisserant@393: nico@208: \subsubsection{With command line} etisserant@393: etisserant@393: \texttt{Usage of objdictgen.py :} etisserant@393: etisserant@393: \texttt{python objdictgen.py XMLFilePath CfilePath} etisserant@393: nico@208: nico@208: \section{FAQ} etisserant@393: etisserant@393: nico@208: \subsection{General} etisserant@393: etisserant@393: nico@208: \subsubsection{Does the code compiles on Windows ?} etisserant@393: etisserant@393: Yes, with both Cygwin and Visual Studio C++. etisserant@393: etisserant@393: Because \canopen layer is coded with C, put a compilation option etisserant@393: /TC or /TP if you plan to mix C++ files. See the MSDN documentation etisserant@393: about that. etisserant@393: etisserant@393: etisserant@393: \subsubsection{How to fit the library to an other microcontrôler ?} etisserant@393: etisserant@393: First, be sure that you have at least 40K bytes of program memory, etisserant@393: and about 2k of RAM. etisserant@393: etisserant@393: You have to create target specific interface to HW resources. Take etisserant@393: model on bundled interfaces provided in drivers/ and create your own etisserant@393: interface. You also have to update Makefile.in files for target specific etisserant@393: cflags and options. Choose {--}target= configure switch to compile etisserant@393: your specific interface. etisserant@393: etisserant@393: You are welcome to contribute -back your own interfaces! Other Canfestival etisserant@393: users will use it and provide feedback, tests and enhancements. etisserant@393: nico@208: nico@208: \subsubsection{Is CanFestival3 conform to DS301 v.4.02 ?} etisserant@393: nico@208: Thanks to Philippe Foureys (IUT of Valence), a slave node have been etisserant@393: tested with the National Instrument \canopen Conformance Test. It etisserant@393: passed the test with success. nico@208: nico@208: Some very small unconformity have been found in very unusual situations, nico@208: for example in the SDO code response to wrong messages. nico@208: etisserant@393: nico@208: \subsection{LINUX} etisserant@393: etisserant@393: nico@208: \subsubsection{How to use a Peaksystem CAN board ?} etisserant@393: etisserant@393: Just install peak driver and then compile and install Canfestival. etisserant@393: Peak driver is detected at compile time. etisserant@393: nico@208: nico@208: \subsubsection{How to use an unsupported CAN board ?} etisserant@393: nico@208: You have to install the specific driver on your system, with necessary etisserant@393: libs and headers. etisserant@393: etisserant@393: Use can\_peak.c/h or can\_virtual.c/h as an example, and adapt it etisserant@393: to your driver API. etisserant@393: etisserant@393: Execute configure script and choose --can=mydriver etisserant@393: nico@208: nico@208: \subsection{Win32} etisserant@393: nico@208: Compatibility: nico@208: nico@208: \begin{enumerate} etisserant@393: \item Code was compiled MS VisualStudio 2003.NET and VisualStudio 2005.NET etisserant@393: for WindowsXP \ with ANSI and UNICODE configurations and for WindowsCE etisserant@393: 5.0. etisserant@393: \item Some preliminary testing was done, but not enough to be used in mission etisserant@393: critical projects. nico@208: \end{enumerate} nico@208: Additional Features: nico@208: nico@208: \begin{enumerate} etisserant@393: \item Non -integral integers support implementation UNS24, UNS40, UNS48 etisserant@393: etc. etisserant@393: \item When enable debug output with DEBUG\_WAR\_CONSOLE\_ON or DEBUG\_ERR\_CONSOLE\_ON, etisserant@393: you can navigate in CanFestival source code by double clicking at etisserant@393: diagnostic lines in VisualStudio.NET 200X Debug Output Window. nico@208: \end{enumerate} etisserant@393: Custom size integral types such as INTEGER24, UNS40, INTEGER56 etc. etisserant@393: have been defined as 64 bits integers. You will need to replace sizeof(TYPE) nico@208: operators to sizeof\_TYPE definitions in generated code, i.e. replace nico@208: sizeof(UNS40) with sizeof\_UNS40. nico@208: nico@208: nico@208: \subsection{HCS12} etisserant@393: etisserant@393: nico@208: \subsubsection{Which board are you using ?} etisserant@393: etisserant@393: A T -board from elektronikladen with a MC9S12DP256 or MC9S12DG256. etisserant@393: etisserant@393: etisserant@393: \subsubsection{Does the code compile with an other compiler than GNU gcc ?} etisserant@393: etisserant@393: It is known to work with Metrowerks CodeWarrior. Here are some tips etisserant@393: from Philippe Foureys. : etisserant@393: nico@208: nico@208: \paragraph{Interrupt functions} etisserant@393: etisserant@393: nico@208: \subparagraph{Code for GCC:} etisserant@393: etisserant@393: \texttt{// prototype}~\\ etisserant@393: \texttt{ void \_\_attribute\_\_((interrupt))timer3Hdl(void):}~\\ etisserant@393: \texttt{ // function}~\\ etisserant@393: \texttt{ void \_\_attribute\_\_((interrupt))timer3Hdl(void)\{...\}} etisserant@393: nico@208: nico@208: \subparagraph{Code for CodeWarrior} etisserant@393: etisserant@393: \texttt{// protoype}~\\ etisserant@393: \texttt{ void interrupt timer3Hdl(void);}~\\ etisserant@393: \texttt{ // function}~\\ etisserant@393: \texttt{ pragma CODE\_SEG\_\_NEAR\_SEG\_NON\_BANKED}~\\ etisserant@393: \texttt{ void interrupt timer3Hdl(void)}~\\ etisserant@393: \texttt{ \{...\}}~\\ etisserant@393: \texttt{ pragma CODE\_SEG\_DEFAULT} etisserant@393: nico@208: nico@208: \paragraph{Interrupt lock, unlock} etisserant@393: etisserant@393: nico@208: \subparagraph{Code for GCC} etisserant@393: etisserant@393: \texttt{void unlock (void)}~\\ etisserant@393: \texttt{ \ }~\\ etisserant@393: \texttt{ \ \_\_asm\_\_ \_\_volatile\_\_({\textquotedbl}cli{\textquotedbl});}~\\ etisserant@393: \texttt{ \}}~\\ etisserant@393: \texttt{ void lock (void)}~\\ etisserant@393: \texttt{ \ }~\\ etisserant@393: \texttt{ \ unsigned short mask;}~\\ etisserant@393: \texttt{ \ \_\_asm\_\_ \_\_volatile\_\_({\textquotedbl}tpa{\textbackslash{} etisserant@393: }n{\textbackslash{} }tsei{\textquotedbl}:{\textquotedbl}=d{\textquotedbl}(mask));}~\\ etisserant@393: \texttt{ \}} etisserant@393: nico@208: nico@208: \subparagraph{Code for CodeWarrior} etisserant@393: etisserant@393: \texttt{void unlock (void)}~\\ etisserant@393: \texttt{ \ }~\\ etisserant@393: \texttt{ \ \_\_asm({\textquotedbl}cli{\textquotedbl});}~\\ etisserant@393: \texttt{ \}}~\\ etisserant@393: \texttt{ void lock (void)}~\\ etisserant@393: \texttt{ \ }~\\ etisserant@393: \texttt{ \ unsigned short mask;}~\\ etisserant@393: \texttt{ \ \_\_asm}~\\ etisserant@393: \texttt{ \ }~\\ etisserant@393: \texttt{ \ tpa:tsei:{\textquotedbl}=d{\textquotedbl}(mask);}~\\ etisserant@393: \texttt{ \}}~\\ etisserant@393: \texttt{ \}} etisserant@393: nico@208: nico@208: \paragraph{Initialize function} etisserant@393: etisserant@393: nico@208: \subparagraph{Code for GCC} etisserant@393: etisserant@393: \texttt{void initCanHCS12 (void)}~\\ etisserant@393: \texttt{ \{ \ }~\\ etisserant@393: \texttt{ \ //Init the HCS12 microcontroler for \canopen} ~\\ etisserant@393: \texttt{ \ initHCS12();}~\\ etisserant@393: \texttt{ \ \ // Init the HCS12 \ CAN driver}~\\ etisserant@393: \texttt{ \ const canBusInit bi0 = \ }~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no low power \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/} etisserant@393: ~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no time stamp \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 1, \ \ \ /{*} enable MSCAN \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} clock source : oscillator (In etisserant@393: fact, it is not used) \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no loop back \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no listen only \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no low pass filter for wk up {*}/}~\\ etisserant@393: \texttt{ \ CAN\_Baudrates{[}CAN\_BAUDRATE\_250K],}~\\ etisserant@393: \texttt{ \ \ \ \ }~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, \ \ \ /{*} Filter on 16 bits.}~\\ etisserant@393: \texttt{ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ See Motorola etisserant@393: Block Guide V02.14 fig 4 -3 {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 0 hight accept all etisserant@393: msg \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 0 low accept all etisserant@393: msg \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 1 hight filter all etisserant@393: of \ msg \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 1 low filter all etisserant@393: of \ msg \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 2 hight filter most etisserant@393: of \ msg {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 2 low filter most etisserant@393: of \ msg \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 3 hight filter most etisserant@393: of \ msg {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 3 low filter most etisserant@393: of \ msg \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \}}~\\ etisserant@393: \texttt{ \ \};} etisserant@393: nico@208: nico@208: \subparagraph{Code for CodeWarrior} etisserant@393: etisserant@393: \texttt{void initCanHCS12 (void)}~\\ etisserant@393: \texttt{ \{ \ }~\\ etisserant@393: \texttt{ \ //Init the HCS12 microcontroler for \canopen} ~\\ etisserant@393: \texttt{ \ initHCS12();}~\\ etisserant@393: \texttt{ \ \ // Init the HCS12 \ CAN driver}~\\ etisserant@393: \texttt{ \ const canBusInit bi0 = \ }~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no low power \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/} etisserant@393: ~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no time stamp \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 1, \ \ \ /{*} enable MSCAN \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} clock source : oscillator (In etisserant@393: fact, it is not used) \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no loop back \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no listen only \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ 0, \ \ \ /{*} no low pass filter for wk up {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ }~\\ etisserant@393: \texttt{ \ \ \ \ 1, /{*} clksrc {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ 3, /{*} brp \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ 0, /{*} sjw \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ 0, /{*} samp \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ 1, /{*} tseg2 \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ 12,/{*} tseg1 \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \},}~\\ etisserant@393: \texttt{ \ \ \ \ }~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, \ \ \ /{*} Filter on 16 bits.}~\\ etisserant@393: \texttt{ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ See Motorola etisserant@393: Block Guide V02.14 fig 4 -3 {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 0 hight accept all etisserant@393: msg \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 0 low accept all etisserant@393: msg \ \ \ \ \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 1 hight filter all etisserant@393: of \ msg \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 1 low filter all etisserant@393: of \ msg \ \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 2 hight filter most etisserant@393: of \ msg {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 2 low filter most etisserant@393: of \ msg \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 3 hight filter most etisserant@393: of \ msg {*}/}~\\ etisserant@393: \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 3 low filter most etisserant@393: of \ msg \ \ {*}/}~\\ etisserant@393: \texttt{ \ \ \ \}}~\\ etisserant@393: \texttt{ \ \};} etisserant@393: nico@208: nico@208: \subsubsection{Does the code works in banked memory ?} etisserant@393: nico@208: No. Today it seems that the port of gcc is bogged for using the banked nico@208: memory. So, unfortunately, we are limited to 48 Kbytes of memory code. nico@208: etisserant@393: nico@208: \subsubsection{What GCC version are you using ?} etisserant@393: nico@208: We are using the stable RPM release 2.2 : nico@208: nico@208: \begin{enumerate} etisserant@393: \item GNU Gcc 3.0.4. Build 20030501 etisserant@393: \item Newlib 1.10.0 Build 20030421 etisserant@393: \item GNU Binutils 2.12.1 Build 20030427 nico@208: \end{enumerate} etisserant@393: etisserant@393: \section{Documentation resources} etisserant@393: etisserant@393: etisserant@393: \paragraph{CIA : Can in Automation } etisserant@393: etisserant@393: \href{http://www.can-cia.de/}{http://www.can -cia.de} etisserant@393: etisserant@393: etisserant@393: \paragraph{Resources and training in \canopen } etisserant@393: nico@208: \href{http://www.esacademy.com/}{http://www.esacademy.com} nico@208: etisserant@393: etisserant@393: \paragraph{Elektronikladen HCS12 T -board } etisserant@393: nico@208: \href{http://www.elektronikladen.de/en_hcs12tb.html}{http://www.elektronikladen.de/en\_hcs12tb.html} nico@208: etisserant@393: etisserant@393: \paragraph{Gnu gcc compiler for HC12} etisserant@393: nico@208: \href{http://m68hc11.serveftp.org/m68hc11_port.php}{http://m68hc11.serveftp.org/m68hc11\_port.php} nico@208: etisserant@393: etisserant@393: \paragraph{Motorola documentation on HC12 } etisserant@393: nico@208: \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} nico@208: etisserant@393: etisserant@393: \paragraph{Lauterbach debugger for HC12 } etisserant@393: nico@208: \href{http://www.lauterbach.com/}{http://www.lauterbach.com} nico@208: etisserant@393: etisserant@393: \paragraph{Python language } etisserant@393: nico@208: \href{http://www.python.org/}{http://www.python.org} nico@208: etisserant@393: \clearpage{} etisserant@393: etisserant@393: etisserant@393: \section{About the project} etisserant@393: etisserant@393: nico@208: \subsection{Contributors } etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=10cm]{Pictures/1000020100000258000000832C6FFAB4} etisserant@393: \par\end{center} etisserant@393: etisserant@393: Unité mixte de recherche INRETS -LCPC etisserant@393: etisserant@393: sur les Interractions Véhicule -Infrastructure -Conducteur etisserant@393: etisserant@393: 14, route de la minière nico@208: nico@208: 78000 Versailles nico@208: nico@208: FRANCE nico@208: nico@208: Tel : +33 1 40 43 29 01 nico@208: nico@208: \href{http://www.inrets.fr/ur/livic}{http://www.inrets.fr/ur/livic} nico@208: nico@208: \textbf{Contributors :} Francis DUPIN nico@208: etisserant@393: Camille BOSSARD etisserant@393: etisserant@393: Laurent ROMIEUX etisserant@393: etisserant@393: \bigskip{} etisserant@393: etisserant@393: etisserant@393: \begin{center} etisserant@393: \includegraphics[width=10cm]{Pictures/100002010000013A0000004A96B0C1FF} etisserant@393: \par\end{center} nico@208: nico@208: LOLITECH nico@208: nico@208: 204, rue du Haut du Pin nico@208: etisserant@393: 88470 Saint -Michel sur Meurthe nico@208: nico@208: FRANCE nico@208: nico@208: Tel : +33 3 29 52 95 67 nico@208: nico@208: \href{http://www.lolitech.fr/}{http://www.lolitech.fr} nico@208: etisserant@393: \textbf{Contributors :} Edouard TISSERANT (Original author) etisserant@393: etisserant@393: Laurent BESSARD etisserant@393: etisserant@393: \bigskip{} etisserant@393: nico@208: nico@208: Many thanks to the other contributors for their great work: nico@208: etisserant@393: Raphael ZULLIGER etisserant@393: etisserant@393: David DUMINY (sté A6R) etisserant@393: etisserant@393: Zakaria BELAMRI etisserant@393: nico@208: nico@208: \subsection{Getting support} etisserant@393: etisserant@393: Send your feedback and bug reports to \href{mailto:canfestival-devel@lists.sourceforge.net}{canfestival-devel@lists.sourceforge.net}. etisserant@393: etisserant@393: For commercial support, \ training and specific integration and developments, etisserant@393: please ask LOLITECH (see contributors). etisserant@393: nico@208: nico@208: \subsection{Contributing} etisserant@393: nico@208: You are free to contribute your specific interfaces back to the project. nico@208: This way, you can hope to get support from CanFestival users community. nico@208: etisserant@393: Please send your patch to \href{mailto:canfestival-devel@lists.sourceforge.net}{canfestival etisserant@393: -devel@lists.sourceforge.net}. etisserant@393: etisserant@393: Feel free to create some new predefined DS -4xx profiles ({*}.prf) etisserant@393: in objdictgen/config, as much as possible respectful to the official nico@208: specifications. nico@208: etisserant@393: nico@208: \subsection{License} etisserant@393: etisserant@393: All the project is licensed with LGPL. This mean you can link CanFestival etisserant@393: with any code without being obliged to publish it. etisserant@393: etisserant@393: \texttt{\#This file is part of CanFestival, a library implementing etisserant@393: \canopen Stack.} etisserant@393: etisserant@393: \texttt{\#} etisserant@393: etisserant@393: \texttt{\#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent etisserant@393: BESSARD} etisserant@393: etisserant@393: \texttt{\#} etisserant@393: etisserant@393: \texttt{\#See COPYING file for copyrights details.} etisserant@393: etisserant@393: \texttt{\#} etisserant@393: etisserant@393: \texttt{\#This library is free software; you can redistribute it and/or} etisserant@393: etisserant@393: \texttt{\#modify it under the terms of the GNU Lesser General Public} etisserant@393: etisserant@393: \texttt{\#License as published by the Free Software Foundation; either} etisserant@393: etisserant@393: \texttt{\#version 2.1 of the License, or (at your option) any later etisserant@393: version.} etisserant@393: etisserant@393: \texttt{\#} etisserant@393: etisserant@393: \texttt{\#This library is distributed in the hope that it will be etisserant@393: useful,} etisserant@393: etisserant@393: \texttt{\#but WITHOUT ANY WARRANTY; without even the implied warranty etisserant@393: of} etisserant@393: etisserant@393: \texttt{\#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See etisserant@393: the GNU} etisserant@393: etisserant@393: \texttt{\#Lesser General Public License for more details.} etisserant@393: etisserant@393: \texttt{\#} etisserant@393: etisserant@393: \texttt{\#You should have received a copy of the GNU Lesser General etisserant@393: Public} etisserant@393: etisserant@393: \texttt{\#License along with this library; if not, write to the Free etisserant@393: Software} etisserant@393: etisserant@393: \texttt{\#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA etisserant@393: \ 02111 -1307 \ USA} nico@208: \end{document}