77 |
80 |
78 The \canopen library is coming with some tools : |
81 The \canopen library is coming with some tools : |
79 |
82 |
80 \begin{enumerate} |
83 \begin{enumerate} |
81 \item Object Dictionary editor GUI. WxPython Model-View-Controler based |
84 \item Object Dictionary editor GUI. WxPython Model-View-Controler based |
82 GUI, that help a lot in generating object dictionary source code for |
85 GUI, that helps a lot in generating object dictionary source code for |
83 each node. |
86 each node. |
84 \item A configure script, that let you chose compile time options such as |
87 \item A configure script, that let you chose compile time options such as |
85 target CPU/HOST, CAN and TIMER drivers.\\ |
88 target CPU/HOST, CAN and TIMER drivers.\\ |
86 This script has not been generated with autoconf, it has been made |
89 This script has not been generated with autoconf, it has been made |
87 keeping micro-controller target in mind. |
90 keeping micro-controller target in mind. |
88 \end{enumerate} |
91 \end{enumerate} |
89 |
92 |
90 \subsection{Standard conformance} |
93 \subsection{Multi-Platform} |
91 |
|
92 |
|
93 \subsubsection{Multi-Platform} |
|
94 |
94 |
95 \begin{enumerate} |
95 \begin{enumerate} |
96 \item Library source code is C-ANSI. |
96 \item Library source code is C-ANSI. |
97 \item Driver and examples coding conventions merely depend on target specific |
97 \item Driver and examples coding conventions merely depend on target specific |
98 contributor/compiler. |
98 contributor/compiler. |
99 \item Unix compatible interfaces and examples should compile and run on |
99 \item Unix compatible interfaces and examples should compile and run on |
100 any Unix system (tested on GNU/Linux and GNU/FreeBSD). |
100 any Unix system (tested on GNU/Linux and GNU/FreeBSD). |
101 \end{enumerate} |
101 \end{enumerate} |
102 |
102 |
103 \subsubsection{\canopen conformance} |
103 \subsection{\canopen standard conformance} |
104 |
104 |
105 |
105 \subsubsection{DS-301} |
106 \paragraph{DS-301} |
106 |
|
107 Supported features should conform to DS301. V.4.02 13 february 2002. |
107 |
108 |
108 \begin{enumerate} |
109 \begin{enumerate} |
109 \item Should conform to DS301. V.4.02 13 february 2002. |
110 \item NMT master and slave |
110 \item Master and Slave functionality implemented. |
111 \item Heartbeat consumer and producer |
111 \item Sending SYNC implemented. |
112 \item NodeGuard slave reponder and basic master without tracking |
112 \item 1 SDO server per node. (update: more than one possible. To be more |
113 \item SYNC service |
113 tested) |
114 \item SDO multiples client and server, segmented and expedited |
114 \item Unlimited SDO client. |
115 \item PDO : TPDO and RPDO, with respect to transmission type |
115 \item SDO transmission mode : normal, expedited download and upload. |
116 \item PDO mapping from/to OD variables bit per bit. |
116 \item Unlimited PDO receive. |
117 \item EMCY : Send and receive and keeps track of emergency objects |
117 \item Unlimited PDO transmit. |
118 \item Data types : 8 to 64 bits values, fixed length strings. |
118 \item Object Data type implemented : 8, 16, 32 bits values, and fixed length |
|
119 strings. |
|
120 \item Slave state full implemented. |
|
121 \item NMT to change slaves state implemented. |
|
122 \item PDO transmission mode : on request, every reception of 0 to n SYNC, |
|
123 on event. |
|
124 \item NMT Heartbeat implemented : A node can be either heartbeat producer |
|
125 or receiver. |
|
126 \item NMT NodeGuard implemented : Not fully implemented. |
|
127 \item TIME (time Stamp) : Not implemented. |
|
128 \item EMCY (emergency objects) : Sending and reception of EMCY objectos |
|
129 (without manufacturer specific error field). |
|
130 \item PDO Mapping bit per bit implemented. |
|
131 \end{enumerate} |
119 \end{enumerate} |
132 |
120 |
133 \paragraph{DS-302} |
121 \subsubsection{DS-302} |
134 |
122 |
135 \begin{enumerate} |
123 Only concise DFC is supported. |
136 \item Concise DFC : implemented. |
|
137 \end{enumerate} |
|
138 |
124 |
139 \section{How to start} |
125 \section{How to start} |
140 |
126 |
141 |
|
142 \subsection{Host requirements} |
127 \subsection{Host requirements} |
143 |
128 |
144 What you need on your development workstation. |
129 What you need on your development workstation. |
145 |
|
146 |
130 |
147 \subsubsection{Object Dictionary Editor GUI} |
131 \subsubsection{Object Dictionary Editor GUI} |
148 |
132 |
149 \begin{enumerate} |
133 \begin{enumerate} |
150 \item Python, with |
134 \item Python, with |
151 \item wxPyhon modules installed (at least version 2.6.3). |
135 \item wxPython modules installed (at least version 2.6.3). |
152 \item Gnosis xml tools. (Optional can also be installed locally to the project |
136 \item Gnosis xml tools. (Optional can also be installed locally to the project |
153 automatically with the help of a Makefile. Please see {}``Using Dictionary |
137 automatically with the help of a Makefile. Please see {}``Using Dictionary |
154 Editor GUI'' ) |
138 Editor GUI'' ) |
155 \end{enumerate} |
139 \end{enumerate} |
156 |
140 |
177 \subsection{How to get CanFestival} |
161 \subsection{How to get CanFestival} |
178 |
162 |
179 Please always use CVS, this is the best way to get the most reactive |
163 Please always use CVS, this is the best way to get the most reactive |
180 support from the developer community : |
164 support from the developer community : |
181 |
165 |
182 cvs -d:pserver:anonymous@lolitech.dyndns.org:/canfestival login\\ |
166 |
183 (type return, without entering a password) |
167 \begin{verbatim} |
184 |
168 cvs -d:pserver:anonymous@lolitech.dyndns.org:/canfestival login |
185 Then, enter : \\ |
169 \end{verbatim} |
186 cvs -z3 -d:pserver:anonymous@lolitech.dyndns.org:/canfestival co |
170 |
187 -P CanFestival-3 |
171 (type return, without entering a password) |
|
172 |
|
173 Then, enter : |
|
174 |
|
175 \begin{verbatim} |
|
176 cvs -z3 -d:pserver:anonymous@lolitech.dyndns.org:/canfestival co -P CanFestival-3 |
|
177 \end{verbatim} |
|
178 |
188 |
179 |
189 |
180 |
190 \section{Understanding Canfestival} |
181 \section{Understanding Canfestival} |
191 |
182 |
192 |
|
193 \subsection{CanFestival Project tree layout} |
183 \subsection{CanFestival Project tree layout} |
194 |
184 |
195 Simplified directory structure. |
185 Simplified directory structure. |
196 |
186 |
197 \texttt{\textbf{./src ANSI-C source of \canopen stack}} |
187 \begin{verbatim} |
198 |
188 ./src ANSI-C source of \canopen stack |
199 \texttt{\textbf{./include Exportables Header files}} |
189 ./include Exportables Header files |
200 |
190 ./drivers Interfaces to specific platforms/HW |
201 \texttt{\textbf{./drivers Interfaces to specific platforms/HW}} |
191 ./drivers/unix Linux and Cygwin OS interface |
202 |
192 ./drivers/win32 Native Win32 OS interface |
203 \texttt{./drivers/unix Linux and Cygwin OS interface} |
193 ./drivers/timers_xeno Xenomai timers/threads (Linux only) |
204 |
194 ./drivers/timers_kernel Linux kernel timer/threads |
205 \texttt{./drivers/win32 Native Win32 OS interface} |
195 ./drivers/timers_unix Posix timers/threads (Linux, Cygwin) |
206 |
196 ./drivers/can_virtual_kernel Fake CAN network (kernel space) |
207 \texttt{./drivers/timers\_xeno Xenomai timers/threads (Linux only)} |
197 ./drivers/can_peak_linux PeakSystem CAN library interface |
208 |
198 ./drivers/can_peak_win32 PeakSystem PCAN-Light interface |
209 \texttt{./drivers/timers\_kernel Linux kernel timer/threads} |
199 ./drivers/can_uvccm_win32 Acacetus's RS232 CAN-uVCCM interface |
210 |
200 ./drivers/can_virtual Fake CAN network (Linux, Cygwin) |
211 \texttt{./drivers/timers\_unix Posix timers/threads (Linux, Cygwin)} |
201 ./drivers/hcs12 HCS12 full target interface |
212 |
202 ./examples Examples |
213 \texttt{./drivers/can\_virtual\_kernel Fake CAN network (kernel space)} |
203 ./examples/TestMasterSlave 2 nodes, NMT SYNC SDO PDO, win32+unix |
214 |
204 ./examples/TestMasterMicroMod 1 node, control Peak I/O Module, unix |
215 \texttt{./drivers/can\_peak\_linux PeakSystem CAN library interface} |
205 ./examples/gene_SYNC_HCS12 Just send periodic SYNC on HCS12 |
216 |
206 ./examples/win32test Ask some DS301 infos to a node (win32) |
217 \texttt{./drivers/can\_peak\_win32 PeakSystem PCAN -Light interface} |
207 ./objdictgen Object Dictionary editor GUI |
218 |
208 ./objdictgen/config Pre-defined OD profiles |
219 \texttt{./drivers/can\_uvccm\_win32 Acacetus{\textquotesingle}s |
209 ./objdictgen/examples Some examples/test OD |
220 RS232 {}``CAN -uVCCM'' interface} |
210 ./doc Documentation source |
221 |
211 \end{verbatim} |
222 \texttt{./drivers/can\_virtual Fake CAN network (Linux, Cygwin)} |
212 |
223 |
|
224 \texttt{./drivers/hcs12 HCS12 full target interface} |
|
225 |
|
226 \texttt{\textbf{./examples Examples}} |
|
227 |
|
228 \texttt{./examples/TestMasterSlave 2 nodes, NMT SYNC SDO PDO, win32+unix} |
|
229 |
|
230 \texttt{./examples/TestMasterMicroMod 1 node, control Peak I/O Module, |
|
231 unix} |
|
232 |
|
233 \texttt{./examples/gene\_SYNC\_HCS12 Just send periodic SYNC on HCS12} |
|
234 |
|
235 \texttt{./examples/win32test Ask some DS301 infos to a node (}\texttt{\textbf{win32)}} |
|
236 |
|
237 \texttt{\textbf{./objdictgen Object Dictionary editor GUI}} |
|
238 |
|
239 \texttt{./objdictgen/config Pre -defined OD profiles} |
|
240 |
|
241 \texttt{./objdictgen/examples Some examples/test OD} |
|
242 |
|
243 \texttt{\textbf{./doc Project and \canopen doc}} |
|
244 |
213 |
245 |
214 |
246 \subsection{Implement CanFestival in your application} |
215 \subsection{Implement CanFestival in your application} |
247 |
216 |
248 \begin{center} |
217 \begin{center} |
254 |
223 |
255 |
224 |
256 \subsection{CanFestival CAN interfaces} |
225 \subsection{CanFestival CAN interfaces} |
257 |
226 |
258 Because most CAN controllers and drivers implement FIFOs, CanFestival |
227 Because most CAN controllers and drivers implement FIFOs, CanFestival |
259 consider sending message as a non bloking operation. |
228 consider sending message as a non blocking operation. |
260 |
229 |
261 In order to prevent reentrent calls to the stack, messages reception |
230 In order to prevent reentrent calls to the stack, messages reception |
262 is implemented differently on {\textmu}C and OS.: |
231 is implemented differently on {\textmu}C and OS.: |
263 |
232 |
264 \begin{enumerate} |
233 \begin{enumerate} |
265 \item {\textmu}C must provide interuption masking for timer and can receive |
234 \item {\textmu}C must provide interruption masking, mutually excluding timer and CAN receive interrupts.\\ |
266 TI\\ |
|
267 |
235 |
268 |
236 |
269 |
237 |
270 \begin{center} |
238 \begin{center} |
271 \includegraphics[width=12cm]{Pictures/10000201000003CA0000016604E6A5EF} |
239 \includegraphics[width=12cm]{Pictures/10000201000003CA0000016604E6A5EF} |
272 \par\end{center} |
240 \par\end{center} |
273 |
241 |
274 \item OS must provide a receive thread, a timer thread and a mutex. CAN |
242 \item OS must provide a receive thread, a timer thread and a mutex. CAN |
275 reception is a bloking operation.\\ |
243 reception should be a bloking operation.\\ |
276 |
244 |
277 |
245 |
278 |
246 |
279 \begin{center} |
247 \begin{center} |
280 \includegraphics[width=12cm]{Pictures/10000201000003F9000002CF8B0CDAEA} |
248 \includegraphics[width=12cm]{Pictures/10000201000003F9000002CF8B0CDAEA} |
281 \par\end{center} |
249 \par\end{center} |
282 |
250 |
283 \end{enumerate} |
251 \end{enumerate} |
284 |
252 |
285 \subsection{CanFestival events scheduling} |
253 \subsection{CanFestival event scheduling} |
286 |
254 |
287 A \canopen node must be able to take delayed actions. |
255 A \canopen node must be able to take delayed actions. |
288 |
256 |
289 As exemples, periodic sync emission, heartbeat production or SDO timeout |
257 For instance, periodic sync emission, heartbeat production or SDO timeout |
290 need to set some alarms that will be called later and do the job. |
258 need to set some alarms that will be called later and do the job. |
291 |
259 |
292 {\textmu}C generaly do not have enough free timers to handle all |
260 {\textmu}C generally do not have enough free timers to handle all |
293 the \canopen needs directly. Moreover, CanFestival internal data |
261 the \canopen needs directly. Moreover, CanFestival internal data |
294 may be corrupt by reentrant calls. |
262 may be corrupt by reentrant calls. |
295 |
263 |
296 CanFestival implement a micro -scheduler (timer.c). It uses only one |
264 CanFestival implement a micro -scheduler (timer.c). It uses only one |
297 timer to mimic many timers. It manage an alarm table, and call alarms |
265 timer to mimic many timers. It manage an alarm table, and call alarms |
395 on your system. |
374 on your system. |
396 |
375 |
397 |
376 |
398 \paragraph{Socket -Can (http://socketcan.berlios.de)} |
377 \paragraph{Socket -Can (http://socketcan.berlios.de)} |
399 |
378 |
400 Configure switch: |
379 |
401 |
380 \begin{verbatim} |
402 \texttt{- -can=socket} |
381 ./configure --can=socket |
|
382 \end{verbatim} |
403 |
383 |
404 |
384 |
405 \paragraph{LinCan} |
385 \paragraph{LinCan} |
406 |
386 |
407 Configure switch: |
387 |
408 |
388 \begin{verbatim} |
409 \texttt{- -can=lincan} |
389 ./configure --can=lincan |
|
390 \end{verbatim} |
410 |
391 |
411 |
392 |
412 \paragraph{Virtual CAN interfaces (for test/debug)} |
393 \paragraph{Virtual CAN interfaces (for test/debug)} |
413 |
394 |
414 Configure switch: |
395 |
415 |
396 \begin{verbatim} |
416 \texttt{- -can=virtual (in user space)} |
397 ./configure --can=virtual |
417 |
398 or, for kernel space: |
418 \texttt{- -can=virtual\_kernel (in kernel space)} |
399 ./configure --can=kernel_virtual |
|
400 \end{verbatim} |
|
401 |
419 |
402 |
420 Virtual CAN interface use Unix pipes to emulate a virtual CAN network. |
403 Virtual CAN interface use Unix pipes to emulate a virtual CAN network. |
421 Each message issued from a node is repeat to all other nodes. Currently |
404 Each message issued from a node is repeat to all other nodes. Currently |
422 only works with nodes running in the same process, and does not support |
405 only works with nodes running in the same process, and does not support |
423 work with Xenomai. |
406 work with Xenomai. |
424 |
407 |
425 |
408 |
426 \subsection{Testing your CanFestival installation} |
409 \subsection{Testing your CanFestival installation} |
427 |
410 |
|
411 \subsection{User space} |
|
412 |
428 Sample provided in /example/TestMasterSlave is installed into your |
413 Sample provided in /example/TestMasterSlave is installed into your |
429 system during installation. |
414 system during installation. |
430 |
415 |
431 \texttt{TestMasterSlave} |
416 |
|
417 \begin{verbatim} |
|
418 TestMasterSlave |
|
419 \end{verbatim} |
|
420 |
432 |
421 |
433 Default CAN driver library is libcanfestival\_can\_virtual.so., which |
422 Default CAN driver library is libcanfestival\_can\_virtual.so., which |
434 will simply pass CAN messages through Unix pipes between Master and |
423 will simply pass CAN messages through Unix pipes between Master and |
435 Slave. |
424 Slave. |
436 |
425 |
437 You may also want to specify different can interface and define some |
426 You may also want to specify different can interface and define some |
438 CAN ports. Another example using Peak{\textquotesingle}s dual PCMCIA |
427 CAN ports. Another example using Peak{\textquotesingle}s dual PCMCIA |
439 (configure and install with --can=peak) : |
428 (configure and install with --can=peak) : |
440 |
429 |
441 \texttt{TestMasterSlave -l libcanfestival\_can\_peak.so -s 40 -m 41} |
430 |
442 |
431 \begin{verbatim} |
443 \texttt{example/kerneltest} It's based on TestMasterSlave example |
432 TestMasterSlave -l libcanfestival_can_peak.so -s 40 -m 41 |
|
433 \end{verbatim} |
|
434 |
|
435 |
|
436 \subsection{Kernel space} |
|
437 |
|
438 |
|
439 \begin{verbatim} |
|
440 example/kerneltest |
|
441 \end{verbatim} |
|
442 |
|
443 |
|
444 It's based on TestMasterSlave example |
444 and has the same functionality. Uses virtual can driver as default |
445 and has the same functionality. Uses virtual can driver as default |
445 too. After successfull installation you can insert the module by typing: |
446 too. After successful installation you can insert the module by typing: |
446 modprobe canf\_ktest Module control is done by simple console 'canf\_ktest\_console' |
447 modprobe canf\_ktest Module control is done by simple console 'canf\_ktest\_console' |
447 which is used to start/stop sending data. |
448 which is used to start/stop sending data. |
448 |
449 |
449 |
450 |
450 \section{Windows Targets} |
451 \section{Windows Targets} |
451 |
452 |
452 CanFestival can be compiled and run on Windows platform. It is possible |
453 CanFestival can be compiled and run on Windows platform. It is possible |
453 to use both Cygwin and win32 native runtime environment. |
454 to use both Cygwin and win32 native runtime environment. |
454 |
455 |
455 |
|
456 \subsection{Object Dictionary Editor GUI installation.} |
456 \subsection{Object Dictionary Editor GUI installation.} |
457 |
457 |
458 Please refer to \hyperlink{a821UsingDictionaryEditorGUIoutline}{8.2.1)Using |
458 Please refer to \hyperlink{a821UsingDictionaryEditorGUIoutline}{8.2.1)Using |
459 Dictionary Editor GUI} |
459 Dictionary Editor GUI} |
460 |
460 |
461 |
|
462 \subsection{CYGWIN} |
461 \subsection{CYGWIN} |
463 |
|
464 |
462 |
465 \subsubsection{Requirements} |
463 \subsubsection{Requirements} |
466 |
464 |
467 Cygwin have to be installed with those packages : |
465 Cygwin have to be installed with those packages : |
468 |
466 |
487 \subsubsection{Cygwin configuration and compilation} |
485 \subsubsection{Cygwin configuration and compilation} |
488 |
486 |
489 |
487 |
490 \paragraph{A single node with PcanLight and Peak CAN -USB adapter} |
488 \paragraph{A single node with PcanLight and Peak CAN -USB adapter} |
491 |
489 |
492 Download the PCAN -Light Zip file for your HW ( URL from download |
490 Download the PCAN-Light Zip file for your HW ( URL from download |
493 page ): |
491 page ): |
494 |
492 |
495 \texttt{wget http://www.peak -system.com/files/usb.zip} |
493 |
|
494 \begin{verbatim} |
|
495 wget http://www.peak -system.com/files/usb.zip |
|
496 \end{verbatim} |
|
497 |
496 |
498 |
497 Extract its content into your cygwin home (it will create a {}``Disk'' |
499 Extract its content into your cygwin home (it will create a {}``Disk'' |
498 directory): |
500 directory): |
499 |
501 |
500 \texttt{unzip usb.zip} |
502 |
|
503 \begin{verbatim} |
|
504 unzip usb.zip |
|
505 \end{verbatim} |
|
506 |
501 |
507 |
502 Configure CanFestival3 providing path to the desired PcanLight implementation: |
508 Configure CanFestival3 providing path to the desired PcanLight implementation: |
503 |
509 |
504 \texttt{cd CanFestival -3} |
510 |
505 |
511 \begin{verbatim} |
506 \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN -Light/Api/} |
512 cd CanFestival -3 |
507 |
513 export PCAN_INCLUDE=~/Disk/PCAN-Light/Api/ |
508 \texttt{export PCAN\_HEADER=Pcan\_usb.h} |
514 export PCAN_HEADER=Pcan_usb.h |
509 |
515 export PCAN_LIB=~/Disk/PCAN-Light/Lib/Visual\ C++/Pcan_usb.lib |
510 \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN -Light/Lib/Visual\textbackslash{} |
516 ./configure --can=peak_win32 |
511 C++/Pcan\_usb.lib} |
517 make |
512 |
518 \end{verbatim} |
513 \texttt{./configure -{}-can=peak\_win32} |
519 |
514 |
|
515 \texttt{make} |
|
516 |
520 |
517 In order to test, you have to use another CanFestival node, connect |
521 In order to test, you have to use another CanFestival node, connect |
518 with a CAN cable. |
522 with a CAN cable. |
519 |
523 |
520 \texttt{cp \~{ }/Disk/PCAN -Light/Pcan\_usb.dll .} |
524 |
521 |
525 \begin{verbatim} |
522 \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}} |
526 cp ~/Disk/PCAN-Light/Pcan_usb.dll . |
523 |
527 ./examples/TestMasterSlave/TestMasterSlave \ |
524 \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll \textbackslash{}} |
528 -l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll \ |
525 |
529 -S 500K -M none |
526 \texttt{-S 500K -M none} |
530 \end{verbatim} |
|
531 |
527 |
532 |
528 Then, on the other node : |
533 Then, on the other node : |
529 |
534 |
530 \texttt{./TestMasterSlave -l my\_driver.so -S none -M 500K} |
535 |
531 |
536 \begin{verbatim} |
532 Now messages are beeing exchanged between master and slave node. |
537 ./TestMasterSlave -l my_driver.so -S none -M 500K |
533 |
538 \end{verbatim} |
|
539 |
|
540 |
|
541 Now messages are being exchanged between master and slave node. |
534 |
542 |
535 \paragraph{Two nodes with PcanLight and Peak dual PCMCIA -CAN adapter} |
543 \paragraph{Two nodes with PcanLight and Peak dual PCMCIA -CAN adapter} |
536 |
544 |
537 Download the PCAN -Light Zip file for your HW ( URL from download |
545 Download the PCAN-Light Zip file for your HW ( URL from download |
538 page ): |
546 page ): |
539 |
547 |
540 \texttt{wget http://www.peak -system.com/files/pccard.zip} |
548 |
|
549 \begin{verbatim} |
|
550 wget http://www.peak-system.com/files/pccard.zip |
|
551 \end{verbatim} |
|
552 |
541 |
553 |
542 Extract its content into your cygwin home (it will create a {}``Disk'' |
554 Extract its content into your cygwin home (it will create a {}``Disk'' |
543 directory): |
555 directory): |
544 |
556 |
545 \texttt{unzip pccard.zip} |
557 |
|
558 \begin{verbatim} |
|
559 unzip pccard.zip |
|
560 \end{verbatim} |
|
561 |
546 |
562 |
547 The configure CanFestival3 providing path to the desired PcanLight |
563 The configure CanFestival3 providing path to the desired PcanLight |
548 implementation: |
564 implementation: |
549 |
565 |
550 \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN -Light/Api/} |
566 |
551 |
567 \begin{verbatim} |
552 \texttt{export PCAN\_HEADER=Pcan\_pcc.h} |
568 export PCAN_INCLUDE=~/Disk/PCAN-Light/Api/ |
553 |
569 export PCAN_HEADER=Pcan_pcc.h |
554 \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN -Light/Lib/Visual\textbackslash{} |
570 export PCAN_LIB=~/Disk/PCAN-Light/Lib/Visual\ C++/Pcan_pcc.lib |
555 C++/Pcan\_pcc.lib} |
571 export PCAN2_HEADER=Pcan_2pcc.h |
556 |
572 export PCAN2_LIB=~/Disk/PCAN-Light/Lib/Visual\ C++/Pcan_2pcc.lib |
557 \texttt{export PCAN2\_HEADER=Pcan\_2pcc.h} |
573 \end{verbatim} |
558 |
574 |
559 \texttt{export PCAN2\_LIB=\~{ }/Disk/PCAN -Light/Lib/Visual\textbackslash{} |
|
560 C++/Pcan\_2pcc.lib} |
|
561 |
575 |
562 In order to test, just connect together both CAN ports of the PCMCIA |
576 In order to test, just connect together both CAN ports of the PCMCIA |
563 card. Don{\textquotesingle}t forget 120ohms terminator. |
577 card. Don{\textquotesingle}t forget 120ohms terminator. |
564 |
578 |
565 \texttt{cp \~{ }/Disk/PCAN -Light/Pcan\_pcc.dll .} |
579 |
566 |
580 \begin{verbatim} |
567 \texttt{cp \~{ }/Disk/PCAN -Light/Pcan\_2pcc.dll .} |
581 cp ~/Disk/PCAN-Light/Pcan_pcc.dll . |
568 |
582 cp ~/Disk/PCAN-Light/Pcan_2pcc.dll . |
569 \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}} |
583 ./examples/TestMasterSlave/TestMasterSlave \ |
570 |
584 -l drivers/can_peak_win32/cygcan_peak_win32.dll |
571 \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll} |
585 \end{verbatim} |
|
586 |
572 |
587 |
573 Messages are then exchanged between master and slave node, both inside |
588 Messages are then exchanged between master and slave node, both inside |
574 TestMasterSlave{\textquotesingle}s process. |
589 TestMasterSlave{\textquotesingle}s process. |
575 |
590 |
576 |
|
577 \subsection{Visual Studio C++} |
591 \subsection{Visual Studio C++} |
578 |
|
579 |
592 |
580 \subsubsection{Requirements} |
593 \subsubsection{Requirements} |
581 |
594 |
582 Minimal Cygwin installation is required at configuration time in order |
595 Minimal Cygwin installation is required at configuration time in order |
583 to create specific header files (config.h and cancfg.h). Once this |
596 to create specific header files (config.h and cancfg.h). Once this |
653 \paragraph{A single node with PcanLight and Peak CAN-USB adapter} |
669 \paragraph{A single node with PcanLight and Peak CAN-USB adapter} |
654 |
670 |
655 Download the PCAN-Light Zip file for your HW ( URL from download page |
671 Download the PCAN-Light Zip file for your HW ( URL from download page |
656 ): |
672 ): |
657 |
673 |
658 \begin{quotation} |
674 \begin{verbatim} |
659 \texttt{wget http://www.peak-system.com/files/usb.zip} |
675 wget http://www.peak-system.com/files/usb.zip |
660 \end{quotation} |
676 \end{verbatim} |
|
677 |
661 Extract its content into your MSYS's home (it will create a \char`\"{} |
678 Extract its content into your MSYS's home (it will create a \char`\"{} |
662 Disk\char`\"{} directory): |
679 Disk\char`\"{} directory): |
663 |
680 |
664 \begin{quotation} |
681 |
665 \texttt{unzip usb.zip} |
682 \begin{verbatim} |
666 \end{quotation} |
683 unzip usb.zip |
|
684 \end{verbatim} |
|
685 |
|
686 |
667 Configure CanFestival3 providing path to the desired PcanLight implementation: |
687 Configure CanFestival3 providing path to the desired PcanLight implementation: |
668 |
688 |
669 \begin{quotation} |
689 \begin{verbatim} |
670 \texttt{cd CanFestival-3} |
690 cd CanFestival-3 |
671 |
691 export PCAN_INCLUDE=~/Disk/PCAN-Light/Api/ |
672 \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN-Light/Api/} |
692 export PCAN_HEADER=Pcan_usb.h |
673 |
693 export PCAN_LIB=~/Disk/PCAN-Light/Lib/Visual\ C++/Pcan_usb.lib |
674 \texttt{export PCAN\_HEADER=Pcan\_usb.h} |
694 ./configure --can=peak_win32 |
675 |
695 make |
676 \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN-Light/Lib/Visual\textbackslash{} |
696 \end{verbatim} |
677 C++/Pcan\_usb.lib} |
697 |
678 |
|
679 \texttt{./configure - -can=peak\_win32} |
|
680 |
|
681 \texttt{make} |
|
682 \end{quotation} |
|
683 In order to test, you have to use another CanFestival node, connect |
698 In order to test, you have to use another CanFestival node, connect |
684 with a CAN cable. |
699 with a CAN cable. |
685 |
700 |
686 \begin{quotation} |
701 |
687 \texttt{cp \~{ }/Disk/PCAN-Light/Pcan\_usb.dll .} |
702 \begin{verbatim} |
688 |
703 cp ~/Disk/PCAN-Light/Pcan_usb.dll . |
689 \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}} |
704 ./examples/TestMasterSlave/TestMasterSlave \ |
690 |
705 -l drivers/can_peak_win32/cygcan_peak_win32.dll \ |
691 \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll \textbackslash{}} |
706 -S 500K -M none |
692 |
707 \end{verbatim} |
693 \texttt{-S 500K -M none} |
708 |
694 \end{quotation} |
|
695 Then, on the other node : |
709 Then, on the other node : |
696 |
710 |
697 \begin{quotation} |
711 \begin{verbatim} |
698 \texttt{./TestMasterSlave -l my\_driver.so -S none -M 500K -m 0} |
712 ./TestMasterSlave -l my_driver.so -S none -M 500K -m 0 |
699 \end{quotation} |
713 \end{verbatim} |
700 Now messages are beeing exchanged between master and slave node. |
714 Now messages are being exchanged between master and slave node. |
701 |
715 |
702 |
716 |
703 \paragraph{Two nodes with PcanLight and Peak dual PCMCIA-CAN adapter} |
717 \paragraph{Two nodes with PcanLight and Peak dual PCMCIA-CAN adapter} |
704 |
718 |
705 Download the PCAN-Light Zip file for your HW ( URL from download page |
719 Download the PCAN-Light Zip file for your HW ( URL from download page |
706 ): |
720 ): |
707 |
721 |
708 \begin{quotation} |
722 \begin{verbatim} |
709 \texttt{wget http://www.peak-system.com/files/pccard.zip} |
723 wget http://www.peak-system.com/files/pccard.zip |
710 \end{quotation} |
724 \end{verbatim} |
711 Extract its content into your MSYS's home (it will create a \char`\"{} |
725 Extract its content into your MSYS's home (it will create a \char`\"{} |
712 Disk\char`\"{} directory): |
726 Disk\char`\"{} directory): |
713 |
727 |
714 \begin{quotation} |
728 \begin{verbatim} |
715 \texttt{unzip pccard.zip} |
729 unzip pccard.zip |
716 \end{quotation} |
730 \end{verbatim} |
717 The configure CanFestival3 providing path to the desired PcanLight |
731 The configure CanFestival3 providing path to the desired PcanLight |
718 implementation: |
732 implementation: |
719 |
733 |
720 \begin{quotation} |
734 \begin{verbatim} |
721 \texttt{export PCAN\_INCLUDE=\~{ }/Disk/PCAN-Light/Api/} |
735 export PCAN_INCLUDE=~/Disk/PCAN-Light/Api/ |
722 |
736 export PCAN_HEADER=Pcan_pcc.h} |
723 \texttt{export PCAN\_HEADER=Pcan\_pcc.h} |
737 export PCAN_LIB=~/Disk/PCAN-Light/Lib/Visual\ C++/Pcan_pcc.lib |
724 |
738 export PCAN2_HEADER=Pcan_2pcc.h |
725 \texttt{export PCAN\_LIB=\~{ }/Disk/PCAN-Light/Lib/Visual\textbackslash{} |
739 export PCAN2_LIB=~/Disk/PCAN-Light/Lib/Visual\ C++/Pcan_2pcc.lib |
726 C++/Pcan\_pcc.lib} |
740 \end{verbatim} |
727 |
741 |
728 \texttt{export PCAN2\_HEADER=Pcan\_2pcc.h} |
|
729 |
|
730 \texttt{export PCAN2\_LIB=\~{ }/Disk/PCAN-Light/Lib/Visual\textbackslash{} |
|
731 C++/Pcan\_2pcc.lib} |
|
732 \end{quotation} |
|
733 In order to test, just connect together both CAN ports of the PCMCIA |
742 In order to test, just connect together both CAN ports of the PCMCIA |
734 card. Don't forget 120ohms terminator. |
743 card. Don't forget 120ohms terminator. |
735 |
744 |
736 \begin{quotation} |
745 \begin{verbatim} |
737 \texttt{cp\~{ }/Disk/PCAN-Light/Pcan\_pcc.dll ~.} |
746 cp~/Disk/PCAN-Light/Pcan_pcc.dll ~. |
738 |
747 cp ~/Disk/PCAN-Light/Pcan_2pcc.dll ~. |
739 \texttt{cp \~{ }/Disk/PCAN-Light/Pcan\_2pcc.dll ~.} |
748 ./examples/TestMasterSlave/TestMasterSlave \ |
740 |
749 -l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll -m 0 -s 1 |
741 \texttt{./examples/TestMasterSlave/TestMasterSlave \textbackslash{}} |
750 \end{verbatim} |
742 |
|
743 \texttt{-l drivers/can\_peak\_win32/cygcan\_peak\_win32.dll -m 0 -s |
|
744 1} |
|
745 \end{quotation} |
|
746 Messages are then exchanged between master and slave node, both inside |
751 Messages are then exchanged between master and slave node, both inside |
747 TestMasterSlave's process. |
752 TestMasterSlave's process. |
748 |
|
749 |
753 |
750 \section{Motorola HCS12} |
754 \section{Motorola HCS12} |
751 |
755 |
752 The examples have been tested on a MC9S12DG255 mounted on a Elektronikladen |
756 The examples have been tested on a MC9S12DG255 mounted on a Elektronikladen |
753 HCS12 T -board. |
757 HCS12 T -board. |
759 For the difference MSCAN HC12/HCS12, see the Motorola application |
763 For the difference MSCAN HC12/HCS12, see the Motorola application |
760 note AN2011/D. |
764 note AN2011/D. |
761 |
765 |
762 Configure switch: |
766 Configure switch: |
763 |
767 |
764 \texttt{-{}-target=hcs12} |
768 \begin{verbatim} |
|
769 --target=hcs12 |
|
770 \end{verbatim} |
765 |
771 |
766 To do a \canopen node running on a microncontroller Motorola MC9S12DP256, |
772 To do a \canopen node running on a microncontroller Motorola MC9S12DP256, |
767 you need : |
773 you need : |
768 |
774 |
769 \begin{enumerate} |
775 \begin{enumerate} |
770 \item The compiler GNU gcc for HC11, HC12, HCS12 : m6811 -elf. \\ |
776 \item The compiler GNU gcc for HC11, HC12, HCS12 : m6811 -elf. \\ |
771 Download the \textbf{release 3.1} at : \href{http://m68hc11.serveftp.org/m68hc11_pkg_rpm.php}{http://m68hc11.serveftp.org/m68hc11\_pkg\_rpm.php} |
777 Download the \textbf{release 3.1} at : \href{http://m68hc11.serveftp.org/m68hc11_pkg_rpm.php}{http://m68hc11.serveftp.org/m68hc11\_pkg\_rpm.php} |
772 \item A board with this chip. We are using the T -board from Electronikladden. |
778 \item A board with this chip. We are using the T -board from Electronikladen. |
773 \item At least about 40 kBytes of program memory. |
779 \item At least about 40 kBytes of program memory. |
774 \item A tool to flash the memory. (We are using the hight cost Lauterbach |
780 \item A tool to flash the memory. (We are using the high cost Lauterbach |
775 debugger). |
781 debugger). |
776 \end{enumerate} |
782 \end{enumerate} |
777 |
783 |
778 \subsection{Running a HCS12 node} |
784 \subsection{Running a HCS12 node} |
779 |
785 |
780 |
786 |
781 \subsubsection{Compiling Canfestival:} |
787 \subsubsection{Compiling Canfestival:} |
782 |
788 |
783 \texttt{./configure -{}-target=hcs12} |
789 \begin{verbatim} |
|
790 ./configure --target=hcs12 |
|
791 \end{verbatim} |
784 |
792 |
785 |
793 |
786 \subsubsection{Compiling and building an example} |
794 \subsubsection{Compiling and building an example} |
787 |
795 |
788 Enter in the folder of an HCS12 example, |
796 Enter in the folder of an HCS12 example, |
789 |
797 |
790 \texttt{make all} |
798 \begin{verbatim} |
|
799 make all |
|
800 \end{verbatim} |
791 |
801 |
792 |
802 |
793 \subsubsection{Flashing the memory :} |
803 \subsubsection{Flashing the memory :} |
794 |
804 |
795 Use your prefered loader ! If you are using a debugger Lauterbach, |
805 Use your preferred loader ! If you are using a debugger Lauterbach, |
796 you can load the bash file : trace32\_flash\_programmer.cmm. It loads |
806 you can load the bash file : trace32\_flash\_programmer.cmm. It loads |
797 directly the elf file. |
807 directly the elf file. |
798 |
808 |
799 |
809 |
800 \subsubsection{Connecting to a serial RS232 console :} |
810 \subsubsection{Connecting to a serial RS232 console :} |
801 |
811 |
802 Connect the portS(TxD0) of the HCS12 to a console configured at 19200 |
812 Connect the portS(TxD0) of the HCS12 to a console configured at 19200 |
803 bauds 8N1, via a Max232 chip to adapt the electricals levels. On Linux, |
813 bauds 8N1, via a Max232 chip to adapt the electrical levels. On Linux, |
804 you can use minicom. Connecting to a console is usefull to read the |
814 you can use minicom. Connecting to a console is useful to read the |
805 messages, but not required. |
815 messages, but not required. |
806 |
816 |
807 |
817 |
808 \subsubsection{Connecting to the CAN network :} |
818 \subsubsection{Connecting to the CAN network :} |
809 |
819 |
810 Connect the port CAN0 (pin PM0, PM1) to the network via a CAN controller. |
820 Connect the port CAN0 (pin PM0, PM1) to the network via a CAN controller. |
811 On our board, the CAN controler is a PCA82C250 chip. |
821 On our board, the CAN controller is a PCA82C250 chip. |
812 |
822 |
813 |
823 |
814 \subsubsection{starting the node :} |
824 \subsubsection{starting the node :} |
815 |
825 |
816 Press the reset of your HCS12 board. |
826 Press the reset of your HCS12 board. |
822 use as example for your own developments. |
832 use as example for your own developments. |
823 |
833 |
824 |
834 |
825 \subsection{TestMasterSlave} |
835 \subsection{TestMasterSlave} |
826 |
836 |
827 \texttt{{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}\ } |
837 |
828 |
838 \begin{verbatim} |
829 \texttt{{*} \ TestMasterSlave \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
839 ************************************************************** |
830 |
840 * TestMasterSlave * |
831 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
841 * * |
832 |
842 * A simple example for PC. It does implement 2 CanOpen * |
833 \texttt{{*} \ A simple example for PC. It does implement 2 \canopen |
843 * nodes in the same process. A master and a slave. Both * |
834 \ \ \ \ \ {*}} |
844 * communicate together, exchanging periodically NMT, SYNC, * |
835 |
845 * SDO and PDO. Master configure heartbeat producer time * |
836 \texttt{{*} \ nodes in the same process. A master and a slave. Both |
846 * at 1000 ms for slave node-id 0x02 by concise DCF. * |
837 \ \ \ \ {*}} |
847 * * |
838 |
848 * Usage: * |
839 \texttt{{*} \ communicate together, exchanging periodically NMT, |
849 * ./TestMasterSlave [OPTIONS] * |
840 SYNC, \ {*}} |
850 * * |
841 |
851 * OPTIONS: * |
842 \texttt{{*} \ SDO and PDO. Master configure heartbeat producer time |
852 * -l : Can library ["libcanfestival_can_virtual.so"] * |
843 \ \ \ \ {*}} |
853 * * |
844 |
854 * Slave: * |
845 \texttt{{*} \ at 1000 ms for slave node -id 0x02 by concise DCF. \ \ \ \ \ \ \ \ {*}} |
855 * -s : bus name ["0"] * |
846 |
856 * -S : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) * |
847 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
857 * * |
848 |
858 * Master: * |
849 \texttt{{*} \ \ Usage: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
859 * -m : bus name ["1"] * |
850 |
860 * -M : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) * |
851 \texttt{{*} \ \ ./TestMasterSlave \ {[}OPTIONS] \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
861 * * |
852 |
862 ************************************************************** |
853 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
863 \end{verbatim} |
854 |
864 |
855 \texttt{{*} \ \ OPTIONS: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
865 |
856 |
866 Notes aboute use of voncise DCF : |
857 \texttt{{*} \ \ \ \ -l : Can library {[}{\textquotedbl}libcanfestival\_can\_virtual.so{\textquotedbl}] |
867 |
858 \ \ \ \ {*}} |
868 In this example, Master configure heartbeat producer time |
859 |
|
860 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
861 |
|
862 \texttt{{*} \ \ \ Slave: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
863 |
|
864 \texttt{{*} \ \ \ \ -s : bus name {[}{\textquotedbl}0{\textquotedbl}] |
|
865 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
866 |
|
867 \texttt{{*} \ \ \ \ -S : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) |
|
868 \ {*}} |
|
869 |
|
870 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
871 |
|
872 \texttt{{*} \ \ \ Master: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
873 |
|
874 \texttt{{*} \ \ \ \ -m : bus name {[}{\textquotedbl}1{\textquotedbl}] |
|
875 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
876 |
|
877 \texttt{{*} \ \ \ \ -M : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) |
|
878 \ {*}} |
|
879 |
|
880 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
881 |
|
882 \texttt{{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}} |
|
883 |
|
884 \bigskip{} |
|
885 |
|
886 |
|
887 \textsf{Notes for Concise DCF :} |
|
888 |
|
889 \bigskip{} |
|
890 |
|
891 |
|
892 \textsf{In this example, Master configure \ heartbeat producer time |
|
893 at 1000 ms for slave node -id 0x02 by concise DCF according DS -302 |
869 at 1000 ms for slave node -id 0x02 by concise DCF according DS -302 |
894 profile.} |
870 profile. |
895 |
871 |
896 \textsf{Index 0x1F22 , sub -index 0x00 of the master OD, correspond |
872 Index 0x1F22, sub-index 0x00 of the master OD, correspond |
897 to the number of entries. This equal to the maximum possible nodeId |
873 to the number of entries. This equal to the maximum possible nodeId |
898 (127). Each sub -index points to the Node -ID of the device, to which |
874 (127). Each sub -index points to the Node -ID of the device, to which |
899 the configuration belongs.} |
875 the configuration belongs. |
900 |
876 |
901 \bigskip{} |
877 To add more parameters configurations to the slave, the value |
902 |
|
903 |
|
904 \textsf{To add more parameters configurations to the slave, the value |
|
905 at sub -index 0x02 must be a binary stream (little -endian) following |
878 at sub -index 0x02 must be a binary stream (little -endian) following |
906 this structure :}\\ |
879 this structure : |
907 \textsf{ \{ (UNS32) nb of entries}\\ |
880 |
908 \textsf{ (UNS16) index parameter 1}\\ |
881 |
909 \textsf{ (UNS8) sub -index parameter 1}\\ |
882 \begin{verbatim} |
910 \textsf{ (UNS32) size data parameter 1}\\ |
883 |
911 \textsf{ (DOMAIN) data parameter 1}\\ |
884 (UNS32) nb of entries |
912 \textsf{ (UNS16) index parameter 2}\\ |
885 (UNS16) index parameter 1 |
913 \textsf{ (UNS8) sub -index parameter 2}\\ |
886 (UNS8) sub -index parameter 1 |
914 \textsf{ (UNS32) size data parameter 2}\\ |
887 (UNS32) size data parameter 1 |
915 \textsf{ (DOMAIN) data parameter 2}\\ |
888 (DOMAIN) data parameter 1 |
916 \textsf{ \ \ \ \ \ ....}\\ |
889 (UNS16) index parameter 2 |
917 \textsf{ (UNS16) index parameter n}\\ |
890 (UNS8) sub -index parameter 2 |
918 \textsf{ (UNS8) sub -index parameter n}\\ |
891 (UNS32) size data parameter 2 |
919 \textsf{ (UNS32) size data parameter n}\\ |
892 (DOMAIN) data parameter 2 |
920 \textsf{ (DOMAIN) data parameter n}\\ |
893 .... |
921 \textsf{ \}} |
894 (UNS16) index parameter n |
922 |
895 (UNS8) sub -index parameter n |
923 \textsf{So the binary value stream to configure heartbeat producer |
896 (UNS32) size data parameter n |
924 time must be :}\\ |
897 (DOMAIN) data parameter n |
925 \textsf{ 0100000017100002000000e803} |
898 |
926 |
899 \end{verbatim} |
927 \textsf{The slave node is configured just before the Master entering |
900 |
928 in Pre\_operational state.} |
901 |
|
902 So the binary value stream to configure heartbeat producer |
|
903 time must be : |
|
904 |
|
905 |
|
906 \begin{verbatim} |
|
907 0100000017100002000000e803 |
|
908 \end{verbatim} |
|
909 |
|
910 |
|
911 The slave node is configured just before the Master entering |
|
912 in Pre\_operational state. |
929 |
913 |
930 |
914 |
931 \subsection{gene\_SYNC\_HCS12 :} |
915 \subsection{gene\_SYNC\_HCS12 :} |
932 |
916 |
933 This is a simple \canopen node that only send cyclic SYNC message. |
917 This is a simple \canopen node that only send cyclic SYNC message. |
949 console named 'canf\_ktest\_console'. The module is dependent on a |
933 console named 'canf\_ktest\_console'. The module is dependent on a |
950 another separate module 'canfestival.ko' implementing CanOpen stack |
934 another separate module 'canfestival.ko' implementing CanOpen stack |
951 which exports requisite functions. Canfestival.ko module is then dependent |
935 which exports requisite functions. Canfestival.ko module is then dependent |
952 on CAN card driver module, by default CAN virtual driver will be loaded. |
936 on CAN card driver module, by default CAN virtual driver will be loaded. |
953 After installing modules (make install), all dependencies are solved |
937 After installing modules (make install), all dependencies are solved |
954 automatically by kernel. To run the example type: \texttt{sh run.sh} |
938 automatically by kernel. To run the example type: |
|
939 \begin{verbatim} |
|
940 sh run.sh |
|
941 \end{verbatim} |
955 It will insert required modules, start console, and after quitting |
942 It will insert required modules, start console, and after quitting |
956 console it'll remove modules from kernel. |
943 console it'll remove modules from kernel. |
957 |
944 |
958 \bigskip{} |
945 \bigskip{} |
959 |
946 |
960 |
947 |
961 |
948 |
962 \subsection{TestMasterMicroMod } |
949 \subsection{TestMasterMicroMod } |
963 |
950 |
964 \texttt{{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}} |
951 |
965 |
952 |
966 \texttt{{*} \ TestMasterMicroMod \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
953 \begin{verbatim} |
967 |
954 ************************************************************** |
968 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
955 * TestMasterMicroMod * |
969 |
956 * * |
970 \texttt{{*} \ A simple example for PC. \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
957 * A simple example for PC. * |
971 |
958 * A CanOpen master that control a MicroMod module: * |
972 \texttt{{*} \ A \canopen master that control a MicroMod module: \ \ \ \ \ \ \ \ \ {*}} |
959 * - setup module TPDO 1 transmit type * |
973 |
960 * - setup module RPDO 1 transmit type * |
974 \texttt{{*} \ - setup module TPDO 1 transmit type \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
961 * - setup module hearbeatbeat period * |
975 |
962 * - disable others TPDOs * |
976 \texttt{{*} \ - setup module RPDO 1 transmit type \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
963 * - set state to operational * |
977 |
964 * - send periodic SYNC * |
978 \texttt{{*} \ - setup module hearbeatbeat period \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
965 * - send periodic RPDO 1 to Micromod (digital output) * |
979 |
966 * - listen Micromod's TPDO 1 (digital input) * |
980 \texttt{{*} \ - disable others TPDOs \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
967 * - Mapping RPDO 1 bit per bit (digital input) * |
981 |
968 * * |
982 \texttt{{*} \ - set state to operational \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
969 * Usage: * |
983 |
970 * ./TestMasterMicroMod [OPTIONS] * |
984 \texttt{{*} \ - send periodic SYNC \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
971 * * |
985 |
972 * OPTIONS: * |
986 \texttt{{*} \ - send periodic RPDO 1 to Micromod (digital output) |
973 * -l : Can library ["libcanfestival_can_virtual.so"] * |
987 \ \ \ \ \ \ {*}} |
974 * * |
988 |
975 * Slave: * |
989 \texttt{{*} \ - listen Micromod{\textquotesingle}s TPDO 1 (digital |
976 * -i : Slave Node id format [0x01 , 0x7F] * |
990 input) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
977 * * |
991 |
978 * Master: * |
992 \texttt{{*} \ - Mapping RPDO 1 bit per bit (digital input) \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
979 * -m : bus name ["1"] * |
993 |
980 * -M : 1M,500K,250K,125K,100K,50K,20K,10K * |
994 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
981 * * |
995 |
982 ************************************************************** |
996 \texttt{{*} \ \ Usage: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
983 \end{verbatim} |
997 |
|
998 \texttt{{*} \ \ ./TestMasterMicroMod \ {[}OPTIONS] \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
999 |
|
1000 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1001 |
|
1002 \texttt{{*} \ \ OPTIONS: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1003 |
|
1004 \texttt{{*} \ \ \ \ -l : Can library {[}{\textquotedbl}libcanfestival\_can\_virtual.so{\textquotedbl}] |
|
1005 \ \ \ \ {*}} |
|
1006 |
|
1007 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1008 |
|
1009 \texttt{{*} \ \ \ Slave: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1010 |
|
1011 \texttt{{*} \ \ \ \ -i : Slave Node id format {[}0x01 , 0x7F] |
|
1012 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1013 |
|
1014 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1015 |
|
1016 \texttt{{*} \ \ \ Master: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1017 |
|
1018 \texttt{{*} \ \ \ \ -m : bus name {[}{\textquotedbl}1{\textquotedbl}] |
|
1019 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1020 |
|
1021 \texttt{{*} \ \ \ \ -M : 1M,500K,250K,125K,100K,50K,20K,10K \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1022 |
|
1023 \texttt{{*} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}} |
|
1024 |
|
1025 \texttt{{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}} |
|
1026 |
984 |
1027 |
985 |
1028 \section{Developing a new node} |
986 \section{Developing a new node} |
1029 |
987 |
1030 Using provided examples as a base for your new node is generally a |
988 Using provided examples as a base for your new node is generally a |
1318 |
1279 |
1319 |
1280 |
1320 \paragraph{Interrupt functions} |
1281 \paragraph{Interrupt functions} |
1321 |
1282 |
1322 |
1283 |
1323 \subparagraph{Code for GCC:} |
1284 \subparagraph{Code for GCC: |
1324 |
1285 } |
1325 \texttt{// prototype}~\\ |
1286 |
1326 \texttt{ void \_\_attribute\_\_((interrupt))timer3Hdl(void):}~\\ |
1287 |
1327 \texttt{ // function}~\\ |
1288 \begin{verbatim} |
1328 \texttt{ void \_\_attribute\_\_((interrupt))timer3Hdl(void)\{...\}} |
1289 // prototype |
|
1290 void __attribute__((interrupt))timer3Hdl(void): |
|
1291 // function |
|
1292 void __attribute__((interrupt))timer3Hdl(void){...} |
|
1293 \end{verbatim} |
|
1294 |
|
1295 |
|
1296 \subparagraph{Code for CodeWarrior |
|
1297 } |
|
1298 |
|
1299 |
|
1300 \begin{verbatim} |
|
1301 // protoype |
|
1302 void interrupt timer3Hdl(void); |
|
1303 // function |
|
1304 pragma CODE_SEG__NEAR_SEG_NON_BANKED |
|
1305 void interrupt timer3Hdl(void) |
|
1306 {...} |
|
1307 pragma CODE_SEG_DEFAULT\end{verbatim} |
|
1308 |
|
1309 |
|
1310 \paragraph{Interrupt lock, unlock |
|
1311 } |
|
1312 |
|
1313 |
|
1314 \subparagraph{Code for GCC |
|
1315 } |
|
1316 |
|
1317 |
|
1318 \begin{verbatim} |
|
1319 void unlock (void) |
|
1320 { |
|
1321 __asm__ __volatile__("cli"); |
|
1322 } |
|
1323 void lock (void) |
|
1324 { |
|
1325 unsigned short mask; |
|
1326 __asm__ __volatile__("tpa\n\tsei":"=d"(mask)); |
|
1327 } |
|
1328 \end{verbatim} |
1329 |
1329 |
1330 |
1330 |
1331 \subparagraph{Code for CodeWarrior} |
1331 \subparagraph{Code for CodeWarrior} |
1332 |
1332 |
1333 \texttt{// protoype}~\\ |
1333 |
1334 \texttt{ void interrupt timer3Hdl(void);}~\\ |
1334 \begin{verbatim} |
1335 \texttt{ // function}~\\ |
1335 void unlock (void) |
1336 \texttt{ pragma CODE\_SEG\_\_NEAR\_SEG\_NON\_BANKED}~\\ |
1336 { |
1337 \texttt{ void interrupt timer3Hdl(void)}~\\ |
1337 __asm("cli"); |
1338 \texttt{ \{...\}}~\\ |
1338 } |
1339 \texttt{ pragma CODE\_SEG\_DEFAULT} |
1339 void lock (void) |
1340 |
1340 { |
1341 |
1341 unsigned short mask; |
1342 \paragraph{Interrupt lock, unlock} |
1342 __asm |
|
1343 { |
|
1344 tpa:tsei:"=d"(mask); |
|
1345 } |
|
1346 } |
|
1347 \end{verbatim} |
|
1348 |
|
1349 |
|
1350 \paragraph{Initialize function} |
1343 |
1351 |
1344 |
1352 |
1345 \subparagraph{Code for GCC} |
1353 \subparagraph{Code for GCC} |
1346 |
1354 |
1347 \texttt{void unlock (void)}~\\ |
1355 |
1348 \texttt{ \ }~\\ |
1356 \begin{verbatim} |
1349 \texttt{ \ \_\_asm\_\_ \_\_volatile\_\_({\textquotedbl}cli{\textquotedbl});}~\\ |
1357 void initCanHCS12 (void) |
1350 \texttt{ \}}~\\ |
1358 { |
1351 \texttt{ void lock (void)}~\\ |
1359 //Init the HCS12 microcontroler for CanOpen |
1352 \texttt{ \ }~\\ |
1360 initHCS12(); |
1353 \texttt{ \ unsigned short mask;}~\\ |
1361 // Init the HCS12 CAN driver |
1354 \texttt{ \ \_\_asm\_\_ \_\_volatile\_\_({\textquotedbl}tpa{\textbackslash{} |
1362 const canBusInit bi0 = { |
1355 }n{\textbackslash{} }tsei{\textquotedbl}:{\textquotedbl}=d{\textquotedbl}(mask));}~\\ |
1363 0, /* no low power */ |
1356 \texttt{ \}} |
1364 0, /* no time stamp */ |
1357 |
1365 1, /* enable MSCAN */ |
1358 |
1366 0, /* clock source : oscillator (In fact, it is not used) */ |
1359 \subparagraph{Code for CodeWarrior} |
1367 0, /* no loop back */ |
1360 |
1368 0, /* no listen only */ |
1361 \texttt{void unlock (void)}~\\ |
1369 0, /* no low pass filter for wk up */ |
1362 \texttt{ \ }~\\ |
1370 CAN_Baudrates[CAN_BAUDRATE_250K], |
1363 \texttt{ \ \_\_asm({\textquotedbl}cli{\textquotedbl});}~\\ |
1371 { |
1364 \texttt{ \}}~\\ |
1372 0x00, /* Filter on 16 bits. |
1365 \texttt{ void lock (void)}~\\ |
1373 See Motorola Block Guide V02.14 fig 4-3 */ |
1366 \texttt{ \ }~\\ |
1374 0x00, 0xFF, /* filter 0 hight accept all msg */ |
1367 \texttt{ \ unsigned short mask;}~\\ |
1375 0x00, 0xFF, /* filter 0 low accept all msg */ |
1368 \texttt{ \ \_\_asm}~\\ |
1376 0x00, 0xFF, /* filter 1 hight filter all of msg */ |
1369 \texttt{ \ }~\\ |
1377 0x00, 0xFF, /* filter 1 low filter all of msg */ |
1370 \texttt{ \ tpa:tsei:{\textquotedbl}=d{\textquotedbl}(mask);}~\\ |
1378 0x00, 0xFF, /* filter 2 hight filter most of msg */ |
1371 \texttt{ \}}~\\ |
1379 0x00, 0xFF, /* filter 2 low filter most of msg */ |
1372 \texttt{ \}} |
1380 0x00, 0xFF, /* filter 3 hight filter most of msg */ |
1373 |
1381 0x00, 0xFF, /* filter 3 low filter most of msg */ |
1374 |
1382 } |
1375 \paragraph{Initialize function} |
1383 }; |
1376 |
1384 \end{verbatim} |
1377 |
1385 |
1378 \subparagraph{Code for GCC} |
1386 |
1379 |
1387 \subparagraph{Code for CodeWarrior |
1380 \texttt{void initCanHCS12 (void)}~\\ |
1388 } |
1381 \texttt{ \{ \ }~\\ |
1389 |
1382 \texttt{ \ //Init the HCS12 microcontroler for \canopen} ~\\ |
1390 |
1383 \texttt{ \ initHCS12();}~\\ |
1391 \begin{verbatim} |
1384 \texttt{ \ \ // Init the HCS12 \ CAN driver}~\\ |
1392 void initCanHCS12 (void) |
1385 \texttt{ \ const canBusInit bi0 = \ }~\\ |
1393 { |
1386 \texttt{ \ \ \ 0, \ \ \ /{*} no low power \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/} |
1394 //Init the HCS12 microcontroler for CanOpen |
1387 ~\\ |
1395 initHCS12(); |
1388 \texttt{ \ \ \ 0, \ \ \ /{*} no time stamp \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ |
1396 // Init the HCS12 CAN driver |
1389 \texttt{ \ \ \ 1, \ \ \ /{*} enable MSCAN \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ |
1397 const canBusInit bi0 = { |
1390 \texttt{ \ \ \ 0, \ \ \ /{*} clock source : oscillator (In |
1398 0, /* no low power */ |
1391 fact, it is not used) \ \ {*}/}~\\ |
1399 0, /* no time stamp */ |
1392 \texttt{ \ \ \ 0, \ \ \ /{*} no loop back \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ |
1400 1, /* enable MSCAN */ |
1393 \texttt{ \ \ \ 0, \ \ \ /{*} no listen only \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ |
1401 0, /* clock source : oscillator (In fact, it is not used) */ |
1394 \texttt{ \ \ \ 0, \ \ \ /{*} no low pass filter for wk up {*}/}~\\ |
1402 0, /* no loop back */ |
1395 \texttt{ \ CAN\_Baudrates{[}CAN\_BAUDRATE\_250K],}~\\ |
1403 0, /* no listen only */ |
1396 \texttt{ \ \ \ \ }~\\ |
1404 0, /* no low pass filter for wk up */ |
1397 \texttt{ \ \ \ \ \ 0x00, \ \ \ /{*} Filter on 16 bits.}~\\ |
1405 { |
1398 \texttt{ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ See Motorola |
1406 1, /* clksrc */ |
1399 Block Guide V02.14 fig 4 -3 {*}/}~\\ |
1407 3, /* brp */ |
1400 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 0 hight accept all |
1408 0, /* sjw */ |
1401 msg \ \ \ \ \ {*}/}~\\ |
1409 0, /* samp */ |
1402 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 0 low accept all |
1410 1, /* tseg2 */ |
1403 msg \ \ \ \ \ \ \ {*}/}~\\ |
1411 12,/* tseg1 */ |
1404 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 1 hight filter all |
1412 }, |
1405 of \ msg \ {*}/}~\\ |
1413 { |
1406 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 1 low filter all |
1414 0x00, /* Filter on 16 bits. |
1407 of \ msg \ \ \ {*}/}~\\ |
1415 See Motorola Block Guide V02.14 fig 4-3 */ |
1408 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 2 hight filter most |
1416 0x00, 0xFF, /* filter 0 hight accept all msg */ |
1409 of \ msg {*}/}~\\ |
1417 0x00, 0xFF, /* filter 0 low accept all msg */ |
1410 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 2 low filter most |
1418 0x00, 0xFF, /* filter 1 hight filter all of msg */ |
1411 of \ msg \ \ {*}/}~\\ |
1419 0x00, 0xFF, /* filter 1 low filter all of msg */ |
1412 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 3 hight filter most |
1420 0x00, 0xFF, /* filter 2 hight filter most of msg */ |
1413 of \ msg {*}/}~\\ |
1421 0x00, 0xFF, /* filter 2 low filter most of msg */ |
1414 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 3 low filter most |
1422 0x00, 0xFF, /* filter 3 hight filter most of msg */ |
1415 of \ msg \ \ {*}/}~\\ |
1423 0x00, 0xFF, /* filter 3 low filter most of msg */ |
1416 \texttt{ \ \ \ \}}~\\ |
1424 } |
1417 \texttt{ \ \};} |
1425 }; |
1418 |
1426 \end{verbatim} |
1419 |
|
1420 \subparagraph{Code for CodeWarrior} |
|
1421 |
|
1422 \texttt{void initCanHCS12 (void)}~\\ |
|
1423 \texttt{ \{ \ }~\\ |
|
1424 \texttt{ \ //Init the HCS12 microcontroler for \canopen} ~\\ |
|
1425 \texttt{ \ initHCS12();}~\\ |
|
1426 \texttt{ \ \ // Init the HCS12 \ CAN driver}~\\ |
|
1427 \texttt{ \ const canBusInit bi0 = \ }~\\ |
|
1428 \texttt{ \ \ \ 0, \ \ \ /{*} no low power \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/} |
|
1429 ~\\ |
|
1430 \texttt{ \ \ \ 0, \ \ \ /{*} no time stamp \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ |
|
1431 \texttt{ \ \ \ 1, \ \ \ /{*} enable MSCAN \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ |
|
1432 \texttt{ \ \ \ 0, \ \ \ /{*} clock source : oscillator (In |
|
1433 fact, it is not used) \ \ {*}/}~\\ |
|
1434 \texttt{ \ \ \ 0, \ \ \ /{*} no loop back \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ |
|
1435 \texttt{ \ \ \ 0, \ \ \ /{*} no listen only \ \ \ \ \ \ \ \ \ \ \ \ \ \ {*}/}~\\ |
|
1436 \texttt{ \ \ \ 0, \ \ \ /{*} no low pass filter for wk up {*}/}~\\ |
|
1437 \texttt{ \ \ \ \ }~\\ |
|
1438 \texttt{ \ \ \ \ 1, /{*} clksrc {*}/}~\\ |
|
1439 \texttt{ \ \ \ \ 3, /{*} brp \ \ \ {*}/}~\\ |
|
1440 \texttt{ \ \ \ \ 0, /{*} sjw \ \ \ {*}/}~\\ |
|
1441 \texttt{ \ \ \ \ 0, /{*} samp \ \ {*}/}~\\ |
|
1442 \texttt{ \ \ \ \ 1, /{*} tseg2 \ {*}/}~\\ |
|
1443 \texttt{ \ \ \ \ 12,/{*} tseg1 \ {*}/}~\\ |
|
1444 \texttt{ \ \ \ \},}~\\ |
|
1445 \texttt{ \ \ \ \ }~\\ |
|
1446 \texttt{ \ \ \ \ \ 0x00, \ \ \ /{*} Filter on 16 bits.}~\\ |
|
1447 \texttt{ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ See Motorola |
|
1448 Block Guide V02.14 fig 4 -3 {*}/}~\\ |
|
1449 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 0 hight accept all |
|
1450 msg \ \ \ \ \ {*}/}~\\ |
|
1451 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 0 low accept all |
|
1452 msg \ \ \ \ \ \ \ {*}/}~\\ |
|
1453 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 1 hight filter all |
|
1454 of \ msg \ {*}/}~\\ |
|
1455 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 1 low filter all |
|
1456 of \ msg \ \ \ {*}/}~\\ |
|
1457 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 2 hight filter most |
|
1458 of \ msg {*}/}~\\ |
|
1459 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 2 low filter most |
|
1460 of \ msg \ \ {*}/}~\\ |
|
1461 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 3 hight filter most |
|
1462 of \ msg {*}/}~\\ |
|
1463 \texttt{ \ \ \ \ \ 0x00, 0xFF, /{*} filter 3 low filter most |
|
1464 of \ msg \ \ {*}/}~\\ |
|
1465 \texttt{ \ \ \ \}}~\\ |
|
1466 \texttt{ \ \};} |
|
1467 |
1427 |
1468 |
1428 |
1469 \subsubsection{Does the code works in banked memory ?} |
1429 \subsubsection{Does the code works in banked memory ?} |
1470 |
1430 |
1471 No. Today it seems that the port of gcc is bogged for using the banked |
1431 No. Today it seems that the port of gcc is bogged for using the banked |
1610 \subsection{License} |
1571 \subsection{License} |
1611 |
1572 |
1612 All the project is licensed with LGPL. This mean you can link CanFestival |
1573 All the project is licensed with LGPL. This mean you can link CanFestival |
1613 with any code without being obliged to publish it. |
1574 with any code without being obliged to publish it. |
1614 |
1575 |
1615 \texttt{\#This file is part of CanFestival, a library implementing |
1576 |
1616 \canopen Stack.} |
1577 \begin{verbatim} |
1617 |
1578 #This file is part of CanFestival, a library implementing CanOpen Stack. |
1618 \texttt{\#} |
1579 # |
1619 |
1580 #Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD |
1620 \texttt{\#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent |
1581 # |
1621 BESSARD} |
1582 #See COPYING file for copyrights details. |
1622 |
1583 # |
1623 \texttt{\#} |
1584 #This library is free software; you can redistribute it and/or |
1624 |
1585 #modify it under the terms of the GNU Lesser General Public |
1625 \texttt{\#See COPYING file for copyrights details.} |
1586 #License as published by the Free Software Foundation; either |
1626 |
1587 #version 2.1 of the License, or (at your option) any later version. |
1627 \texttt{\#} |
1588 # |
1628 |
1589 #This library is distributed in the hope that it will be useful, |
1629 \texttt{\#This library is free software; you can redistribute it and/or} |
1590 #but WITHOUT ANY WARRANTY; without even the implied warranty of |
1630 |
1591 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1631 \texttt{\#modify it under the terms of the GNU Lesser General Public} |
1592 #Lesser General Public License for more details. |
1632 |
1593 # |
1633 \texttt{\#License as published by the Free Software Foundation; either} |
1594 #You should have received a copy of the GNU Lesser General Public |
1634 |
1595 #License along with this library; if not, write to the Free Software |
1635 \texttt{\#version 2.1 of the License, or (at your option) any later |
1596 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
1636 version.} |
1597 \end{verbatim} |
1637 |
1598 |
1638 \texttt{\#} |
1599 |
1639 |
|
1640 \texttt{\#This library is distributed in the hope that it will be |
|
1641 useful,} |
|
1642 |
|
1643 \texttt{\#but WITHOUT ANY WARRANTY; without even the implied warranty |
|
1644 of} |
|
1645 |
|
1646 \texttt{\#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
|
1647 the GNU} |
|
1648 |
|
1649 \texttt{\#Lesser General Public License for more details.} |
|
1650 |
|
1651 \texttt{\#} |
|
1652 |
|
1653 \texttt{\#You should have received a copy of the GNU Lesser General |
|
1654 Public} |
|
1655 |
|
1656 \texttt{\#License along with this library; if not, write to the Free |
|
1657 Software} |
|
1658 |
|
1659 \texttt{\#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
1660 \ 02111 -1307 \ USA} |
|
1661 \end{document} |
1600 \end{document} |