1 \newcommand{\superscript}[1]{\ensuremath{^{\textrm{\small#1}}}}
2 \newcommand{\subscript}[1]{\ensuremath{_{\textrm{\small#1}}}}
4 \documentclass{scrreprt}
6 \usepackage{graphicx} % images and graphics
7 \usepackage{paralist} % needed for compact lists
8 \usepackage[normalem]{ulem} % needed by strike
9 \usepackage{listings} % required for code blocks
10 \usepackage[urlcolor=blue,colorlinks=true,hyperfootnotes=false]{hyperref} % links
11 \usepackage[utf8x]{inputenc} % char encoding
12 \usepackage[bottom]{footmisc} % footnotes
13 \usepackage{todonotes}
16 \usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry}
17 \usepackage{float} % To fix images position
19 % Prettify code documentation
21 \definecolor{gray97}{gray}{.97}
22 \definecolor{gray75}{gray}{.75}
23 \definecolor{gray45}{gray}{.45}
28 framexbottommargin=3pt,
29 framexleftmargin=0.4cm,
32 backgroundcolor=\color{gray97},
33 rulesepcolor=\color{black},
35 stringstyle=\ttfamily,
36 showstringspaces = false,
37 basicstyle=\small\ttfamily,
38 commentstyle=\color{gray45},
39 keywordstyle=\bfseries,
44 numberfirstline = false,
50 \linespread{1.15} % Lines spacing
51 \setlength{\plitemsep}{0.5\baselineskip} % List items spacing
52 \definecolor{deepblue}{RGB}{0,0,61}
53 \hypersetup{linkcolor=deepblue,}
55 % Table of content depth
56 \setcounter{tocdepth}{4}
60 \usepackage{pdflscape}
63 \usepackage{changepage}
67 % \renewcommand{\familydefault}{\sfdefault}
75 \newcommand{\repo}{$\langle$repo$\rangle$}
80 \newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
85 % Upper part of the page
86 \includegraphics[width=0.70\textwidth]{images/logos.png}\\[1cm]
87 \textsc{\LARGE Costa Rica Institute of Technology}\\[0.5cm]
88 \textsc{\LARGE Czech Technical University in Prague}\\[1.5cm]
93 { \huge \bfseries Code generation for automotive rapid prototyping platform using Matlab/Simulink}\\[0.4cm]
99 Carlos \textsc{Jenkins}\\
100 Michal \textsc{Sojka}\\[\baselineskip]
122 \addtolength{\parskip}{\baselineskip} % Paragraph spacing
124 \chapter{Introduction}
125 \label{chap-introduction}
127 This text is a documentation for a Rapid Prototyping Platform (RPP) project. It may serve as a
128 guideline for development tools installation, Simulink Coder configuration, creation of new models as
129 well as downloading the resulting firmware to the hardware. It can also be used as a reference for a
130 testing tool, Matlab Simulink blocks and RPP Matlab Simulink Code generator. The document also
131 provides an overall description of the hardware design and architecture of its control software.
134 \label{sec-background}
136 The Rapid Prototyping Platform is an ECU (Electronic Control Unit) designed for use in Automotive, thus requirements for Automotive communication interfaces, durable IO ports and analog-digital converters were applied.
138 The ECU is controlled by TMS570LS5137ZWT MCU, which is an ARM Cortex R4 based microcontroller developed by Texas Instruments. This MCU contains several protective mechanisms (two cores in lockstep, error correction mechanisms for SRAM and Flash memory, voltage monitoring...) to fulfill the requirements for safety critical applications. TODO: add ref to Ti Reference
140 Besides the right MCU, an operating system is necessary for nontrivial applications. The RPP board runs FreeRTOS, which is an opensource operating system with real-time kernel, aimed not only on embedded systems. The FreeRTOS provides an API for creation and managing multiple tasks, scheduler, memory manager, semaphores, queues, mutexes, timers and lots of other features wich can be used in the applications. TODO: add ref to FreeRTOS pages
142 Even with the operating system it is quite hard and non-intuitive to control the hardware directly. That is the point when abstraction comes in the play. RPP software is made of several layers implementing from the bottom to the top driver to the hardware itself, hardware abstraction for common functionality on different hardware and final API which is easy for the user to use. The whole thing, the operating system and the control software, can be compiled as a library and easily used in any project. More details about the library can be found in Chapter \ref{chap-c-support-library}.
144 Because humans make mistakes and in safety critical applications any mistake can cause damage, looses of money or in the worst case even death of other people, the room for making mistakes has to be as small as possible. An approach called Model-based development has been introduced. In Simulink the application is developed as a model made of blocks connected together. Every block implements some functionality. For example one block receives a voltage from an analog-digital converter, provides the value as an input to another block which implements some clever algorithm and the product is passed as an input to another block, which sends the value as a CAN message to some other MCU. The final model can be simulated and tested even before the real hardware exists. Finally a C code is generated from the model by a Simulink Code Generator. The code can be compiled by the MCU compatible compiler and downloaded to the MCU Flash memory on the device. Because every block and code generated from the block has to pass a series of tests during their development, the room for making mistakes during the application development has significantly decreased and developers can focus on the functionality instead of the hardware and control software implementation. More information about Code generation can be found in Chapter \ref{chap-simulink-coder-target}.
146 \section{Software architecture}
147 \label{sec-software-architecture}
148 The RPP control software, also called RPP library, is structured into 5 layers, described in Figure \ref{fig-layers}, with the following guidelines:
151 \item Top-down dependency only. No lower layer depends on anything from upper layers.
152 \item 1-1 layer dependency only. The top layer depends exclusively on the bottom layer, not on any
153 lower level layer (except for a couple of exceptions).
154 \item Each layer should provide a unified layer interface (\textsc{rpp.h}, \textsc{drv.h}, \textsc{hal.h}, \textsc{sys.h}
155 and \textsc{os.h}), so top layers depends on that layer interface and not on individual elements from
162 \includegraphics[width=250px]{images/layers.pdf}
163 \caption{The RPP library layers.}
168 As a consequence of this division the source code files and interface files are placed in
169 private directories like \textsc{drv/din.h}. With this organization user applications only needs
170 to include the top layer interface files (for example \textsc{rpp/rpp\_can.h}) to be able to use the selected library API.
172 The rest of the section provides basic description of each layer.
174 \subsection{Operating System layer}
175 \label{sec-operating-system-layer}
176 This is an operating system interchangeable layer, containing the FreeRTOS source files. The system can be easily replaced by another version thanks to this layer. For example it is possible to compile the library for Linux (using POSIX version of the FreeRTOS), which can be desirable for some testing. The source files can be found in \textsc{$\langle$rpp\_lib\_root$\rangle$/os} folder.
178 Following FreeRTOS versions are distributed:
180 \item[6.0.4\_posix] POSIX version, usable for compilation of the library for Linux system.
181 \item[7.0.2] Prefered version of the FreeRTOS, distributed by the Texas Instruments. This version is in use in the current version of the library.
182 \item[7.4.0] Newest version distributed by the Texas Instruments.
183 \item[7.4.2] Newer version available from FreeRTOS pages. Slightly modified to run on TMS570 MCU.
186 \subsection{System Layer}
187 \label{sec-system-layer}
188 This layer contains system files with data types definitions, clock definitions, interrupts mapping, MCU startup sequence, MCU selftests, and other low level code for controlling some of the MCU peripherals. The source files can be found in \textsc{$\langle$rpp\_lib\_root$\rangle$/rpp/src/sys}, the header files can be found in \textsc{$\langle$rpp\_lib\_root$\rangle$/rpp/include/sys} folder.
190 \subsection{HAL abstraction layer}
191 \label{sec-hal-abstraction-layer}
192 Hardware Abstraction Layer (HAL) creates an abstraction over the real hardware. For example imagine an IO port with 8 pins. First four pins are connected to the MCU directly to GPIO pins, another four pins are connected to an external integrated circuit, communicating with the MCU via SPI. It would be annoying to have to remember which group is which and to have two sets of control functions for one peripheral. This layer maps every pin of the port to a control function from the System Layer, groups the pins together, names them in a unified style and provides common read, write and configure functions.
194 As a result, the higher layers do not have to know anything about the wiring of the peripherals, they can just call read, write or configure function with a pin name as a parameter and the HAL handles all the details.
196 The source files can be found in \textsc{$\langle$rpp\_lib\_root$\rangle$/rpp/src/hal} and the header files can be found in \textsc{$\langle$rpp\_lib\_root$\rangle$/rpp/include/hal} folder.
198 \subsection{Drivers layer}
199 \label{sec-drivers-layer}
200 The Drivers layer contains code for controlling the RPP peripherals. The layer benefits from the lower layers thus it is not too low level, but still there are some peripherals like ADC or H-bridge, which needs some special procedure for initialization and running, that would not be very intuitive for the user. For example the H-bridge needs a watchdog reset task to be started before the bridge is enabled.
202 The source files can be found in \textsc{$\langle$rpp\_lib\_root$\rangle$/rpp/src/drv} and the header files can be found in \textsc{$\langle$rpp\_lib\_root$\rangle$/rpp/include/drv} folder.
204 \subsection{RPP Layer}
205 \label{sec-rpp-layer}
206 The RPP Layer is the highest layer of the control software. This layer provides the easiest set of functions for every peripheral and requires only basic knowledge about them. For example the H-bridge again from the previous section. The user can call just \textsc{rpp\_hbr\_init()} function to enable the H-bridge and the function calls a sequence of Drivers layer functions to start the Watchdog and configure the peripheral.
208 The source files can be found in \textsc{$\langle$rpp\_lib\_root$\rangle$/rpp/src/rpp} and the header files can be found in \textsc{$\langle$rpp\_lib\_root$\rangle$/rpp/include/rpp}.
210 \section{Hardware description}
211 \label{sec-hardware-description}
213 This section provides reference documentation for the RPP board:
215 %%TODO: operating conditions as a reference to the Ti documentation
218 \item Layout description.
219 \item Connectors pinout.
220 \item Modules capabilities and features.
223 \subsection{Layout description}
224 \label{sec-layout-description}
225 The RPP board has been designed with strict Automotive standards and safety in mind. The components and pins are placed in sections and wires are routed in a way to avoid any significant electromagnetic interference.
227 As can be seen on Figure \ref{board_photo}, the high power output logic is placed in the top left corner, the low power output logic is placed on the bottom left corner, while the communication logic is placed on the top right corner. In the middle there is the only one button available, the reset button and below it is placed the TMS570 MCU itself. In the bottom right corner there are components of analog inputs.
229 \begin{figure}[H]\begin{center}
231 \includegraphics[width=300px]{images/board-photo.png}
232 \caption{The RPP board (signal connector missing).}
234 \end{center}\end{figure}
237 \subsection{Connectors pinout}
238 \label{sec-connector-pinout}
239 The pinout of the board, described by the Figure \ref{pinout}, follows the layout described in the previous section. The side connectors for communication (24 pins), signals (56 pins) and power (24 pins) are automotive approved humidity resistant connectors.
241 \advance\leftskip-1cm
243 \includegraphics[width=530px]{images/pinout.pdf}
244 \caption{The RPP connectors pinout.}
248 \subsection{Modules description}
249 \label{sec-modules-description}
250 This section enumerates the capabilities of the hardware modules from Software perspective. The block diagram of the modules can be seen in Figure \ref{blocks}.
255 \includegraphics[width=500px]{images/blocks.pdf}
256 \caption{The RPP layer modules.}
260 \subsubsection{Logic IO}
263 \paragraph{Digital Inputs (DIN)}
264 \label{par-digital-inputs}
266 \item 16 pins available on Signal Connector.
267 \item Pins 8-15 status can be read via GPIO using configurable threshold. \newline{}
268 Pins 8-11 use variable threshold B and pins 12-15 use variable threshold A.
269 \item Variable threshold is a DAC chip MCP4922.
270 \item All pins are read at once via SPI (fixed threshold) using chip MC33972.
271 \item 0-7 are programmable pins and can be set to pull-up or pull-down. 8-15 are pull-down only.
272 \item All pins can be set to be active or tri-stated.
273 \item All pins can be set to trigger interrupt.
274 \item On-line diagnostic of broken wire.
277 \paragraph{Digital Outputs (LOUT)}
278 \label{par-digital-outputs}
280 \item 8 pins available on Signal Connector.
281 \item Pins for logic output only, up to 100mA.
282 \item All pins are set at once using a chip through SPI.
285 \paragraph{Analog Input (ADC)}
286 \label{par-analog-input}
288 \item 12 channels available.
289 \item Differential inputs, thus 24 pins available on Signal Connector.
290 \item Range for 0-20 volts.
291 \item 12 bits resolution.
295 \paragraph{Analog Output (DAC)}
296 \label{par-analog-output}
298 \item 4 pins available on Signal Connector.
299 \item Output range is 0-12 volts.
300 \item Using 2 x MCP4922 DACs controlled using SPI.
301 \item Resolution is 12 bits. But because of amplification and voltage reference not all range is used.
304 \subsubsection{Power Output}
305 \label{sec-power-output}
306 \paragraph{H-Bridge (HBR)}
309 \item 1 port (2 pins) available on Power Connector.
310 \item Communication is done through SPI.
311 \item H-Bridge can be enabled or disabled.
312 \item Current direction can be set.
313 \item PWM control with 1\% resolution change of the duty cycle.
314 \item Port can drive load up to 10A.
317 \paragraph{Power Output (MOUT)}
318 \label{par-power-output}
320 \item 6 pins available on Power Connector.
321 \item Pins can drive a load up to 2A. Push/Pull.
322 \item Pins are set using 6 CPU output GPIOs. Diagnostic are read using 6 externally pulled-up
323 open-drain input GPIOs.
324 \item On-line diagnostics. Driver chip will pull-down the corresponding diagnostic pin on the CPU.
327 \paragraph{High-Power Output (HOUT)}
328 \label{par-high-power-output}
330 \item 6 pins available on Power Connector.
331 \item Pins can be set ON/OFF.
332 \item Pins can drive a load up to 10A with PWM.
333 \item System can read analog values of current flowing (IFBK).
334 \item System can read diagnostics values (DIAG). Detection of a fault condition.
337 \subsubsection{Communication}
338 \label{sec-communication}
339 \paragraph{CAN bus (CAN)}
342 \item 3 ports available (CAN uses differential signaling) thus 6 pins are available on Communication
345 \item Recover from error.
346 \item Detection of network errors.
349 \paragraph{Local Interconnect Network (LIN)}
352 \item 2 ports/pins available on Communication Connector.
353 \item Only first port can be used when using the SCI. Second port is shared with SCI.
356 \paragraph{FlexRay (FR)}
359 \item 2 ports available. FlexRay uses differential signaling thus 4 pins are available on
360 Communication Connector.
363 \paragraph{Serial Comm. Interface (SCI)}
366 \item 1 port available inside the box on SCI connector (4 pins).
367 \item Variable baud rate. Tested on 9600 and 115200.
368 \item RS232 standard compatible.
371 \paragraph{Ethernet (ETH)}
374 \item 1 port available. Standard Ethernet connector available inside box.
377 \subsubsection{Data storage/logging}
378 \label{sec-data-storage}
379 \paragraph{External Memory SD-RAM (SDR)}
380 \label{par-external-memory}
382 \item 64MB (currently installed) external RAM used for logging. Maximal supported capacity is 256MB.
383 \item Memory test routine available with test Software.
386 \paragraph{SD Card (SDC)}
389 \item Standard SD-Card connector or microSD connector available inside box.
390 \item Communication done using SPI.
393 \section{Document structure}
394 \label{sec-document-structure}
395 The general layout of this document is as follows:
397 \chapter{Getting started}
398 \label{chap-getting-started}
400 \section{Software requirements}
401 \label{sec-software-requirements}
402 The RPP software stack was developed to be functional on both platforms Windows and Linux. Despite of older and newer versions of the software and tools might work as well, usage of the following versions is suggested:
404 \subsection{Linux environment}
405 \label{sec-linux-environment}
407 \item Debian based 64b Linux distribution (Debian 7.0 or Ubuntu 14.4 for example).
408 \item Kernel version 3.11.0-12.
409 \item GCC version 4.8.1
410 \item GtkTerm 0.99.7-rc1
411 \item Ti Code Composer Studio 5.5.0.00077
412 \item Matlab 2013b 64b
413 \item Doxygen 1.8.4 (optionaly, see Section \ref{sec-compiling-api-documentation})
414 \item Uncrustify 0.59 (optionally, see Section \ref{sec-compilation}).
417 \subsection{Windows environment}
418 \label{sec-windows-environment}
420 \item Windows 7 Enterprise 64b Service Pack 1.
421 \item C/C++ compiler from Windows SDK
422 \item Bray Terminal v1.9b
423 \item Ti Code Composer Studio 5.5.0.00077
424 \item Matlab 2013b 64b
425 \item Doxygen 1.8.4 (optionaly, see Section \ref{sec-compiling-api-documentation})
426 \item Uncrustify 0.59 (optionally, see Section \ref{sec-compilation}).
429 \section{Software and tools}
430 \label{sec-software-and-tools}
432 \subsection{TI Code Composer Studio}
434 Code Composer Studio (CCS) is the official Integrated Development Environment (IDE) for developing
435 applications for Texas Instruments embedded processors. CCS is multiplatform Software based on
436 Eclipse Open Source IDE.
438 CCS includes Texas Instruments Code Generation Tools (CGT) (compiler, linker, etc). Simulink code
439 generation requires the CGT to be available in the system, and thus, even if no library development
440 will be done or the IDE is not going to be used CCS is still required.
442 %% TODO: Zjistit podminky pro distribuci dokumentu
443 You can find documentation for CGT compiler in \textsc{\repo/ref/armcl.pdf} and for CGT archiver in
444 \textsc{\repo/ref/armar.pdf}.
446 The version used in this project is the 5.5.0.00077.
448 \subsubsection{Installation on Linux}
449 \label{sec-installation-on-linux}
450 Download CCS for Linux from:
453 \url{http://processors.wiki.ti.com/index.php/Category:Code\_Composer\_Studio\_v5}
456 Once downloaded, add executable permission to the installation file and launch the installation by executing it. Installation must be done as root in order to install a driver set.
458 \lstset{language=bash}
460 chmod +x ccs_setup_5.5.0.00077.bin
461 sudo ./ccs_setup_5.5.0.00077.bin
464 After installation the application can be executed with:
466 \lstset{language=bash}
468 cd <ccs>/ccsv5/eclipse/
472 The first launch on 64bits systems might fail. This can happen because CCS5 is 32b application and thus requires 32bits libraries:
474 \lstset{language=bash}
476 sudo apt-get install libgtk2.0-0:i386 libxtst6:i386
479 If the application crashes with a segmentation fault edit file:
481 \lstset{language=bash}
483 nano <ccs>/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_<version>/plugin_customization.ini
486 And change key \textsc{org.eclipse.ui/showIntro} to false.
488 \subsubsection{ Installation on Windows }
489 \label{sec-installation-on-windows}
490 The installation for Windows is more straightforward than the previous procedure for Linux.
492 Download CCS for Windows from:
495 \url{http://processors.wiki.ti.com/index.php/Category:Code\_Composer\_Studio\_v5}
498 Once downloaded run the ccs\_setup\_5.5.0.00077.exe and install the CCS.
500 \subsubsection{ First launch }
501 \label{sec-first-launch}
502 If another licence is not available, choose ``FREE License - for use with XDS100 JTAG Emulators" from the licensing options. Code download for the board is using that particular hardware.
504 \subsection{Matlab/Simulink}
505 \label{sec-matlab-simulink}
506 Matlab Simulink is a set of tools, runtime environment and development environment for Model-Based applications development, simulations and generation code for target platforms.
507 Supported Matlab Simulink version is R2013b for 64 bits Linux and Windows.
509 \subsection{GtkTerm and Bray Terminal}
510 \label{sec-gtkterm-bray-terminal}
511 Most of the interaction with the board is done through a RS-232 serial connection. The terminal Software used for communication is called GtkTerm for Linux and Bray terminal for Windows.
513 To install GtkTerm execute:
515 \lstset{language=bash}
517 sudo apt-get install gtkterm
520 The Bray Terminal does not require any installation and the executable file is available at
523 \url{https://sites.google.com/site/terminalbpp/}
526 \subsection{C Compiler}
527 \label{sec-c-compiler}
528 In order to be able to compile Matlab Simulink blocks S-functions a C language compiler has to be available on the development system.
530 For Linux a GCC 4.8.1 compiler is recommended and can be installed with a command
532 \lstset{language=bash}
534 sudo apt-get install gcc
537 For Windows, the C/C++ compiler is a part of Windows SDK, which installation file is available at
540 \url{http://www.microsoft.com/en-us/download/details.aspx?id=8279}
543 \section{Code Composer Studio usage}
544 \label{sec-code-composerpstudio-usage}
546 \subsection{Opening of existing project}
547 \label{sec-openning-of-existing-project}
548 The project opening procedure is similar to standard Eclipse project opening.
551 \item Launch Code Composer Studio
552 \item Select \textsc{File$\rightarrow$Import}
553 \item In the dialog window select \textsc{Code Composer Studio$\rightarrow$Existing CCS Eclipse project} as an import source as depicted in Figure \ref{fig-import-project}.
554 \item In the next dialog window click on \textsc{Browse} button and find the root directory of the project.
555 \item Select the requested project in the \textsc{Discovered project} section so that the result looks like in Figure \ref{fig-select-project}.
556 \item Click on \textsc{Finish} button.
560 \includegraphics[width=350px]{images/import_project.png}
561 \captionof{figure}{Import project dialog}
562 \label{fig-import-project}
566 \includegraphics[width=350px]{images/select_project.png}
567 \captionof{figure}{Select project dialog}
568 \label{fig-select-project}
571 \subsection{Creating new project}
572 \label{sec-creating-new-project}
573 In \textsc{\repo/rpp/lib/apps/} there are two RPP based
574 applications, \textsc{helloworld} and \textsc{helloworld\_posix}, that are
575 already configured for the RPP Library. It is advised that new applications use this project as a
578 To create a new application copy this directory and rename it. Now open files \textsc{.project},
579 \textsc{.cproject} and \textsc{.ccsproject} (if available) and change any occurrence of the work \textsc{helloworld}
580 with the name of your project. Use lower case ASCII letters and underscores only.
582 \textbf{Steps to configure a new CCS (ARM, using CGT) RPP application:}
585 \item Create a new CCS project. \newline{}
586 \noindent\includegraphics[width=400px]{images/base_1.png}
587 \item Create a normal folder \textsc{include}.
588 \item Create a source folder \textsc{src}.
589 \item Add common \textsc{.gitignore} to the root of that project:
597 \item Add new variable \textsc{RPP\_LIB\_ROOT} and point to this repository branch root.\newline{}
598 \noindent\includegraphics[width=400px]{images/base_2.png}
599 \item Add \textsc{rpp-lib.lib} static library to linker libraries and add \textsc{RPP\_LIB\_ROOT} to the library
600 search path.\newline{}
601 \noindent\includegraphics[width=400px]{images/base_3.png}
603 \item Configure linker to retain \textsc{.intvecs} from RPP static library.\newline{}
604 \noindent\includegraphics[width=350px]{images/base_4.png}
605 \item Configure compiler to include local includes, OS includes for TMS570 and RPP includes, in that
606 order\todo{Add lwip include paths as well}.\newline{}
607 \noindent\includegraphics[width=350px]{images/base_5.png}
609 \item Configure compiler to allow GCC extensions.\newline{}
610 \noindent\includegraphics[width=400px]{images/base_6.png}
611 \item Import and link (\underline{do not copy!}) linker file and board upload descriptor.\newline{}
612 \noindent\includegraphics[width=200px]{images/base_7.png}
615 \textbf{Steps to configure a new GCC (x86(\_64)) RPP simulated application:}
618 \item Create a new managed C project that uses Linux GCC toolchain.
619 \item Create a source folder \textsc{src}. Link all files from original CCS application to this folder.
620 \item Create a normal folder \textsc{include}. Create a folder \textsc{rpp} inside of it.
621 \item Add common \textsc{.gitignore} to the root of that project:
629 \item Add new variable \textsc{RPP\_LIB\_ROOT} and point to this repository branch root.\newline{}
630 \noindent\includegraphics[width=400px]{images/base_posix_1.png}
631 \item Configure compiler to include local includes, CCS application includes, OS includes for POSIX and
632 RPP includes, in that order.\newline{}
633 \noindent\includegraphics[width=400px]{images/base_posix_2.png}
635 \item Add \textsc{rpp} and \textsc{pthread}to linker libraries and add \textsc{RPP\_LIB\_ROOT} to the library search
637 \noindent\includegraphics[width=400px]{images/base_posix_3.png}
640 \textbf{In general any RPP application uses the layout/template:}
643 \item Include RPP library header file. You may also include only a selected modules to save space.
644 \lstset{language=c++}
649 You may not want to include the whole library to save space and compile time. In this case you may
650 include only those modules, that you want to use. Inclusion selected modules only requires two more
651 header files to be included as well: base.h and, in case sci is used for printing, rpp/sci.h.
653 #include "rpp/hbr.h" /* We want to use H-bridge */
654 #include <base.h> /* This is a necessary base header file of the rpp library. */
655 #include "rpp/sci.h" /* This is needed, because we are using rpp_sci_printf in following examples. */
659 \item Create one or as many FreeRTOS task function definitions as required. Those tasks should use
660 functions from this library.
661 \lstset{language=c++}
663 void my_task(void* p)
665 static const portTickType freq_ticks = 1000 / portTICK_RATE_MS;
666 portTickType last_wake_time = xTaskGetTickCount();
668 /* Wait until next step */
669 vTaskDelayUntil(&last_wake_time, freq_ticks);
670 rpp_sci_printf((const char*)"Hello RPP.\r\n");
675 \item Create the main function that will:
677 \item Initialize the RPP board. If you have included only selected modules in step 1, initialize only
678 those modules by calling their init functions, for example rpp\_hbr\_init\(\).
679 \item Spawn the tasks the application requires. Refer to FreeRTOS API for
681 \item Start the FreeRTOS Scheduler. Refer to FreeRTOS API for details.
682 \item Catch if idle task could not be created.
684 \lstset{language=c++}
688 /* In case whole library is included: */
689 /* Initialize RPP board */
691 /* In case only selected modules are included: */
694 /* Initialize sci for printf */
696 /* Enable interrups */
700 if (xTaskCreate(my_task, (const signed char*)"my_task",
701 512, NULL, 0, NULL) != pdPASS) {
703 rpp_sci_printf((const char*)
704 "ERROR: Cannot spawn control task.\r\n"
707 while (TRUE) { asm(" nop"); }
710 /* Start the FreeRTOS Scheduler */
711 vTaskStartScheduler();
713 /* Catch scheduler start error */
715 rpp_sci_printf((const char*)
716 "ERROR: Problem allocating memory for idle task.\r\n"
719 while (TRUE) { asm(" nop"); }
724 \item Create hook functions for FreeRTOS:
726 \item \textsc{vApplicationMallocFailedHook()} allows to catch memory allocation errors.
727 \item \textsc{vApplicationStackOverflowHook()} allows to catch if a task overflows it's
730 \lstset{language=c++}
732 #if configUSE_MALLOC_FAILED_HOOK == 1
734 * FreeRTOS malloc() failed hook.
736 void vApplicationMallocFailedHook(void) {
738 rpp_sci_printf((const char*)
739 "ERROR: manual memory allocation failed.\r\n"
746 #if configCHECK_FOR_STACK_OVERFLOW > 0
748 * FreeRTOS stack overflow hook.
750 void vApplicationStackOverflowHook(xTaskHandle xTask,
751 signed portCHAR *pcTaskName) {
753 rpp_sci_printf((const char*)
754 "ERROR: Stack overflow : \"%s\".\r\n", pcTaskName
766 \subsection{Running software on the HW}
767 \label{sec-running-software-on-hw}
768 \subsubsection{Code Composer Studio Project}
769 \label{sec-ccs-run-project}
770 When the application is distributed as a CCS project, you have to open the project in the CCS as described in the Section \ref{sec-openning-of-existing-project}. Once the project is opened and built, it can be easily downloaded to the target hardware with the following procedure:
773 \item Connect the Texas Instruments XDS100v2 USB emulator to the JTAG port (see Figure \ref{pinout}, port 1).
774 \item Connect a USB cable to the XDS100v2 USB emulator and the development computer.
775 \item Plug in the power supply.
776 \item In the Code Composer Studio click on the \textsc{Run$\rightarrow$Debug}. The project will be optionaly built and the download process will start. The Code Composer Studio will switch into debug mode, when the download is finished.
777 \item Run the program by clicking on the \textsc{Run} button, with the green arrow.
780 \subsubsection{Binary File}
781 \label{sec-binary-file}
782 If the application is distributed as a binary file, without source codes and CCS project files, you can download and run just the binary file by creating a new empty CCS project and configuring the debug session according the following procedure:
785 \item In Code Composer Studio click on \textsc{File$\rightarrow$New$\rightarrow$CCS Project}.
786 \item In the dialog window, type in a project name, for example myBinaryLoad, Select \textsc{Device variant} (ARM, Cortex R, TMS570LS3137, Texas Instruments XDS100v2 USB Emulator) and select project template to \textsc{Empty Project}. The filled dialog should look like on the Figure \ref{fig-new-empty-project}
787 \item Click on the \textsc{Finish} button and new empty project will be created.
788 \item In the \textsc{Project Explorer} click on the project with a right mouse button and in the context menu select \textsc{Debug as$\rightarrow$Debug configurations}.
789 \item Click on a button \textsc{New launch configuration}
790 \item Rename the New\_configuration, for example to myConfiguration.
791 \item Select configuration target file by clicking the \textsc{File System} button, finding and selecting the TMS5703137.ccxml file. The result should look like on the Figure \ref{fig-debug-conf-main-diag}.
792 \item On the \textsc{program} pane select the binary file you want to download to the board. Click on the \textsc{File System} button, find and select the binary file. Rpp-test-sw.out for example. The result should look like on the Figure \ref{fig-debug-conf-program-diag}.
793 \item You may also tune the target configuration like in the Section \ref{sec-target-configuration}.
794 \item Finish the configuration by clicking on the \textsc{Apply} button and download the code by clicking on the \textsc{Debug} button. You can later invoke the download also from the \textsc{Run$\rightarrow$Debug} CCS menu. You may not need to create more Debug configurations and CCS empty project as you can easily change the binary file in the Debug configuration to load different binary file.
798 \includegraphics[width=350px]{images/new_empty_project.png}
799 \captionof{figure}{New empty project dialog}
800 \label{fig-new-empty-project}
804 \includegraphics[width=350px]{images/debug_configuration_main.png}
805 \captionof{figure}{Debug Configuration Main dialog}
806 \label{fig-debug-conf-main-diag}
809 \subsubsection{Target configuration}
810 \label{sec-target-configuration}
811 Default target configuration erases the whole Flash memory, before downloading the code. This is however not needed in most cases. You may disable this feature by the following procedure:
813 \item Right click on the project name in the \textsc{Project Browser}
814 \item Select \textsc{Debug as$\rightarrow$Debug Configurations}
815 \item In the dialog window select \textsc{Target} pane.
816 \item In the \textsc{Flash Settings}, \textsc{Erase Options} select \textsc{Necessary sectors only}.
817 \item Save the configuration by clicking on the \textsc{Apply} button and close the dialog.
821 \includegraphics[width=350px]{images/debug_configuration_program.png}
822 \captionof{figure}{Debug Configuration Program dialog}
823 \label{fig-debug-conf-program-diag}
826 \section{Matlab Simulink usage}
827 \label{sec-matlab-simulink-usage}
829 \subsection{Configuring Simulink for RPP}
830 \label{sec-configuration-simulink-for-rpp}
832 \item Download and install CCS for Linux:
834 Details on how to setup CCS are available in Section \ref{sec-ti-ccs}.
836 \item Install RPP Target:
838 Open Matlab and type on command window:
840 \lstset{language=Matlab}
846 This will launch the RPP setup script. This script will ask the user to provide the path to the CCS
847 compiler root directory (the directory where \textsc{armcl} binary is located), normally:
850 <ccs>/tools/compiler/arm_5.X.X/
853 This script will, among other things, ask the user to provide the location of the armcl parent
854 directory, infer and save some relevant CCS paths, add paths to Matlab path and build S-Function
855 blocks for user's architecture (using Matlab's mex command line tool).
857 \item Create a new model or load a demo:
859 Demos are located on \textsc{\repo/rpp/demo} or you can start a new model and configure target to RPP.
860 For new models see \htmladdnormallink{Target Reference}{\#target\_reference} section below.
864 \subsection{Working with demo models}
865 \label{sec-openning-demo-models}
866 The demo models are available from the directory \textsc{\repo/rpp/demos}. To access the demo models for reference or for downloading to the RPP board you have to change the directory to the one, containing the desired demo. For example to open the cantransmit demo you have to type these commands into the Matlab command line:
868 \begin{lstlisting}[language=Matlab]
869 cd <rpp-simulink-root>/rpp/demos
870 open('cantransmit.slx')
873 The same procedure can be used to open any other models.
875 \subsection{Creating new model}
876 \label{sec-crating-new-model}
878 \item Open or create a model you want to generate code from.
879 \item Make sure that the model is configured (\textsc{Simulation $\rightarrow$
880 Model Configuration Parameters}) as described later in this section.
881 \item From Matlab command window change the current directory to where
882 you want your generated code to appear, e.g.:
883 \begin{lstlisting}[language=Matlab]
886 The code will be generated in a subdirectory of that directory. The
887 name of the subdirectory will be \textsc{<model>\_rpp}, where
888 \textsc{model} is the name of the Simulink model.
889 \item Generate the code by choosing \textsc{Code $\rightarrow$ C/C++ Code
890 $\rightarrow$ Build Model}.
893 If you want to run the model on the RPP board, see Section \ref{sec-running-model-on-hw}.
895 The new Simulink model needs to be configured in the following way:
898 \item Solver (Figure \ref{fig-solver}):
900 \item Options: \emph{Fixed-step, discrete}
901 \item Tasking mode set to \textit{SingleTasking}.
904 \includegraphics[width=400px]{images/simulink_solver.png}
905 \caption{Solver settings}
909 \item Diagnostics $\rightarrow$ Sample Time (Figure~\ref{fig-sample-time-settings}):
911 \item Disable warning source block specifies -1 sampling time. It's ok for the source blocks to run
915 \includegraphics[width=400px]{images/simulink_diagnostics.png}
916 \caption{Sample Time settings}
917 \label{fig-sample-time-settings}
920 \item Code generation (Figure~\ref{fig-code-gen-settings}):
922 \item Set to \textsc{rpp.tlc}.
925 \includegraphics[width=400px]{images/simulink_code.png}
926 \caption{Code Generation settings}
927 \label{fig-code-gen-settings}
933 \subsection{Running model on the HW}
934 \label{sec-running-model-on-hw}
935 To run the model on the target RPP hardware you have to enable the download feature and build the model by following this procedure:
937 \item Open the model you want to run (See Section \ref{sec-openning-demo-models}.)
938 \item Click on \textsc{Simulation$\rightarrow$Model Configuration Parameters}.
939 \item In the \textsc{Code Generation$\rightarrow$RPP Options} pane check \textsc{Download compiled binary to RPP} checkbox.
940 \item Click on \textsc{OK} button, connect the target HW to the computer like in the Section \ref{sec-ccs-run-project} and build the model. If the build ends with a success, the download process will start and once the downloading is finished, the application will run immediatelly.
943 The code downloading is supported for Windows and Linux development systems. If you are using Linux, you may also try to use the OpenOCD by checking Use OpenOCD to download the compiled binary checkbox in addition. Refer
946 http://rtime.felk.cvut.cz/hw/index.php/TMS570LS3137#OpenOCD_setup_and_Flashing
948 fore more information about the OpenOCD configuration.
950 Note: You should end the Code Composer Studio debug session before
951 downloading the generated code to the RPP board. Otherwise the
955 \section{Configuring serial interface}
956 \label{sec-configuration-serial-interface}
957 The main interface for communicating with the RPP board is the serial interface. The application may define its own interface settings, but the following settings is the default one:
959 \item Baudrate: 115200
963 \item Flow control: none
966 Use GtkTerm in Linux or Bray Terminal for accessing the serial interface. See Section \ref{sec-hardware-description} for reference about the position of the serial interface connector on the RPP board.
968 \section{Bug reporting}
969 \label{sec-bug-reporting}
973 \chapter{C Support Library}
974 \label{chap-c-support-library}
976 This chapter describes the implementation of a C support library (RPP Library) to provide an overall
977 insight for future development.
979 \section{Description}
980 \label{sec-description}
981 The RPP C Support Library (also called RPP library) defines the API for communication with the board. It includes drivers and operating system and is designed from the board user perspective and exposes a simplified high-level API to handle the board's peripheral modules in a safe manner. The library is compiled as a static library with the name rpp-lib.lib and can be found in \textsc{\repo/rpp/lib}.
983 The RPP library can be used in any project, where the RPP hardware support is required and is also used in two modules, described later in this document. The Command line testing tool, described in Chapter \ref{chap-rpp-test-software} and Simulink Coder target, described in Chapter \ref{chap-simulink-coder-target}.
985 For details about the library architecture, refer the Section \ref{sec-software-architecture} in Chapter \ref{chap-introduction}
987 \section{API development guidelines}
988 \label{sec-api-development-guidlines}
990 The following are the development guidelines used for developing the RPP API:
993 \item User documentation should be placed in header files, not in source code, and should be Doxygen
994 formatted using autobrief. Documentation for each function present is mandatory.
995 \item Function declarations on the headers files is for public functions only. Do not declare
996 local/static/private functions on the header.
997 \item Documentation on source code files should be non-doxygen formatted and intended for developers,
998 not users. Documentation here is optional and at the discretion of the developer.
999 \item Always use standard data types for IO when possible. Use custom structs as very last resort.
1000 \item Use prefix based functions names to avoid clash. The prefix is of the form \textsc{[layer]\_[module]\_},
1001 for example \textsc{rpp\_din\_update()} for the update function of the DIN module in the RPP Layer.
1002 \item Be very careful about symbol export. Because it is used as a static library the modules should
1003 not export any symbol that is not intended to be used (function) or \textsc{extern}'ed (variable) from
1004 application. As a rule of thumb declare all global variables as static.
1005 \item Only the RPP Layer symbols are available to user applications. All information related to lower layers is hidden for the application. This is accomplished by the inclusion of the rpp.h or rpp\_\{mnemonic\}.h file on the implementations files only and never on the interface files. Never expose any other layer to the application or to the whole system below the RPP layer. In other words, never \textsc{\#include "foo/foo.h"} in any RPP Layer interface file.
1008 \section{Coding style}
1009 \label{sec-coding-style}
1010 In order to keep the code as clean as possible, a unified coding style should be followed by any contributor to the code. The RPP library project is prepared for a usage of a program named Uncrustify.
1012 The Uncrustify program checks the code and fixes those lines that does not match the coding style. However keep in mind that the program is not perfect and sometimes some lines can be modified even when the suggested coding style has been followed. This does not causes problems as long as the contributor follows the committing procedure described in next paragraph.
1014 When contributing to the code, the contributor should learn the current coding style from the existing code. When a new feature is implemented, before committing to the repository, a command :
1015 \lstset{language=bash}
1019 in a Linux terminal should be called. This command fixes any coding style errors. After that all changes can be committed.
1021 \section{Subdirectory content description}
1022 \label{sec-subdirectory-content-description}
1024 \item[librpp.a and rpp-lib.lib] Version controlled RPP static libraries.
1026 The first one is for POSIX simulation, the second one for Simulink models and other ARM/TMS570 applications. This files are placed here by the Makefile, when the library is built.
1028 \item[apps/] Demo applications related to the RPP library.
1030 This include the CCS studio project for generation of the static library and the a test suite. The test suit in this directory does not match the test suite mentioned later in Chapter 5 and those two suits are going to be merged in the future. Also other demo Hello World like applications are included as a reference about how to create a TMS570 application.
1031 \item[os/] OS layers directory. See OS interchangeable layer for more information.
1032 \item[rpp/] Main directory for the RPP Library.
1033 \item[rpp/doc/] Documentation directory for the RPP Library.
1034 \item[rpp/TMS570LS3137.ccxml] Descriptor for code download.
1036 This file is used by all the projects including the Simulink RPP Target for code download. It is
1037 configured to use the Texas Instruments XDS100v2 USB Emulator.
1038 \item[rpp/TMS570LS313xFlashLnk.cmd] CGT Linker command file.
1040 This file is used by all applications linked for the board, including the Simulink models, static
1041 library and test suite. It includes instructions for the CGT Linker on where to place sections
1042 and size of some sections.
1043 \item[rpp/include/\{layer\} and rpp/src/\{layer\}] Interface files and implementations files for given \textsc{\{layer\}}. See Section \ref{sec-software-architecture} in Chapter \ref{chap-introduction} for details on the RPP Layer.
1044 \item[rpp/include/rpp/rpp.h] Main library header file.
1046 To use this library with all its modules, just include this file and this file only. Also, before using any library function please call \textsc{rpp\_init()} function for hardware initialization.
1048 \item[rpp/include/rpp/rpp\_\{mnemonic\}.h] Header file for \textsc{\{mnemonic\}} module.
1050 This files includes function definitions, pin definitions, etc, specific to \{mnemonic\} module. See Section \ref{sec-api-development-guidlines}.
1052 You may include only selected rpp\_\{mnemonic\}.h header files and call the specific rpp\_\{mnemonic\}\_init functions, instead of the rpp.h and rpp\_init function, if you want to use only a subset of the library functions.
1054 \item[rpp/src/rpp/rpp\_\{mnemonic\}.c] Module implementation.
1056 Implementation of \textsc{rpp\_\{mnemonic\}.h}'s functions on top of the DRV library.
1057 \item[rpp/src/rpp/rpp.c] Implementation of library-wide functions.
1061 \section{Compilation}
1062 \label{sec-compilation}
1064 The RPP Library can be compiled as a static library for ARM using a Code Composer Studio project or for x86 Linux using an Eclipse project. After the compilation, as part of the build process, both procedures will automatically update the version-controlled static libraries in the library root.
1066 For the compilation of the library as a static library open the Code Composer studio project for the rpp-lib (see Section \ref{sec-openning-of-existing-project}) and build the project. As a result of the build process, if successful, a \textsc{rpp-lib.lib} file will appear in the library root directory.
1069 \item \textsc{rpp-lib.lib}, static library for ARM using TI naming scheme.
1070 \item \textsc{librpp.a}, static library for x86(\_64) using standard Linux naming scheme.
1073 Because compilation of the libraries in Eclipse IDE can be error
1074 prone, there is a \textsc{Makefile} that allows to compile the
1075 libraries from the Linux command line:
1077 \begin{lstlisting}[language=bash]
1082 This option is available for Linux based development systems only.
1084 Note that this Makefile still requires the Code Composer Studio to be
1087 The relevant aspects for compiling and linking an application using the static libraries are:
1089 \item \textbf{ARM compilation using CCS for the RPP board:}
1091 \item Include headers files of the OS for which the library was compiled against. At the time of this
1092 writing the OS is FreeRTOS 7.0.2. See Section \ref{sec-software-architecture}
1093 \item Include header files for the RPP library or for modules you want to use rpp\_can.h for CAN module for example.
1094 \item Add library \textsc{rpp-lib.lib} to the linker libraries. The RPP library \textbf{MUST} be looked for
1095 before Texas Instruments support library \textsc{rtsv7R4\_T\_be\_v3D16\_eabi.lib}.
1096 \item Configure linker to retain \textsc{.intvecs} section from RPP Library:\newline{}
1097 \textsc{--retain="rpp-lib.lib$\langle$sys\_intvecs.obj$\rangle$(.intvecs)"}
1098 \item Use the provided linker command file \textsc{TMS570LS313xFlashLnk.cmd}.
1100 \item \textbf{x86(\_64) compilation using GCC for Simulation:}
1102 \item Include headers files of the OS for Simulation. At the time of this writing the OS is POSIX
1104 \item Include header files for the RPP library or for modules you want to use (rpp\_can.h for CAN module for example).
1105 \item Add library \textsc{librpp.a} to the linker libraries.
1106 \item Add \textsc{pthread} to the linker libraries.
1110 As an important note, all the models compiled using Simulink will link against \textsc{rpp-lib.lib}.
1111 When compiling a Simulink model, neither Simulink nor the
1112 \textsc{make} invoked during the build process, will update the generated binary
1113 if the model hasn't changed, and then if the source code hasn't changed. Static libraries changes
1114 are not considered for re-compilation and re-linking. If library development is being done and
1115 static library is updated, in order for the Simulink model to generate a newly linked version of
1116 the binary the whole code generation folder needs to be deleted in order to force code generation,
1117 compilation and linking with the new static library.
1119 \section{Compiling API documentation}
1120 \label{sec-compiling-api-documentation}
1121 The RPP Layer is formatted using Doxygen documentation generator. This allows to generate a high
1122 quality API reference. To generate the API reference run in a Linux terminal:
1124 \lstset{language=bash}
1126 cd <repo>/rpp/lib/rpp/doc/api
1128 xdg-open html/index.html
1131 The files under \textsc{\repo/rpp/lib/rpp/doc/api/content} are used for the API reference generation
1132 are their name is self-explanatory:
1142 \chapter{Simulink Coder Target}
1143 \label{chap-simulink-coder-target}
1145 The Simulink Coder Target allows to convert Simulink models to C code,
1146 compile it and download to the board.
1148 \section{Introduction}
1149 \label{sec-introduction}
1151 The Simulink RPP Target provides support for C source code generation from Simulink models and
1152 compilation of that code on top of the RPP library and the FreeRTOS operating system. This target
1153 uses Texas Instruments ARM compiler (\textsc{armcl}) included in the Code Generation Tools distributed with
1154 Code Composer Studio, and thus it depends on it for proper functioning.
1156 This target also provides support for automatic download of the compiled binary to the RPP
1159 \begin{figure}[H]\begin{center}
1161 \includegraphics[width=300px]{images/tlc_process.png}
1162 \caption{TLC code generation process.}
1163 \end{center}\end{figure}
1166 \label{sec-features}
1169 \item Supports only single tasking. If multitasking is required, it has to be implemented in a new file \textsc{rpp\_mrmain.tlc} in \textsc{\repo/rpp/rpp/} and \textsc{rpp\_file\_process.tlc} has to be edited to use that file, when multitasking is selected.
1170 \item No External mode support
1171 \item Custom compiler options, available via OPTS variable in \emph{Make command} at \emph{Code Generation} tab (see Figure \ref{fig-code-gen-settings}). For example \textsc{make\_rtw OPTS="-O0 -g"}.
1175 \section{RPP Options pane}
1176 \label{sec-rpp-target-options}
1178 The RPP Target includes the following configuration options, all of them configurable per model
1179 under \textsc{Code Generation} \noindent$\rightarrow$ \textsc{RPP Options}:
1182 \item \textbf{C system stack size}: this parameter is passed directly
1183 to the linker for the allocation of the stack. Note that this stack
1184 is used only for initializing the application and FreeRTOS. Once
1185 everything is initialized, another stack is used by the generated
1186 code. See below. Default value is 4096.
1188 \item \textbf{C system heap size}:
1189 \label{sec-rpp-target-options-heap-size} this parameter is passed
1190 directly to the linker for the allocation of the heap. Currently,
1191 the heap is not used, but will be used by the external mode in the future. Note that FreeRTOS uses its own heap whose size is independent of this parameter.
1192 \item \textbf{Model step task stack size}: this parameter will be passed to the \textsc{xTaskCreate()} that
1193 creates the task for the model to run. In a Simulink model there are always two tasks:
1195 \item The worker task. This task is the one that executes the model
1196 step. This task requires enough stack memory to execute the step.
1197 If your model does not run, it might be caused by too small stack.
1198 The memory needed for the stack depends on the size and structure
1200 \item The control task. This task controls when the worker task should execute and controls overruns.
1203 \item \textbf{Download compiled binary to RPP}: if set, this option will download the generated binary to
1204 the board after the model is successfully built. Note that this option is unaware of the option
1205 \textit{Generate code only} in the \textit{Code Generation} options panel, so it will try to download even if
1206 only source code has been generated, failing graciously or uploading an old binary laying around
1207 in the build directory. This option calls the \textsc{rpp\_download.m} script, which is in turn a
1208 wrapper on the \textsc{loadti.sh}, \textsc{loadti.bat} and \textsc{loadopenocd.sh} script. More information on the \textsc{loadti.sh}
1209 script can be found in:
1211 <css>/ccs_base/scripting/examples/loadti/readme.txt
1212 http://processors.wiki.ti.com/index.php/Loadti
1215 The \textsc{loadti.sh} and\textsc{loadti.bat} script will close after the download of the generated program, leaving the loaded program running.
1217 The \textsc{loadopenocd.sh} script will close after the download of the generated program as well, but the program will be stopped.
1218 In order to test the loaded program a manual reset of the board is required.
1220 \item \textbf{Download compiled binary to SDRAM}: This feature is not yet implemented for the simulink target.
1222 \item \textbf{Use OpenOCD to download the compiled binary}: This option switches from Ti loading script \textsc{loadti.sh}
1223 to OpenOCD script \textsc{loadopenocd.sh}. The benefit of using OpenOCD, besides that it is open source
1224 software, is much shorter loading time. More information about the right OpenOCD version and its installation
1227 http://rtime.felk.cvut.cz/hw/index.php/TMS570LS3137#OpenOCD_setup_and_Flashing
1229 This feature is available for Linux system only.
1231 \item \textbf{Print model metadata to SCI at start}: if set this option will print a message to the Serial
1232 Communication Interface when the model start execution on the board. This is very helpful to
1233 identify the model running on the board. The message is in the form:
1235 `model_name' - generated_date (TLC tlc_version)
1240 `hbridge_analog_control' - Wed Jun 19 14:10:44 2013 (TLC 8.3 (Jul 20 2012))
1244 \section{Subdirectory content description}
1245 \label{sec-subdirectory-content-description}
1246 This section describes the directories of the Simulink Coder. If you are interested in particular file, refer the description at the beginning of the file.
1248 \item[doc/] Contains the sources of the documentation, you are now reading.
1249 \item[refs/] Contains third party references, which license allows the distribution.
1250 \item[rpp/blocks] Contains the TLC files, which defines the blocks for the Matlab Simulink and \textsc{rpp\_lib.slx}, which is the Simulink RPP Library, containing all the Simulink blocks for RPP.
1251 \item[rpp/blocks/tlc\_c]Contains the templates for C code generation from the Matlab Simulink model.
1252 \item[rpp/demos] Contains demo models, which purpose is to serve as a reference for the usage and for testing.
1253 \item[rpp/lib] Contains the C Support Library. See Chapter \ref{chap-c-support-library}.
1254 \item[rpp/loadopenocd] Contains download scripts for Linux support of the OpenOCD, for code downloading to the target.
1255 \item[rpp/loadti] Contains download scripts for Linux and Windows support for code downloading to the target, using Texas Instruments CCS code downloader.
1256 \item[rpp/rpp] Contains set of support script for the Code Generator.
1259 \section{Block Library Overview}
1260 \label{sec-block-library-overview}
1261 The Simulink Block Library is a set of blocks that allows Simulink models to use board IO and
1262 communication peripherals. The available blocks are summarized in
1263 Table~\ref{tab:block-lib-status} and more detailed description is
1264 given in Section~\ref{sec-blocks-description}.
1267 \begin{center}\begin{tabular}{lp{5cm}lll}
1268 \textbf{Category} & \textbf{Name} & \textbf{Status} & \textbf{Mnemonic} & \textbf{Header} \\
1269 \input{block_table.tex}
1270 System blocks & High-Power output block & \textsc{X} & \textsc{[HOUT]} & \textsc{rpp\_hout.h} \\
1271 & LIN receive block & \textsc{X} & \textsc{[LINR]} & \textsc{rpp\_lin.h} \\
1272 & LIN send msg block & \textsc{X} & \textsc{[LINS]} & - Idem - \\
1273 & Ethernet receive block & \textsc{X} & \textsc{[ETHR]} & \textsc{rpp\_eth.h} \\
1274 & Ethernet send msg block & \textsc{X} & \textsc{[ETHS]} & - Idem - \\
1275 & SDRAM write block & \textsc{X} & \textsc{[SDRW]} & \textsc{rpp\_sdr.h} \\
1276 & Stack overflow detected block & \textsc{X} & \textsc{[TRSO]} & - None - \\
1277 & Malloc Failed detected block & \textsc{X} & \textsc{[TRMF]} & - None - \\
1278 \end{tabular}\end{center}
1280 \caption{Block library overview}
1281 \label{tab:block-lib-status}
1284 \subsection{Blocks implementation}
1285 \label{sec-blocks-implementation}
1286 All of the blocks are implemented as a C Mex S-Function coded by hand. In this section the
1287 approach taken is briefly explained.
1289 \subsubsection{C MEX S-Functions}
1290 \label{sec-c-mex-functions}
1292 \item C : Implemented in C language. Other options are Fortran and Matlab language itself.
1293 \item MEX: Matlab Executable. They are compiled by Matlab - C compiler wrapper called MEX.
1294 \item S-Function: System Function, as opposed to standard functions, or user functions.
1297 A C-MEX S-Function is a structured C file that implements some mandatory and optional callbacks for a specification of a number of inputs, outputs, data types, parameters, rate, validity checking, etc.
1298 A complete list of callbacks can be found in:
1300 \htmladdnormallink{http://www.mathworks.com/help/simulink/create-cc-s-functions.html}{http://www.mathworks.com/help/simulink/create-cc-s-functions.html}
1303 The way a C-MEX S-Function participates in a Simulink simulation is shown on the diagram \ref{fig-sfunctions-process}:
1305 \begin{figure}[H]\begin{center}
1307 \includegraphics[width=250px]{images/sfunctions_process.png}
1308 \caption{Simulation cycle of a S-Function.}
1309 \label{fig-sfunctions-process}
1310 \end{center}\end{figure}
1312 In general, the S-Function can perform calculations, inputs and outputs for simulation. Because
1313 the RPP blocks are for hardware peripherals control and IO the blocks are
1314 implemented as pure sink or pure source, the S-Function is just a descriptor of the block and does not perform any calculation and does not provide any input or output for simulations.
1316 The implementation of the S-Functions in the RPP project has following layout:
1319 \item Define S-Function name \textsc{S\_FUNCTION\_NAME}.
1320 \item Include header file \textsc{header.c}, which in connection with \textsc{trailer.c} creates a miniframework for writing S-Functions.
1321 \item In \textsc{mdlInitializeSizes} define:
1323 \item Number of \textit{dialog} parameter.
1324 \item Number of input ports.
1326 \item Data type of each input port.
1328 \item Number of output ports.
1330 \item Data type of each output port.
1332 \item Standard options for driver blocks.
1334 \item In \textsc{mdlCheckParameters}:
1336 \item Check data type of each parameter.
1337 \item Check range, if applicable, of each parameter.
1339 \item In \textsc{mdlSetWorkWidths}:
1341 \item Map \textit{dialog} parameter to \textit{runtime} parameters.
1343 \item Data type of each \textit{runtime} parameter.
1346 \item Define symbols for unused functions.
1347 \item Include trailer file \textsc{trailer.c}.
1350 The C-MEX S-Function implemented can be compiled with the following command:
1352 \lstset{language=bash}
1354 <matlabroot>/bin/mex sfunction_{mnemonic}.c
1357 As noted the standard is to always prefix S-Function with \textsc{sfunction\_} and use lower case
1358 mnemonic of the block.
1360 Also a script called \textsc{compile\_blocks.m} is included. The script that allows all \textsc{sfunctions\_*.c} to be fed to the \textsc{mex} compiler so all S-Functions are compiled at once. To use this script, in Matlab do:
1362 \lstset{language=Matlab}
1364 cd <repo>/rpp/blocks/
1368 \subsubsection{Target Language Compiler files}
1369 \label{sec-target-language-compiler-files}
1371 In order to generate code for each one of the S-Functions, every S-Function implements a TLC file
1372 for \textit{inlining} the S-Function on the generated code. The TLC files describe how to
1373 generate code for a specific C-MEX S-Function block. They are programmed using TLC own language and
1374 include C code within TLC instructions, just like LaTeX files include normal text in between LaTeX
1377 The standard for a TLC file is to be located under the \textsc{tlc\_c} subfolder from where the
1378 S-Function is located and to use the very exact file name as the S-Function but with the \textsc{.tlc}
1379 extension: \textsc{sfunction\_foo.c} \noindent$\rightarrow$ \textsc{tlc\_c/sfunction\_foo.tlc}
1381 The TLC files implemented for this project use 3 hook functions in particular (other are available,
1382 see TLC reference documentation):
1384 \item \textsc{BlockTypeSetup}: \newline{}
1385 BlockTypeSetup executes once per block type before code generation begins.
1386 This function can be used to include elements required by this block type, like includes or
1388 \item \textsc{Start}: \newline{}
1389 Code here will be placed in the \textsc{void $\langle$modelname$\rangle$\_initialize(void)}. Code placed here will
1391 \item \textsc{Outputs}: \newline{}
1392 Code here will be placed in the \textsc{void $\langle$modelname$\rangle$\_step(void)} function. Should be used to
1393 get the inputs o a block and/or to set the outputs of that block.
1396 The general layout of the TLC files implemented for this project are:
1398 \item In \textsc{BlockTypeSetup}: \newline{}
1399 Call common function \textsc{\%$<$RppCommonBlockTypeSetup(block, system)$>$} that will include the
1400 \textsc{rpp/rpp\i\_mnemonic.h} header file (can be called multiple times but header is included only once).
1401 \item \textsc{Start}: \newline{}
1402 Call setup routines from RPP Layer for the specific block type, like HBR enable, DIN pin setup,
1403 DAC value initialization, SCI baud rate setup, among others.
1404 \item \textsc{Outputs}: \newline{}
1405 Call common IO routines from RPP Layer, like DIN read, DAC set, etc. Success of this functions
1406 is checked and in case of failure error is reported to the block using ErrFlag.
1409 C code generated from a Simulink model is placed on a file called \textsc{$\langle$modelname$\rangle$.c} along with other support files in a folder called \textsc{$\langle$modelname$\rangle$\_$\langle$target$\rangle$/}. For example, the source code generated for model \textsc{foobar} will be placed in current Matlab directory \textsc{foobar\_rpp/foobar.c}.
1411 The file \textsc{$\langle$modelname$\rangle$.c} has 3 main functions:
1413 \item \textsc{void $\langle$modelname$\rangle$\_step(void)}: \newline{}
1414 This function recalculates all the outputs of the blocks and should be called once per step. This
1415 is the main working function.
1416 \item \textsc{void $\langle$modelname$\rangle$\_initialize(void)}: \newline{}
1417 This function is called only once before the first step is issued. Default values for blocks IOs
1418 should be placed here.
1419 \item \textsc{void $\langle$modelname$\rangle$\_terminate(void)}: \newline{}
1420 This function is called when terminating the model. This should be used to free memory of revert
1421 other operations made on the initialization function. With current implementation this function
1422 should never be called unless an error is detected and in most models it is empty.
1425 \subsection{Blocks description}
1426 \label{sec-blocks-description}
1428 This section describes each one of the Simulink blocks present in the Simulink RPP Library, illustrated in Figure \ref{fig-block-library}:
1434 \includegraphics[width=530px]{images/block_library.png}
1435 \caption{Simulink RPP Block Library.}
1436 \label{fig-block-library}
1439 % Include automatically generated documentation
1440 % TODO: the block_desc is badly generated
1441 \input{block_desc.tex}
1444 The Simulink RPP Demo Library is a set of Simulink models that use blocks from the Simulink RPP
1445 Block Library and generates code using the Simulink RPP Target.
1447 This demos library is used as a test suite for the Simulink RPP Block Library but they are also
1448 intended to show basic programs built using it. Because of this, the demos try to use more than one
1449 type of block and more than one block per block type.
1451 In the reference below you can find a complete description for each of the demos.
1453 \subsection{Analog pass-through}
1454 \begin{figure}[H]\begin{center}
1456 \includegraphics[width=450px]{images/demo_analog_passthrough.png}
1457 \caption{Analog Passthrough Simulink demo for RPP.}
1458 \end{center}\end{figure}
1460 \textbf{Description:}
1461 This demo will read analog input 1 and write it to analog output 1.
1463 In laboratory the minimum read value for analog input a 0 volts is 107. The maximum read at 12
1464 volts is 2478. The map subsystem will map the input domain (ADC)\textsc{[110, 2400]} to the output domain
1465 (DAC)\textsc{[0, 4095]}.
1468 \subsection{Analog sinewave}
1469 \begin{figure}[H]\begin{center}
1471 \includegraphics[width=450px]{images/demo_analog_sinewave.png}
1472 \caption{Analog Sinewave Simulink demo for RPP.}
1473 \end{center}\end{figure}
1475 \textbf{Description:}
1476 This demo will generate a sinewave on analog output 1. The frequency
1477 of the sine wave is 10Hz and sampling rate is set to
1478 1000Hz (driven from Simulink step of 1ms, same as operating system). Amplitude is set to use DAC
1479 full range [0-4095] which means output amplitude will be [0-12] volts.
1481 The Software oscilloscope shown should match an external one connected to DAC 1.
1483 Note that the driver configuration of the MCP4922 is set to unbuffered (which should eventually
1484 be changed to buffered) and thus the last resolution millivolts are lost.
1487 \subsection{CAN transmit}
1488 \begin{figure}[H]\begin{center}
1490 \includegraphics[width=450px]{images/demo_cantransmit.png}
1491 \caption{Example of the usage of the CAN blocks for RPP.}
1492 \end{center}\end{figure}
1494 \textbf{Description:}
1496 Demostrates how to use CAN Transmit blocks in order to:
1499 \item Send unpacked data with data type uint8, uint16 and uint32.
1500 \item Send single and multiple signals packed into CAN\_MESSAGE by CAN Pack block.
1501 \item Send a message as extended frame type to be received by CAN Receive configured to receive both, standard and extended frame types.
1504 Demostrates how to use CAN Receive blocks in order to:
1507 \item Receive unpacked data of data types uint8, uint16 and uint32.
1508 \item Receive and unpack received CAN\_MESSAGE by CAN Unpack block.
1509 \item Configure CAN Receive block to receive Standard, Extended and both frame types.
1510 \item Use function-call mechanism to process received messages
1513 \subsection{CAN demo}
1515 \begin{figure}[H]\begin{center}
1517 \includegraphics[width=450px]{images/demo_can_demo.png}
1518 \caption{CAN bus demo for RPP.}
1519 \end{center}\end{figure}
1521 \textbf{Description:}
1523 This demo demonstrates simple processing of received messages.
1525 \subsection{Digital pass-through}
1526 \begin{figure}[H]\begin{center}
1528 \includegraphics[width=400px]{images/demo_digital_passthrough.png}
1529 \caption{Digital Pass-through Simulink demo for RPP.}
1530 \end{center}\end{figure}
1532 \textbf{Description:}
1534 This demo will directly pass the digital values read on DIN [1-8] to LOUT [1-8], and thus acting
1535 as a digital pass-through or gateway.
1537 Also note that all the ErrFlag are aggregated on a global ErrFlag.
1539 \subsection{Echo char}
1540 \begin{figure}[H]\begin{center}
1542 \includegraphics[width=450px]{images/demo_echo_char.png}
1543 \caption{Echo Character Simulink demo for RPP.}
1544 \end{center}\end{figure}
1546 \textbf{Description:}
1548 This demo will echo twice (print back) any character received through the Serial Communication
1549 Interface (9600-8-N-1).
1551 Note that the send subsystem is implemented a as \textit{triggered} subsystem and will execute only
1552 if data is received, that is, Serial Receive output is non-negative. Negative values are errors.
1555 \subsection{H-bridge analog control}
1556 \begin{figure}[H]\begin{center}
1558 \includegraphics[width=450px]{images/demo_hbridge_analog_control.png}
1559 \caption{H-Bridge Analog Control Simulink demo for RPP.}
1560 \end{center}\end{figure}
1562 \textbf{Description:}
1564 This demo will read values from the analog input, map them, and control the H-Bridge. This allows
1565 a motor connected to the H-Bridge to be controlled with a potentiometer connected to Analog Input 1.
1567 Setting the potentiometer to output around 6 volts will stop the motor. Less (or greater) than 6
1568 volts will trigger the motor in one sense (or in the other sense) and speed proportional with 1\%
1571 In laboratory the minimum read value for analog input is 107 at 0 volts. The maximum read at 12 volts
1572 is 2478. The map subsystem will map the input domain (ADC)\textsc{[110, 2400]} to the output domain
1573 (HBR)\textsc{[-1.0, 1.0]}.
1576 \subsection{H-bridge digital control}
1577 \begin{figure}[H]\begin{center}
1579 \includegraphics[width=450px]{images/demo_hbridge_digital_control.png}
1580 \caption{H-Bridge Digital Control Simulink demo for RPP.}
1581 \end{center}\end{figure}
1583 \textbf{Description:}
1585 This demo toggle the H-Bridge from stop to full speed in one direction using digital input 1.
1586 So basically is a ON/OFF switch on DIN 1 for a motor connected on the HBR. Note the data type
1587 conversion because the output of the DIN is a boolean and the input to the HBR is a double.
1589 \subsection{H-bridge sine wave control}
1590 \begin{figure}[H]\begin{center}
1592 \includegraphics[width=300px]{images/demo_hbridge_sinewave_control.png}
1593 \caption{H-Bridge Sinewave Control Simulink demo for RPP.}
1594 \end{center}\end{figure}
1596 \textbf{Description:}
1598 This demo will generate a sine wave to control the H-Bridge. Sine wave is one period per 20
1599 seconds or 0.05Hz. Sampling rate is 20Hz or 100 samples per 1/4 of period (for 1\% speed
1602 Note that the Software oscilloscope should is not the output of the H-Bridge, the H-Bridge will
1603 change current sense and the duty cycle of the pulse that drive it (PWM), it does not output
1604 analog values. The Software oscilloscope just shows what the input to the HBR block is.
1606 \subsection{Hello world}
1607 \begin{figure}[H]\begin{center}
1609 \includegraphics[width=450px]{images/demo_hello_world.png}
1610 \caption{Hello World Simulink demo for RPP.}
1611 \end{center}\end{figure}
1613 \textbf{Description:}
1615 This demo will print \textsc{"Hello Simulink"} to the Serial Communication Interface (9600-8-N-1) one
1616 character per second. The output speed is driven by the Simulink model step which is set to one
1619 \subsection{IRC input}
1620 \begin{figure}[H]\begin{center}
1623 \includegraphics[width=450px]{images/demo_irc_input.png}
1624 \caption{LED Blink Simulink demo for RPP.}
1625 \end{center}\end{figure}
1627 \textbf{Description:}
1629 This demo is printing IRC sensor (connected to DIN10 and DIN11) value to the Serial Communication
1630 Interface (115200-8-N-1) with six values to one line.
1632 \subsection{LED blink}
1633 \begin{figure}[H]\begin{center}
1635 \includegraphics[width=450px]{images/demo_led_blink.png}
1636 \caption{LED Blink Simulink demo for RPP.}
1637 \end{center}\end{figure}
1639 \textbf{Description:}
1641 This the simplest demo of all that shows the basics of using the RPP target and blocks. The
1642 goal of this demo is to show the configuration of the model (not shown on the picture above),
1643 that is, how the RPP Simulink Coder Target is setup, general model setup and step setup.
1645 This demo will toggle each second a LED connected on LOUT 1. The timing is set by the Simulink
1646 model step which is set to 1 second.
1648 \subsection{LED blink all}
1649 \begin{figure}[H]\begin{center}
1651 \includegraphics[width=350px]{images/demo_led_blink_all.png}
1652 \caption{LED Blink All Simulink demo for RPP.}
1653 \end{center}\end{figure}
1655 \textbf{Description:}
1657 This demo will toggle all LEDs connected to the LOUT port. Even outputs pins will be negated.
1658 Toggle will happen each second. The timing is driven by Simulink model step configuration that
1659 is set to 1 second. All blocks ErrFlags are aggregated into one global ErrFlag.
1661 \subsection{Log analog input}
1662 \begin{figure}[H]\begin{center}
1664 \includegraphics[width=450px]{images/demo_log_analog_input.png}
1665 \caption{Log Analog Input Simulink demo for RPP.}
1666 \end{center}\end{figure}
1668 \textbf{Description:}
1670 This demo will log once per second the value read on the analog input 1. User can read the log
1671 using the SCI logging integrated command processor (9600-8-N-1). Logging block ID set to 1. The
1672 timing is driven by Simulink model step configuration that is set to 1 second.
1674 \subsection{Power toggle}
1675 \begin{figure}[H]\begin{center}
1677 \includegraphics[width=300px]{images/demo_power_toggle.png}
1678 \caption{Power Toggle Simulink demo for RPP.}
1679 \end{center}\end{figure}
1681 \textbf{Description:}
1683 This demo will toggle the power output once per second. If an error is detected on at least one of
1684 the outputs a generic error message is printed to the serial line. The timing is driven by Simulink
1685 model step configuration that is set to 1 second. Power outputs can drive a load up to 2A, so please
1686 take into account required safety considerations.
1688 \subsection{Simulink Demo board}
1689 Model for demo board has 6 subsystems. Every subsystem will be described separately.
1690 \begin{figure}[H]\begin{center}
1692 \includegraphics[width=0.8\textwidth]{images/demo_board-connection_scheme.pdf}
1693 \caption{Demo board connection and usage scheme.}
1694 \end{center}\end{figure}
1696 \subsubsection{Potentiometer regulation of motor speed}
1697 This is example of driving motor with input signal. Motor can be rotated in various speed in both directions and stopping motor means setting potentiometer to half of its range. Potentiometer value is also transmitted through CAN.
1699 \subsubsection{Color music}
1700 This is showing abilities of RPP board to generate analog signals. Bargraphs on demo board are showing value of analog outputs. Speed of change can be changed with potentiometer and in one case is used motor 2 IRC. There are five different modes. Three of them are derived from sinus and rest of them are counter value and direct control. Modes can be changed with black button. First mod selected after board start is fifth.
1702 \item Sinus signal is sequential delayed by 10 steps for second and third bargraph.
1703 \item Sinus signal on second bargraph is shifted by 120° and on third one is shifted by 240°.
1704 \item Sinus signal for second and third bargraphs are shifted same as in previous mode, but as counter value is used IRC value with appropriate divider no potentiometer value.
1705 \item Visualizing counter value which speed is changed with potentiometer.
1706 \item Potentiometer value is passed to all bargraphs with appropriate multiplier.
1709 \subsubsection{Buttons and LEDs}
1710 This is example of digital input/output. LEDs on demo board can be driven with four different subprograms. These subprograms can be changed with red button and are influenced with green and blue buttons.
1712 \item One LED is always ON and others are OFF. Every 0.1 sec is neighborhood LED switched on and previous one is switched off. With buttons you can change direction.
1713 \item Same as previous mode, but change is not done after 0.1 sec but only when button is pressed.
1714 \item In this mode you can record message in Morse code (max 64 chars including spaces) and after delay it is repetitively replayed. To record message use green button as dash and blue button as dot.
1715 \item Simple game in which you must determine if light is moving left or right and press green or blue button according to it. Speed of movement is increasing and in case of wrong answer or long delay is game ends with lights flashing.
1718 \subsubsection{IRC to CAN}
1719 IRC value from Motor 2 is sent every tenth step via CAN2 with message ID 0x4.
1721 \subsubsection{CAN receive -- Button press emulation}
1722 You can simulate press of all four buttons by sending message through CAN2 to board with message ID 0x0 and value according to button number.
1724 \subsubsection{Configuration and error handling}
1725 RPP supports some basic runtime error handling. Every block can set its error flag, all these error flags are joined in this demo together and when some problem is detected CAN2 message of ID 0x10 is transmitted. Also in case of board overrun (exhaustion of time quanta) is transmitted message through CAN2 with ID 0x11.\\
1726 When model is build without external mode, errors are also printed to SCI.
1728 \subsubsection{Full list of CAN communication}
1729 The board produces CAN frames with the following IDs:
1731 \item 0x05: Potentiometer 1 value.
1732 \item 0x06: Potentiometer 2 value.
1733 \item 0x08: Selected mod of color music.
1734 \item 0x09: Active subprogram of buttons and LEDs.
1735 \item 0x10: Transmitted only in case of error flag of some block, error code.
1736 \item 0x11: Transmitted only in case of board overrun, no data.
1738 The board reacts to CAN frames with following IDs:
1740 \item 0x00: Simulate button press, accepts value 1--4.
1743 \chapter{Command line testing tool}
1744 \label{chap-rpp-test-software}
1745 The \textsc{rpp-test-suite} is a RPP application developed testing and direct control of the RPP hardware. The test suite implements a command processor, which is listening for a commands and prints some output related to the commands on the serial interface. The command processor is modular and each peripheral has its commands in a separated module.
1747 The command processor is implemented in <rpp-test-sw>/cmdproc and commands modules are implemented in <rpp-test-sw>/commands directory.
1749 The application enables a command processor using the SCI at \textbf{115200-8-N-1}. When the software starts, the received welcome message and prompt should look like:
1755 Type in command help for a complete list of available command, or help command for a description of concrete command.
1757 \section{Commands description}
1759 % Generated by html2tex: Version 2.7 of February 6, 2012.
1760 % Written by F.J. Faase. http://www.iwriteiam.nl/
1762 % html: Beginning of file: `doc.html'
1764 \subsection{adcread}
1767 Read values from ADC inputs
1769 \subsubsection{Command syntax}
1771 \begin{verbatim} adcread\end{verbatim}
1773 \subsubsection{Description}
1776 This command reads values corresponding to analog voltages on ADC inputs 1-12 and prints them as decimal numbers as well as converted to Volts.
1778 \subsubsection{Example}
1780 \begin{verbatim} --> adcread
1781 ADC1 2332 lsb ~ 11.66 V
1782 ADC2 107 lsb ~ 0.54 V
1783 ADC3 108 lsb ~ 0.54 V
1784 ADC4 107 lsb ~ 0.54 V
1785 ADC5 108 lsb ~ 0.54 V
1786 ADC6 111 lsb ~ 0.56 V
1787 ADC7 110 lsb ~ 0.55 V
1788 ADC8 109 lsb ~ 0.55 V
1789 ADC9 107 lsb ~ 0.54 V
1790 ADC10 107 lsb ~ 0.54 V
1791 ADC11 110 lsb ~ 0.55 V
1792 ADC12 108 lsb ~ 0.54 V\end{verbatim}
1794 \subsection{adcread*}
1797 Read a value from a single ADC input
1799 \subsubsection{Command syntax}
1801 \begin{verbatim} adcread<PIN>\end{verbatim}
1803 where \texttt{\mbox{$<$}PIN\mbox{$>$}} is a number in range 1 - 12.
1805 \subsubsection{Description}
1808 This command reads the value corresponding to analog voltage on an ADC input and prints it as decimal numbers as well as converted to Volts.
1810 \subsubsection{Example}
1812 \begin{verbatim} --> adcread1
1813 ADC1 2331 lsb ~ 11.66 V\end{verbatim}
1815 \subsection{adcwatch}
1818 Watch the values from ADC inputs
1820 \subsubsection{Command syntax}
1822 \begin{verbatim} adcwatch\end{verbatim}
1824 \subsubsection{Description}
1827 This command reads values corresponding to analog voltages on ADC inputs 1-12 10 times per second and prints them as decimal numbers (in lsb units) as well as converted to Volts. The command is ended by any key.
1829 \subsubsection{Example}
1831 \begin{verbatim} --> adcwatch
1832 ADC Inputs Test [1-12]:
1833 =======================================================================
1834 1 2 3 4 5 6 7 8 9 10 11 12
1835 2331 107 108 106 107 110 110 109 107 107 110 109 lsb
1836 11.66 0.54 0.54 0.53 0.54 0.55 0.55 0.55 0.54 0.54 0.55 0.55 V\end{verbatim}
1838 \subsection{canbaudrate\#}
1841 Change baudrate of CAN controller
1843 \subsubsection{Command syntax}
1845 \begin{verbatim} canbaudrate<CONTROLLER>?
1846 canbaudrate<CONTROLLER>:<BAUDRATE>\end{verbatim}
1848 where \texttt{\mbox{$<$}CONTROLLER\mbox{$>$}} is number in range 1-3 and BAUDRATE is number in range 1000-10000000 specifying the baudrate in bits per second.
1850 \subsubsection{Description}
1853 This command is used to set or show the baudrate of a CAN controller. The baudrate shown is the one which will be used by next invocation of the caninit command. The baudrate specified by the command is used to automatic calculation of the CAN controller timing. If you want to specify the timing manually, please use the command cantiming. The automatic calculation might not work properly for some baudrates. In this case you should calculate the timing manually and specify it by the command cantiming.
1855 \subsubsection{Examples}
1857 \begin{verbatim} --> canbaudrate2?
1860 --> canbaudrate2:100000\end{verbatim}
1862 \subsection{candump}
1865 Dump all messages received over CAN
1867 \subsubsection{Command syntax}
1869 \begin{verbatim} candump <CONTROLLER>\end{verbatim}
1871 where \texttt{\mbox{$<$}CONTROLLER\mbox{$>$}} is a number in range 1-3.
1873 \subsubsection{Description}
1876 This command prints out all CAN messages received via the specified controller.
1878 IDs are zero-filled to length 3 if a message in the standard frame format is received and to 8 for extended frame format messages.
1880 caninit must be called before using this command.
1882 \subsubsection{Example}
1884 \begin{verbatim} --> candump 2\end{verbatim}
1886 can2 0000FADE \mbox{$[$}2\mbox{$]$} 12 34
1888 \subsection{caninit}
1891 Initialize CAN controllers
1893 \subsubsection{Command syntax}
1895 \begin{verbatim} caninit\end{verbatim}
1897 \subsubsection{Description}
1900 This command (re-)initializes all CAN controllers using current CAN configuration. This configuration can be changed using canbaudrate command.
1902 In the default configuration the baudrate of all CAN controllers i set to 500 kbit/s.
1904 \subsubsection{Example}
1907 --\mbox{$>$} caninit
1909 \subsection{canrpptest}
1912 Test the CAN functions from the RPP library
1914 \subsubsection{Command syntax}
1916 \begin{verbatim} canrpptest\end{verbatim}
1918 \subsubsection{Description}
1921 This command tests all CAN functions in the RPP library. It does those particular tests:
1923 1) Test of the rpp\emph{can}init(), rpp\emph{can}write() and rpp\emph{can}read() functions. At the beginning, the CAN bus is initialized with manually specified and verified CAN bit timing parameters. Then a message is sent on the CAN1 and is received on the CAN2. Finally the received message is compared with the sent one. If the transmissions fails, reception exceeds a timeout or the sent and received messages do not match, the command prints the appropriate error code.2) Test of the CAN bit timing parameters calculation. This test subsequently initializes the CAN bus to a baudrates 125k, 250k and 500k. For each one of them a message is sent on CAN1 and received on CAN2. Finally the received message is compared with the sent one like in a test (1). If the initialization, transmission, reception or comparison fails or if the reception timeout is reached, an appropriate error code is printed. 3) Test of the behavior of transmission request overwriting. The CAN bus is initialized like in the test (1). A message A transmission request is posted on CAN1 by calling rpp\emph{can}write() and right after that another message B transmission request is posted on CAN1 by another call of the rpp\emph{can}write(). A message B is received on CAN2, because the second request came so quickly, that it overwrote the first one. The sent and received messages are compared to verify that the transmission was correct. If the initialization, transmission, reception or comparison fails or if the reception timeout is reached, an appropriate error code is printed. 4) Test of the TX request pending flag detection. The CAN bus is initialized like in the test (1). A message is transmitted on the CAN1 and the test waits for the TX pending flag to be set, which signalizes that there is a message transmission request pending. After the flag has been set, the test waits for its clearance, which means that the message has been sent. The test measures, how many flag test cycles passed, until the flag has been cleared. This value is then presented as a time. At the end, the message is received on the CAN2 and is compared with the sent message for verification. If the initialization, transmission, reception or comparison fails or if timeout is reached while waiting for the flag set/clear or receive timeout is reached, an appropriate error code is printed. 5) Test of the message received (RX) indicator. The CAN bus is initialized like in the test (1). A message is transmitted on the CAN1. The test then waits for the RX indicator to be set, which indicates that a message has been received. The message is picked up by the rpp\emph{can}read(). This should clear the indicator, which is tested. Finally the received messages is compared with the sent one. If the initialization, transmission, reception, message comparison or indicator test fails or if timeout is reached while waiting for the flag set, the appropriate error code is printed.
1925 At the end the CAN bus is reset and left with the configuration from test (1). Those tests assumes the CAN1 and CAN2 to be connected in HW loopback. Any previous configuration is canceled, but is not deleted, so any following call of caninit command will restore the CAN bus to previous configuration.
1927 For error codes description refer please the API documentation for the rpp-test-sw.
1929 \subsubsection{Example}
1931 \begin{verbatim} --> canrpptest\end{verbatim}
1933 This is a test for RPP CAN library functions:Test of simple message transmission and reception. CAN bus Initialization...OK Transmission and reception...OK---Test od automatic CAN bit timing calculation. Baudrate: 125000: OK Baudrate: 250000: OK Baudrate: 500000: OK---Test of transmission request rewritting. CAN bus Initialization...OK TX request rewritting...OK---Test of TX request pending flag detection. CAN bus Initialization...OK TX request pending flag behavioral: OK, time: 256 cycles.---Test of RX indicator. CAN bus Initialization...OK RX indicator behavioral:OK, time: 0 cycles.---Reset the CAN bus. CAN bus Initialization...OK\#\# cansend \#\# Test sending message over CAN
1935 \subsubsection{Command syntax}
1937 \begin{verbatim} cansend <CONTROLLER> <ID> <DATA>\end{verbatim}
1939 where \texttt{\mbox{$<$}CONTROLLER\mbox{$>$}} is number in range 1-3, \texttt{\mbox{$<$}ID\mbox{$>$}} is a valid CAN ID and \texttt{\mbox{$<$}DATA\mbox{$>$}} is 0-8 bytes of data in hexadecimal representation. There may be any number of spaces between the data bytes. \texttt{\mbox{$<$}ID\mbox{$>$}} may be given in octal, decimal or hexadecimal base.
1941 \subsubsection{Description}
1944 This command sends a CAN frame using specified CAN controller.
1946 The caninit command must be called before using this command.
1948 \subsubsection{Example}
1950 \begin{verbatim} --> cansend 2 0x123 DEAD BEEF
1951 Sent: can2 123 [4] DE AD BE EF\end{verbatim}
1953 \subsection{cantiming\#}
1956 Change timing of CAN controller manually
1958 \subsubsection{Command syntax}
1960 \begin{verbatim} cantiming<CONTROLLER>?
1961 cantiming<CONTROLLER>:<BRP> <PROP_SEG> <PHASE_SEG1> <PHASE_SEG2> <SJW>\end{verbatim}
1963 where: - \texttt{\mbox{$<$}CONTROLLER\mbox{$>$}} is number in range 1-3 - \texttt{\mbox{$<$}BRP\mbox{$>$}} (baudrate prescaler) is number in range 1-65 - \texttt{\mbox{$<$}PROP\_SEG\mbox{$>$}} (length of propagation segment in tQ) is a number in range 1-8 - \texttt{\mbox{$<$}PHASE\_SEG1\mbox{$>$}} (phase buffer segment 1 in tQ) is a number in range 1-8 - \texttt{\mbox{$<$}PHASE\_SEG2\mbox{$>$}} (phase buffer segment 2 in tQ) is a number in range 1-8 - \texttt{\mbox{$<$}SJW\mbox{$>$}} (synchronization jump width in tQ) is a number in range 1-4
1965 \subsubsection{Description}
1968 This command is used to set or show the timing of a CAN controller. The timing shown is the one which will be used by next invocation of the caninit command. The timing configured by this command defines manually the baudrate of the CAN controller. If you want to calculate the timing automaticaly from a baudrate, please use the command canbaudrate.
1970 \subsubsection{Examples}
1972 \begin{verbatim} --> cantiming2?
1982 --> cantiming2:5 8 7 4 1\end{verbatim}
1984 \subsection{dacpinenable*}
1987 Enable or disable a DAC pin
1989 \subsubsection{Command syntax}
1991 \begin{verbatim} dacpinenable<PIN> <VALUE>\end{verbatim}
1995 \item \texttt{\mbox{$<$}PIN\mbox{$>$}} is a number in range 1-4
1996 \item \texttt{\mbox{$<$}VALUE\mbox{$>$}} is a number 0 (disable) or 1 (enable)
1999 \subsubsection{Description}
2002 Command for enabling or disabling of a DAC pin.
2004 Command always prints the actual state of the selected pin.
2006 \subsubsection{Example}
2008 \begin{verbatim} --> dacpinenable1 1
2009 dacpinenable1=1\end{verbatim}
2011 Enables pin DAC1 and prints its actual state (which will be 1)
2013 \subsection{dacpinval*}
2016 Set raw value of a DAC register
2018 \subsubsection{Command syntax}
2020 \begin{verbatim} dacpinval<PIN> <VALUE>\end{verbatim}
2024 \item \texttt{\mbox{$<$}PIN\mbox{$>$}} is a number in range 1-4
2025 \item \texttt{\mbox{$<$}VALUE\mbox{$>$}} is a number in range 0-4095
2028 \subsubsection{Description}
2031 This command writes a raw value to DAC register that controls the DAC output voltage according to the formula described in the datasheet. \texttt{\mbox{$<$}PIN\mbox{$>$}} parameter selects which DAC pin to use.
2033 Command always prints the written raw value of the selected pin. There is no way how to read the value out of the register.
2035 \subsubsection{Example}
2037 \begin{verbatim} --> dacpinval1 4095
2038 dacpinval1 =4095\end{verbatim}
2040 Set pin DAC1 voltage to 12V, and prints the value (4095).
2042 \subsection{dacpinvoltage*}
2045 Set voltage in mV of a DAC pin
2047 \subsubsection{Command syntax}
2049 \begin{verbatim} dacpinvoltage<PIN> <VALUE>\end{verbatim}
2053 \item \texttt{\mbox{$<$}PIN\mbox{$>$}} is a number in range 1-4
2054 \item \texttt{\mbox{$<$}VALUE\mbox{$>$}} is a number in range 0-12000
2057 \subsubsection{Description}
2060 This command sets the voltage on a DAC pin.
2062 The command always prints the actually set voltage of selected pin. There is no way how to read the value back out of the pin.
2064 \subsubsection{Example}
2066 \begin{verbatim} --> dacpinvoltage1 8000
2067 dacpinvoltage1 =8000\end{verbatim}
2069 Sets pin DAC1 to 8V, prints the actual voltage (8000)
2070 \begin{verbatim} --> dacpinvoltage2 500
2071 dacpinvoltage2 =500\end{verbatim}
2073 Sets pin DAC2 to 500mV, prints actual voltage (500)
2075 \subsection{demomotctrl}
2078 Run motor control demo - reads input and sends it
2080 \subsubsection{Command syntax}
2082 \begin{verbatim} demomotctrl\end{verbatim}
2084 \subsubsection{Description}
2087 This command creates a FlexRay node and starts to read buttons (connected to DIN0 and DIN1) and a potentiometer (ADC1) from a control panel. The read data are sent via FlexRay to the second node, created by running demomotdrive command.
2089 The purpose of this pair of commands is to demonstrate functionality of the FlexRay, ADC, DIN and HBR peripherals.
2091 \subsection{demomotdrive}
2094 Run motor control demo - drives the DC motor
2096 \subsubsection{Command syntax}
2098 \begin{verbatim} demomotdrive\end{verbatim}
2100 \subsubsection{Description}
2103 This command creates a FlexRay node and starts to receive the data from another node created by command demomotctrl. The received data are applied to HBR to control the DC motor.
2105 The purpose of this pair of commands is to demonstrate functionality of the FlexRay, ADC, DIN and HBR peripherals.
2107 \subsection{dinget*}
2110 Read the open/close status of a DIN pin (with the default treshold)
2112 \subsubsection{Command syntax}
2114 \begin{verbatim} dinget<PIN>\end{verbatim}
2116 where PIN is a number in range 0-15
2118 \subsubsection{Description}
2121 The command reads and prints the status of the DIN pin. Value 0 means switch is open, value 1 means switch is closed. The mapping between the DIN voltage and the open/close status depends on the setup of the pin (see dinsetup command).
2123 \subsubsection{Example}
2125 \begin{verbatim} --> dinget1
2126 dinget1 =0\end{verbatim}
2128 DIN1 is in open state.
2130 \subsection{dinsetup*}
2133 Setup DIN pin parameters (Pull up/down, tristate/active, IRQ and wakeup disable/enable)
2135 \subsubsection{Command syntax}
2137 \begin{verbatim} dinsetup<PINS> [A [B [C]]]\end{verbatim}
2141 \item PINS is either a number in range 1-16 or a range written as \texttt{\mbox{$<$}min\mbox{$>$}-\mbox{$<$}max\mbox{$>$}}
2142 \item A is an optional value - either 0 (pull down/switch to battery) or 1 (pull up/switch to ground). The default is 1.
2143 \item B is an optional value - either 0 (tri-state) or 1 (active). The default is 0.
2144 \item C is an optional value - either 0 (wake up and IRQ disabled) or 1 (wake up and IRQ disabled enabled). The default is 1.
2147 \subsubsection{Description}
2150 The command setups properties of one or more DIN pins as specified by \texttt{\mbox{$<$}PIN\mbox{$>$}}. Pins 0-7 can be set as pull up (switch to ground) or pull down (switch to battery), pins 8-15 are hardcoded as switch to ground. All pins can be set to either tri-state or active state and also can have wake-up function with IRQ activated or not.
2152 The command always prints the final settings of each set pin as ABC. The actual configuration cannot be read out of the pin driver.
2154 \subsubsection{Example}
2156 \begin{verbatim} --> dinsetup1 1 0 0
2157 dinsetup1=100\end{verbatim}
2159 Sets the DIN1 as switch to ground, active and disables IRQ generation.
2160 \begin{verbatim} --> dinsetup2
2161 dinsetup2=101\end{verbatim}
2163 Sets the DIN2 as to the default values i.e. switch to battery, tri-state, wake-up/IRQ enabled.
2164 \begin{verbatim} --> dinsetup0-7 1 1 1
2172 dinsetup7=111\end{verbatim}
2174 Sets the DIN0 through DIN7 as switch to ground, tri-state, wake-up/IRQ enabled.
2176 \subsection{dinwatch}
2179 Watch status of all DIN pins
2181 \subsubsection{Command syntax}
2183 \begin{verbatim} dinwatch\end{verbatim}
2185 \subsubsection{Description}
2188 The command reads and prints the status of DIN pins every 100 milliseconds. Columns 0-15 correspond to open/close status of DIN pins with the default threshold of 4 V, columns A-H represent the logical values of pins DIN8-15 when read with programmable threshold. Pin status (open=0, close=1) depends on the pin setup that can be changed with dinsetup command, programmable threshold can be set with TODO command.
2190 Press any key to end this command.
2192 \subsubsection{Example}
2194 \begin{verbatim} --> dinwatch
2195 Digital Inputs Test [0-15]:
2196 ===========================================================
2197 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A B C D E F G H
2198 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1\end{verbatim}
2203 Examine emac buffer descriptors
2205 \subsubsection{Command syntax}
2207 \begin{verbatim} ethbd\end{verbatim}
2209 \subsubsection{Description}
2212 After startup you use keys to control what will be done.
2215 \item s - general statistics
2216 \item t - transmit channel status
2217 \item r - receive channel status
2218 \item b - after giving address of bd it prints bd content
2219 \item a - checks consistency of buffer descriptors
2222 \subsubsection{Example}
2224 \begin{verbatim} --> ethbd\end{verbatim}
2226 \subsection{ethernet}
2229 Temporary command to test Ethernet communication
2231 \subsubsection{Command syntax}
2233 \begin{verbatim} ethernet\end{verbatim}
2235 \subsubsection{Description}
2238 Command tries to send a few ethernet frames. No real connection or meaningful packets are sent. This only tests, if Ethernet is just working.
2240 \subsection{ethinit}
2243 Post OS startup eth initialization
2245 \subsubsection{Command syntax}
2247 \begin{verbatim} ethinit\end{verbatim}
2249 \subsubsection{Description}
2252 This command finishes autonegotiation of PHY and initialize LwIP stack.
2254 \subsubsection{Example}
2256 \begin{verbatim} --> ethinit\end{verbatim}
2261 Print current IP address of network interface
2263 \subsubsection{Command syntax}
2265 \begin{verbatim} ethip\end{verbatim}
2267 \subsubsection{Description}
2270 This command reads current IP address, netmask and gateway of network interface and prints these to the output.
2272 \subsubsection{Example}
2274 \begin{verbatim} --> ethip
2275 Address: 192.168.247.1
2276 Netmask: 255.255.255.0
2277 Gateway: 192.168.247.255\end{verbatim}
2279 \subsection{ethlinkstat}
2282 Print current status of ethernet interface
2284 \subsubsection{Command syntax}
2286 \begin{verbatim} ethlinkstat\end{verbatim}
2288 \subsubsection{Description}
2291 This command reads PHY link status assigned to ethernet interface and prints interface name and informs about PHY's status to the output.
2293 \subsubsection{Example}
2295 \begin{verbatim} --> ethlinkstat
2299 et0 : DOWN\end{verbatim}
2304 Print current MAC address of ethernet interface
2306 \subsubsection{Command syntax}
2308 \begin{verbatim} ethmac\end{verbatim}
2310 \subsubsection{Description}
2313 This command obtains MAC address from ethernet interface structure and prints it to the output.
2315 \subsubsection{Example}
2317 \begin{verbatim} --> ethmac
2318 12:34:56:78:9a:bc\end{verbatim}
2323 Start very simple netcat
2325 \subsubsection{Command syntax}
2327 \begin{verbatim} ethnc <IP> <PORT> [-p <PORT>] [-u] [-m [-t] | -d [-t]] [-c]
2328 ethnc -l <PORT> [-u] [-m [-t] | -d [-t]] [-c]\end{verbatim}
2330 \subsubsection{Description}
2333 Netcat is a program which allows to communicate using TCP or UDP protocols. First a connection is established by either:
2335 \item connecting to a specified IP address and PORT (without option -l) or by
2336 \item listening for a new connection on a given PORT (with option -l).
2339 When no -u option is specified ethnc command works with TCP connections. With -u option UDP communication is used. Listening for connection on UDP means waiting for reception of any UDP datagram.
2341 Once the connection is established the command works in one of the following modes:
2343 \item interactive mode in which received data are forwarded to serial line and data received on serial line are sent to the connection when either new line is encountered or when internal buffer is full,
2344 \item sending of testing data (increasing ASCII formatted numbers) (option -d),
2345 \item looping of incoming data back to the connection's peer (option -m).
2348 Note: When trying to use a same local TCP port number multiple times in a row (-l or -p options) there might be several minutes delay before the port is available after closing the previous connection. This situation is singled with ERROR 31.
2352 \item -p specifies local port for outgoing connections.
2353 \item -u use UDP protocol instead of the default TCP.
2354 \item -t send and/or receive data in a background thread (works only with -d or -m options).
2355 \item -c stop all running background tasks
2358 \subsubsection{Examples}
2361 Listen for incoming TCP connection on local port 2000: --\mbox{$>$} ethnc -l 2000
2363 Connect using TCP to address 192.168.247.15 to remote port 80 using local port 1500: --\mbox{$>$} ethnc 192.168.247.15 80 -p 1500
2365 Send testing data to the remote node: --\mbox{$>$} ethnc -d 192.168.247.2 1025
2367 Loop back all data coming from remote node's UDP port 1025: --\mbox{$>$} ethnc -m -u 192.168.247.2 1025
2369 Wait for a TCP connection on local port 30000 and loop all incoming data back: --\mbox{$>$} ethnc -l 30000 -m
2371 \subsection{fraytestA}
2374 Run the FlexRay test as A node
2376 \subsubsection{Command syntax}
2378 \begin{verbatim} fraytestA [<COUNT>]\end{verbatim}
2380 where \texttt{\mbox{$<$}COUNT\mbox{$>$}} is an optional number of messages to send. The default is 100.
2382 \subsubsection{Description}
2385 The commands creates FlexRay node A and starts sending a message approximately every communication cycle. COUNT messages are sent for the test of the connection. The command should be run with two devices connected by a FlexRay bus and the second device should be running the fraytestB command (it is necessary to run both commands shortly after each other).
2387 When the command transmits a message a character is printed. O means that the message was transmitted correctly, X signals a transmission error. The number of TX errors and successfully transmitted messages is maintained during the test and printed at the end.
2389 \subsection{fraytestB}
2392 Run the FlexRay test as B node
2394 \subsubsection{Command syntax}
2396 \begin{verbatim} fraytestB [<COUNT>]\end{verbatim}
2398 where \texttt{\mbox{$<$}COUNT\mbox{$>$}} is an optional number of messages to receive. The default is 100.
2400 \subsubsection{Description}
2403 The commands creates FlexRay node B and starts receiving a messages. 100 messages should be received. The command should be run with two devices connected by a FlexRay bus and the second device should be running the fraytestA command (it is necessary to run both commands shortly after each other).
2405 When the command receives a message a character is printed. O means that the message was received correctly, X signals an error in data, T means timeout (i.e. no message was received within 63 cycles). The number of RX errors and successfully received messages is maintained during the test and printed at the end.
2407 \subsection{frayxcvrstat\#}
2410 Get the status of a FlexRay transceiver in a human readable form
2412 \subsubsection{Command syntax}
2414 \begin{verbatim} frayxcvrstat<CHN>\end{verbatim}
2416 where CHN is a number in range 1-2
2418 \subsubsection{Description}
2421 The command receives response from a FlexRay transceiver via SPI, and prints in the form of attribute-value table.
2423 \subsubsection{Example}
2425 \begin{verbatim} --> frayxcvrstat1\end{verbatim}
2427 Prints the status of FRAY1 transceiver.
2429 \subsection{frbtabort}
2432 Abort FlexRay communication immediately
2434 \subsubsection{Command syntax}
2436 \begin{verbatim} frbtabort\end{verbatim}
2438 \subsubsection{Description}
2441 The command stands for Fr\_AbortCommunication function from the Autosar specification. The command invokes the FlexRay POC command FREEZE, which means that the communication is stopped immediately. On the opposite side there is a frbthalt command, which stops the communication after the end of the actual communication cycle. To restart the communication, the frbtinit and frbtstart commands have to be called.
2443 \subsubsection{Example}
2445 \begin{verbatim} --> frbtabort
2446 FlexRay node communication aborted.\end{verbatim}
2448 \subsection{frbtallslots}
2451 Enables communication for all frames
2453 \subsubsection{Command syntax}
2455 \begin{verbatim} frbtallslots\end{verbatim}
2457 \subsubsection{Description}
2460 The command stands for Fr\_AllSlots function from the Autosar specification.
2462 The node can be configured to communicate only on key frames by default (as in the case of frbtinitA/B). This command can be used to allow the communication on all configured frames. The command invokes the FlexRay POC command ALL\_SLOTS which enables the communication on all frames. The command can be called after the controller initialization.
2464 \subsubsection{Example}
2466 \begin{verbatim} --> frbtallslots
2467 FlexRay node started communication on all slots.\end{verbatim}
2469 \subsection{frbtcanceltimer*}
2474 \subsubsection{Command syntax}
2476 \begin{verbatim} frbtcanceltimer<TMID>\end{verbatim}
2478 where \texttt{\mbox{$<$}TMID\mbox{$>$}} is a number (0 or 1) specifying the timer.
2480 \subsubsection{Description}
2483 The command stands for Fr\_CancelAbsoluteTimer function from the Autosar specification. It stops the timer selected by the parameter.
2485 \subsubsection{Example}
2487 \begin{verbatim} --> frbtcanceltimer0
2488 Timer was canceled.\end{verbatim}
2490 \subsection{frbtcanceltx*}
2493 Stop the transmission of the frame
2495 \subsubsection{Command syntax}
2497 \begin{verbatim} frbtcanceltx<FRID>\end{verbatim}
2499 where \texttt{\mbox{$<$}FRID\mbox{$>$}} is a decimal number specifying the ID of the frame for which a buffer has been configured.
2501 \subsubsection{Description}
2504 The command stands for Fr\_CancelTxLPdu function from the Autosar specification. The command finds all buffers assigned to the specified frame ID and reconfigures them to stop transmitting data. The command finishes successfully only if reconfiguration is allowed in message RAM configuration (secureBuffers configuration parameter). Only TX buffers and buffers not used for startup frames can be canceled.
2506 \subsubsection{Example}
2508 \begin{verbatim} --> frbtcanceltx3
2509 Transmission canceled.\end{verbatim}
2511 \subsection{frbtccconfig*}
2514 Print value of a FlexRay cluster and node configuration parameter
2516 \subsubsection{Command syntax}
2518 \begin{verbatim} frbtccconfig<INDEX>\end{verbatim}
2520 where \texttt{\mbox{$<$}INDEX\mbox{$>$}} is an identifier of the parameter.
2522 \subsubsection{Description}
2525 The command stands for Fr\emph{ReadCCConfig function from the Autosar specification. The driver stores the configuration parameters as an array. Each parameter can be indexed and returned by this command. See Autosar specification of the FlexRay driver (http://www.autosar.org/download/R4.1/AUTOSAR}SWS\_FlexRayDriver.pdf), section 8.2.1 for parameter indexes.
2527 \subsubsection{Example}
2529 \begin{verbatim} --> frbtccconfig1
2530 Value = 0x1\end{verbatim}
2532 \subsection{frbtcfgbuf?*}
2535 Configure a message buffer in the user configuration
2537 \subsubsection{Command syntax}
2539 \begin{verbatim} frbtcfgbuf<TYPE><NUM> slot<SLOT> <CHN> cyc<CYC> <RXTX> max<MAX> <REP> ppi<PPI> int<INT>\end{verbatim}
2543 \item \texttt{\mbox{$<$}TYPE\mbox{$>$}} is 'S' for static segment buffers and 'D' for dynamic segment buffers,
2544 \item \texttt{\mbox{$<$}NUM\mbox{$>$}} is the number of the buffer. Both static and dynamic buffers are numbered independently starting from zero,
2545 \item \texttt{\mbox{$<$}SLOT\mbox{$>$}} is the number of the slot,
2546 \item \texttt{\mbox{$<$}CHN\mbox{$>$}} is one of 'A', 'B' or 'AB' and identifies the used channel,
2547 \item \texttt{\mbox{$<$}CYC\mbox{$>$}} is the cycle set when to send the buffer,
2548 \item \texttt{\mbox{$<$}RXTX\mbox{$>$}} is either string \"{}rx\"{} or \"{}tx\"{},
2549 \item \texttt{\mbox{$<$}MAX\mbox{$>$}} is the number determining the maximum payload (in hald-words),
2550 \item \texttt{\mbox{$<$}REP\mbox{$>$}} is a string \"{}s\"{} or \"{}single\"{} for single transmission or \"{}c\"{} or \"{}continuous\"{} for continuous transmission,
2551 \item \texttt{\mbox{$<$}PPI\mbox{$>$}} is 0 or 1 determining whether the payload preamble indicator is set,
2552 \item \texttt{\mbox{$<$}INT\mbox{$>$}} is 0 or 1 and is currently ignored.
2555 \subsubsection{Description}
2558 The command sets the configuration parameters for static or dynamic buffers in user configuration. The parameters set by this command are applied by the frbtinitU command. Once frbtinit is called, it is no longer possible to change the parameters.
2560 \subsubsection{Example}
2562 \begin{verbatim} --> frbtcfgbufS0 slot2 AB cyc0 tx max9 continous ppi0 int1
2563 frbtcfgbufS0 slot2 AB cyc0 tx max9 continous ppi0 int1
2564 --> frbtcfgbufS1 slot1 AB cyc0 rx max9 continuous ppi0 int1
2565 frbtcfgbufS1 slot1 AB cyc0 rx max9 continuous ppi0 int1
2566 --> frbtcfgbufD0 slot9 A cyc0 rx max0x40 single ppi0 int0
2567 frbtcfgbufD0 slot9 A cyc0 rx max64 single ppi0 int0
2568 --> frbtcfgbufD1 slot10 A cyc0 tx max0x40 single ppi0 int0
2569 frbtcfgbufD1 slot10 A cyc0 tx max64 single ppi0 int0\end{verbatim}
2571 \subsection{frbtcfgfifo*}
2574 Configure a RX FIFO message buffer in the user configuration
2576 \subsubsection{Command syntax}
2578 \begin{verbatim} frbtcfgfifo rejslot<SLOT> slotmask<MASK> depth<DEPTH> <CHN> cyc<CYC> max<MAX> <REJNULL> <REJSTAT>\end{verbatim}
2580 where - \texttt{\mbox{$<$}SLOT\mbox{$>$}} is the number of the slot that will be rejected. If it is 0, no slot will be rejected, - \texttt{\mbox{$<$}MASK\mbox{$>$}} is a number specifying which bits of the \texttt{\mbox{$<$}SLOT\mbox{$>$}} will be ignored,- \texttt{\mbox{$<$}DEPTH\mbox{$>$}} is a number specifying the depth of the FIFO, - \texttt{\mbox{$<$}CHN\mbox{$>$}} is one of 'A', 'B' or 'AB' and identifies the used channel, - \texttt{\mbox{$<$}CYC\mbox{$>$}} is the cycle set when to send the buffer, - \texttt{\mbox{$<$}MAX\mbox{$>$}} is the number determining the maximum payload (in hald-words), - \texttt{\mbox{$<$}REJNULL\mbox{$>$}} is a string \"{}rejnull\"{} for rejecting NULL frames or \"{}accnull\"{} for accepting NULL frames, - \texttt{\mbox{$<$}REJSTAT\mbox{$>$}} is a string \"{}rejstat\"{} for rejecting frames in static segment or \"{}accstat\"{} for accepting frames from static segment,
2582 \subsubsection{Description}
2585 The command sets the configuration parameters for RX FIFO buffer in user configuration. The parameters set by this command are applied by the frbtinitU command. Once frbtinit is called, it is no longer possible to change the parameters. Those messages, which are not accepted by any other buffer and pass the FIFO rejection filter will be stored in the RX FIFO buffer.
2587 \subsubsection{Example}
2589 \begin{verbatim} --> frbtcfgfifo rejslot6 slotmask6 depth5 AB cyc0 max0x20 rejnull accstat
2590 frbtcfgfifo rejslot6 slotmask6 depth5 AB cyc0 max0x20 rejnull accstat\end{verbatim}
2592 \subsection{frbtchecktx*}
2595 Print the status of the transmit buffer
2597 \subsubsection{Command syntax}
2599 \begin{verbatim} frbtchecktx<FRID>\end{verbatim}
2601 where \texttt{\mbox{$<$}FRID\mbox{$>$}} is a decimal number specifying the ID of the frame for which a buffer has been configured.
2603 \subsubsection{Description}
2606 The command stands for Fr\_CheckTxLPduStatus function from the Autosar specification. The command finds the first buffer assigned to the specified frame ID, reads its status and prints it. The buffer can be in one of the two states:
2608 \item Message transmission is pending, which means that the buffer has not yet sent its message in single shot mode or that it is in continuous mode.
2609 \item No message transmission is pending, which means that the buffer is in single shot mode and the message has already been sent.
2612 \subsubsection{Example}
2614 \begin{verbatim} --> frbtchecktx1
2615 Message transmission is not pending.\end{verbatim}
2617 \subsection{frbtchstat}
2620 Print channel A and B status
2622 \subsubsection{Command syntax}
2624 \begin{verbatim} frbtchstat\end{verbatim}
2626 \subsubsection{Description}
2629 The command stands for Fr\_GetChannelStatus function from the Autosar specification.
2631 \subsubsection{Example}
2633 \begin{verbatim} --> frbtchstat
2635 aggregated channel status vSS!ValidFrame: TRUE
2636 aggregated channel status vSS!SyntaxError: FALSE
2637 aggregated channel status vSS!ContentError: FALSE
2638 aggregated channel status additional communication: FALSE
2639 aggregated channel status vSS!Bviolation: FALSE
2640 aggregated channel status vSS!TxConflict: FALSE
2643 symbol window status data vSS!ValidMTS: FALSE
2644 symbol window status data vSS!SyntaxError: FALSE
2645 symbol window status data vSS!Bviolation: FALSE
2646 symbol window status data vSS!TxConflict: FALSE
2647 NIT status data vSS!SyntaxError: FALSE
2648 NIT status data vSS!Bviolation: FALSE
2652 aggregated channel status vSS!ValidFrame: TRUE
2653 aggregated channel status vSS!SyntaxError: FALSE
2654 aggregated channel status vSS!ContentError: FALSE
2655 aggregated channel status additional communication: FALSE
2656 aggregated channel status vSS!Bviolation: FALSE
2657 aggregated channel status vSS!TxConflict: FALSE
2660 symbol window status data vSS!ValidMTS: FALSE
2661 symbol window status data vSS!SyntaxError: FALSE
2662 symbol window status data vSS!Bviolation: FALSE
2663 symbol window status data vSS!TxConflict: FALSE
2664 NIT status data vSS!SyntaxError: FALSE
2665 NIT status data vSS!Bviolation: FALSE
2667 Not used (0): FALSE\end{verbatim}
2669 \subsection{frbtclkcor}
2672 Print clock correction (rate and offset)
2674 \subsubsection{Command syntax}
2676 \begin{verbatim} frbtclkcor\end{verbatim}
2678 \subsubsection{Description}
2681 The command stands for Fr\_GetClockCorrection function from the Autosar specification.
2683 \subsubsection{Example}
2685 \begin{verbatim} --> frbtclkcor
2687 Offset correction: 0\end{verbatim}
2689 \subsection{frbtconfig*}
2692 Set the user configuration parameters
2694 \subsubsection{Command syntax}
2696 \begin{verbatim} frbtconfig<TYPE> <PARAMS>\end{verbatim}
2700 \item \texttt{\mbox{$<$}TYPE\mbox{$>$}} is a string specifying the type of parameters to be set. It can be: \"{}cluster\"{} or \"{}node\"{}
2701 \item \texttt{\mbox{$<$}PARAMS\mbox{$>$}} is a sequence of numbers separated by spaces. Each number stands for one parameter.
2704 \subsubsection{Description}
2707 The command takes the configuration parameters in the form of a string and sets the appropriate type of the FlexRay parameters. It is necessary to configure parameters of at least cluster, and node and one static buffer (see frbtcfgbuf command). The parameters set by this command are applied by the frbtinitU command. Once frbtinit is called, it is no longer possible to change the parameters.
2709 The type of the parameters can be selected by the \texttt{\mbox{$<$}TYPE\mbox{$>$}} selector.
2711 Type \"{}cluster\"{} sets global FlexRay network parameters. It expects a sequence of 25 parameters in this order:
2713 \item 1) gColdStartAttempts
2714 \item 2) gListenNoise
2715 \item 3) gMacroPerCycle
2716 \item 4) gMaxWithoutClockCorrectionFatal
2717 \item 5) gMaxWithoutClockCorrectionPassive
2718 \item 6) gNetworkManagementVectorLength
2719 \item 7) gNumberOfMinislots
2720 \item 8) gNumberOfStaticSlots
2721 \item 9) gOffsetCorrectionStart
2722 \item 10) gPayloadLengthStatic
2723 \item 11) gSyncNodeMax
2724 \item 12) gdActionPointOffset
2725 \item 13) gdCASRxLowMax
2726 \item 14) gdDynamicSlotIdlePhase
2727 \item 15) gdMinislot
2728 \item 16) gdMinislotActionPointOffset
2730 \item 18) gdSampleClockPeriod
2731 \item 19) gdStaticSlot
2732 \item 20) gdTSSTransmitter
2733 \item 21) gdWakeupSymbolRxIdle
2734 \item 22) gdWakeupSymbolRxLow
2735 \item 23) gdWakeupSymbolRxWindow
2736 \item 24) gdWakeupSymbolTxIdle
2737 \item 25) gdWakeupSymbolTxLow
2740 Type \"{}node\"{} sets local FlexRay network parameters. It expects a sequence of 28 parameters in this order:
2742 \item 1) pAllowHaltDueToClock
2743 \item 2) pAllowPassiveToActive
2744 \item 3) pChannels (0 - A, 1 - B, 2 - AB)
2745 \item 4) pClusterDriftDamping
2746 \item 5) pDelayCompensationA
2747 \item 6) pDelayCompensationB
2748 \item 7) pExternOffsetCorrection
2749 \item 8) pExternRateCorrection
2750 \item 9) pKeySlotUsedForStartup
2751 \item 10) pKeySlotUsedForSync
2753 \item 12) pMacroInitialOffsetA
2754 \item 13) pMacroInitialOffsetB
2755 \item 14) pMicroInitialOffsetA
2756 \item 15) pMicroInitialOffsetB
2757 \item 16) pMicroPerCycle
2758 \item 17) pRateCorrectionOut
2759 \item 18) pOffsetCorrectionOut
2760 \item 19) pSamplesPerMicrotick
2761 \item 20) pSingleSlotEnabled
2762 \item 21) pWakeupChannel (0 - A, 1 - B)
2763 \item 22) pWakeupPattern
2764 \item 23) pdAcceptedStartupRange
2765 \item 24) pdListenTimeout
2766 \item 25) pdMaxDrift
2767 \item 26) pDecodingCorrection
2768 \item 27) syncFramePayloadMultiplexEnabled
2769 \item 28) secureBuffers (0 - FR\emph{SB}RECONFIG\emph{ENABLED, 1 - FR}SB\emph{STAT}REC\emph{DISABLED}STAT\emph{TR}DISABLED, 2 - FR\emph{SB}ALL\emph{REC}DISABLED, 3 - FR\emph{SB}ALL\emph{REC}DISABLED\emph{STAT}TR\_DISABLED)
2772 \subsubsection{Example}
2774 \begin{verbatim} --> frbtconfigcluster 0x2 0xF 0x15E0 0xF 0xF 0xC 0x15A 0x8 0xAE4 0x9 0xF 0x4 0x43 0x1 0x4 0x2 0xAE3 0x0 0x56 0xA 0x12 0x12 0x4C 0xB4 0x3C
2775 FlexRay cluster configuration accepted.
2776 --> frbtconfignode 0x0 0x0 0x2 0x1 0x3 0x3 0x0 0x0 0x1 0x1 0x10D 0x6 0x6 0x18 0x18 0x36B00 0xCD 0x151 0x0 0x1 0x0 0x2 0x81 0x36DA2 0x151 0x33 0x0 0x0
2777 FlexRay node configuration accepted.\end{verbatim}
2779 \subsection{frbtdisable*}
2782 Disable the buffers assigned to the frame
2784 \subsubsection{Command syntax}
2786 \begin{verbatim} frbtdisable<FRID>\end{verbatim}
2788 where \texttt{\mbox{$<$}FRID\mbox{$>$}} is a decimal number specifying the ID of a frame. The buffers configure for this frame will be disabled.
2790 \subsubsection{Description}
2793 The command stands for Fr\_DisableLPdu function from the Autosar specification. The command finds all buffers assigned to the specified frame ID and disables them. This means that those buffers will be unavailable for the communication until their reconfiguration (which is not yet implemented). Buffers used for startup frames and FIFO RX buffers cannot be disabled.
2795 \subsubsection{Example}
2797 \begin{verbatim} --> frbtdisable3
2798 Buffer disabled.\end{verbatim}
2800 \subsection{frbtgetpocst}
2803 Print FlexRay POC status
2805 \subsubsection{Command syntax}
2807 \begin{verbatim} frbtgetpocst\end{verbatim}
2809 \subsubsection{Description}
2812 The command stands for Fr\_GetPOCStatus function from the Autosar specification. It prints the main FlexRay POC status values in the form of a table. The command should be called after the frbtinit command.
2814 \subsubsection{Example}
2816 \begin{verbatim} --> frbtgetpocst
2818 CHIHaltRequest: FALSE
2819 CHIReadyRequest: FALSE
2820 ColdstartNoise: FALSE
2824 StartupState: UNDEFINED
2826 WakeupStatus: UNDEFINED\end{verbatim}
2828 \subsection{frbtgetsyncfrlist*}
2831 Print the list of sync frames transmitted on both channels via the odd and even communication cycle
2833 \subsubsection{Command syntax}
2835 \begin{verbatim} frbtgetsyncfrlist<LENGTH>\end{verbatim}
2837 where \texttt{\mbox{$<$}LENGTH\mbox{$>$}} is a decimal number in range 0 - 15, specifying the length of the list to be printed.
2839 \subsubsection{Description}
2842 The command stands for Fr\_GetSyncFrameList function from the Autosar specification.
2844 \subsubsection{Example}
2846 \begin{verbatim} --> frbtgetsyncfrlist2
2847 | Channel A even | channel B even | channel A odd | channel B odd |
2848 |----------------|----------------|----------------|----------------|
2851 |----------------|----------------|----------------|----------------|\end{verbatim}
2853 \subsection{frbtgetwurxstat}
2856 Prints whether the wake up pattern has been or has not been received
2858 \subsubsection{Command syntax}
2860 \begin{verbatim} frbtgetwurxstat\end{verbatim}
2862 \subsubsection{Description}
2865 The command stands for Fr\_GetWakeupRxStatus function from the Autosar specification. The status of the wake up receiving is bitcoded in the controller. This command decodes and prints it in a readable format.
2867 \subsubsection{Example}
2869 \begin{verbatim} --> frbtgetwurxstat
2870 Wake up pattern was not yet received on channel A.
2871 Wake up pattern was not yet received on channel B.\end{verbatim}
2873 \subsection{frbtglobtime}
2876 Print actual global time of the network
2878 \subsubsection{Command syntax}
2880 \begin{verbatim} frbtglobtime\end{verbatim}
2882 \subsubsection{Description}
2885 The command stands for Fr\_GetGlobalTime function from the Autosar specification. The command prints the time as a number of the current cycle and the offset in the cycle in macroticks.
2887 \subsubsection{Example}
2889 \begin{verbatim} --> frbtglobtime
2891 Macrotick number: 6\end{verbatim}
2893 \subsection{frbthalt}
2896 Halt FlexRay communication after the end of the actual communication cycle
2898 \subsubsection{Command syntax}
2900 \begin{verbatim} frbthalt\end{verbatim}
2902 \subsubsection{Description}
2905 The command stands for Fr\_HaltCommunication function from the Autosar specification. The command invokes the FlexRay POC command HALT, which means that communication is stopped after the end of the actual communication cycle. On the opposite side, there is a frbtfreeze command, which stops the communication immediately. To restart the communication, the frbtinit and frbtstart commands have to be called.
2907 \subsubsection{Example}
2909 \begin{verbatim} --> frbthalt
2910 FlexRay node communication halted.\end{verbatim}
2912 \subsection{frbtinit?}
2915 Initialize a FlexRay node
2917 \subsubsection{Command syntax}
2919 \begin{verbatim} frbtinit<CFG>\end{verbatim}
2921 where \texttt{\mbox{$<$}CFG\mbox{$>$}} identifies the configuration to use. It can be one of A, B or U. The A and B are predefined configurations. If U is specified, the user configuration previously set by frbtconfig command is used.
2923 \subsubsection{Description}
2926 The command stands for Fr\emph{Init and Fr}ControllerInit functions from the Autosar specification. It initializes the internal data structures of the driver and then, based on those data, the controller configuration is done. During the controller configuration the parameters of the cluster, node, message RAM and buffers are checked. If anything goes bad, the command returns an error number, which can be decoded by macros defined in driver header file fr\emph{tms570.h with prefix ERR}PARAM. If all parameters are OK, all necessary registers of the controller are initialized according to the specified configuration parameters. At the end of the command, the FlexRay controller is switched into READY state and all buffers are configured to send NULL frames. This command should be called as the very first command, when trying to communicate over the FlexRay bus.
2928 \subsubsection{Example}
2930 \begin{verbatim} --> frbtinitA
2931 FlexRay driver initialized.
2932 FlexRay controller initialized.\end{verbatim}
2934 \subsection{frbtnmvector}
2937 Print network management vector of the node
2939 \subsubsection{Command syntax}
2941 \begin{verbatim} frbtnmvector\end{verbatim}
2943 \subsubsection{Description}
2946 The command stands for Fr\_GetNmVector function from the Autosar specification. It prints the values of the network management vector as hexadecimal numbers.
2948 \subsubsection{Example}
2950 \begin{verbatim} --> frbtnmvector
2951 Network management vector: 0 0 0 0 0 0 0 0 0 0 0 0\end{verbatim}
2953 \subsection{frbtnmwatch}
2956 Watch the changes of the network managment vector in real-time
2958 \subsubsection{Command syntax}
2960 \begin{verbatim} frbtnmwatch\end{verbatim}
2962 \subsubsection{Description}
2965 Reads the network management vector every 100 ms and prints it out.
2967 \subsubsection{Example}
2969 \begin{verbatim} --> frbtnmwatch
2970 Network management vector: 0 0 0 0 0 0 0 0 0 0 0 0\end{verbatim}
2972 \subsection{frbtreceive*}
2975 Receive a new message
2977 \subsubsection{Command syntax}
2979 \begin{verbatim} frbtreceive<FRID>\end{verbatim}
2981 where \texttt{\mbox{$<$}FRID\mbox{$>$}} is a decimal number specifying the ID of the frame for which a buffer was configured.
2983 \subsubsection{Description}
2986 The command stands for Fr\_ReceiveRxLPdu function from the Autosar specification. The command finds the first buffer assigned to the specified frame ID, determines if a new message has been received and reads it out of the buffer. If no message was received, \"{}No message received\"{} is printed. If a new message was received, all message data are printed as a hexadecimal values. If a new message was retrieved from a FIFO buffer and more messages are available in it, \"{}More messages are still in FIFO\"{} is printed.
2988 \subsubsection{Example}
2990 \begin{verbatim} --> frbtreceive0
2991 More messages are still in FIFO:
2992 Received message (32 B):
2993 ee ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\end{verbatim}
2995 \subsection{frbtreconfigurebuf*}
2998 Reconfigure a buffer to communicate in another slot
3000 \subsubsection{Command syntax}
3002 \begin{verbatim} frbtreconfigurebuf id<ID> slot<SLOT> <CHN> cycset<CYCS> cycoffset<CYCO> max<MAX>\end{verbatim}
3006 \item \texttt{\mbox{$<$}ID\mbox{$>$}} is a number specifying a slot, where the buffer is currently communicating,
3007 \item \texttt{\mbox{$<$}SLOT\mbox{$>$}} is a number, where buffer will be communicating after the reconfiguration,
3008 \item \texttt{\mbox{$<$}CHN\mbox{$>$}} is one of 'A', 'B' or 'AB' and identifies the used channel,
3009 \item \texttt{\mbox{$<$}CYCS\mbox{$>$}} is the cycle set. It has to be one of 0, 1, 2, 4, 8, 16, 32, 64. It specifies together with \texttt{\mbox{$<$}CYCO\mbox{$>$}} the cycle filtering.
3010 \item \texttt{\mbox{$<$}CYCO\mbox{$>$}} is the cycle offset. It has to be in range 0 - \texttt{\mbox{$<$}CYCS\mbox{$>$}}-1- \texttt{\mbox{$<$}MAX\mbox{$>$}} is the number determining the maximum payload (in hald-words).
3013 \subsubsection{Description}
3016 The command stands for Fr\_ReconfigLPDu function from the Autosar specification. It reconfigures specified buffer to communicate in different slot. The reconfiguration must be allowed in node configuration parameter secureBuffers. Buffers used for synchronization or assigned to the FIFO are not reconfigurable. The command can be called any time when the communication is running.
3018 \subsubsection{Example}
3020 \begin{verbatim} --> frbtreconfigurebuf id2 slot3 AB cycset1 cycoffset0 max9
3021 frbtreconfigurebuf id2 slot3 AB cycset1 cycoffset0 max9\end{verbatim}
3023 \subsection{frbtsettimer*}
3028 \subsubsection{Command syntax}
3030 \begin{verbatim} frbtsettimer<TMID> <CYCLE> <OFFSET>\end{verbatim}
3034 \item \texttt{\mbox{$<$}TMID\mbox{$>$}} is a number (0, 1) specifying the timer.
3035 \item \texttt{\mbox{$<$}CYCLE\mbox{$>$}} is a 7-bit number (0 - 127) specifying the set of cycles, in which timer interrupt should be requested. The first set bit determines the period (1, 2, ..., 64) and the lower bits determine the offset in cycles within the period.
3036 \item \texttt{\mbox{$<$}OFFSET\mbox{$>$}} is a decimal number (0 - 16383) specifying the offset in macroticks, where precisely in the cycle should be the timer interrupt requested.
3039 \subsubsection{Description}
3042 The command is similar to Fr\_SetAbsoluteTimer function from the Autosar specification. The difference is that the command allows to specify a set of cycles, not only one of 64 cycles. It sets the timer selected by the parameter and enables it.
3044 Before using this command, FlexRay communication has to be started (see frbtstart).
3046 \subsubsection{Example}
3048 \begin{verbatim} --> frbtsettimer0 32 50
3049 Timer was set for every 32-th cycle, offset 0, macrotick 50
3050 --> frbtsettimer0 31 50
3051 Timer was set for every 16-th cycle, offset 15, macrotick 50
3052 --> frbtsettimer0 0x42 0
3053 Timer was set for every 64-th cycle, offset 2, macrotick 0\end{verbatim}
3055 \subsection{frbtsetwuch?}
3060 \subsubsection{Command syntax}
3062 \begin{verbatim} frbtsetwuch<CHANNEL>\end{verbatim}
3064 where \texttt{\mbox{$<$}CHANNEL\mbox{$>$}} is a character A or B, specifying the channel.
3066 \subsubsection{Description}
3069 The command stands for Fr\_SetWakeupChannel function from the Autosar specification. Wake up channel is the channel, where Wake Up Pattern is sent. The channel can be set after the driver and controller are initialized and before the communication is running. The actual wake-up pattern is sent by the frbtwup command.
3071 \subsubsection{Example}
3073 \begin{verbatim} --> frbtsetwuchA
3074 Wake up channel has been set.\end{verbatim}
3076 \subsection{frbtstart}
3079 Start a new FlexRay network or join to the existing one
3081 \subsubsection{Command syntax}
3083 \begin{verbatim} frbtstart\end{verbatim}
3085 \subsubsection{Description}
3088 The command stands for Fr\_StartCommunication function from the Autosar specification. If the FlexRay node is configured as a coldstarter node (as for example by frbtinitA/B command), then the command first listen on the bus. When it does not detect any existing bus communication, it tries to initiate a new network. If the initiation fails, the FlexRay controller is switched back to the ready state for another attempt (calling frbtstart again). If the FlexRay node is configured as non-coldstarter, it is listening on the bus until some existing communication is detected.
3090 The command should be called after the frbtinit command.
3092 \subsubsection{Example}
3094 \begin{verbatim} --> frbtstart
3095 FlexRay communication is running.\end{verbatim}
3097 \subsection{frbttimerirq*}
3100 Perform selected action on the timer IRQ
3102 \subsubsection{Command syntax}
3104 \begin{verbatim} frbttimerirq<TMID> <ACTION> - Run the <ACTION> on specified timer
3105 frbttimerirq<TMID> - Get timer IRQ status\end{verbatim}
3109 \item \texttt{\mbox{$<$}TMID\mbox{$>$}} is a number (0, 1) specifying the timer.
3110 \item where \texttt{\mbox{$<$}ACTION\mbox{$>$}} is a string specifying the action to be performed on the selected timer IRQ.
3113 \texttt{\mbox{$<$}ACTIONS\mbox{$>$}} can be one of:
3115 \item EN - Enable the IRQ on the selected timer
3116 \item DIS - Disable the IRQ on the selected timer
3117 \item ACK - Acknowledge the IRQ on the selected timer (reset flag in the register).
3120 \subsubsection{Description}
3123 The command stands for Fr\emph{EnableAbsoluteTimerIRQ, Fr}AckAbsoluteTimerIRQ, Fr\emph{DisableAbsoluteTimerIRQ and Fr}GetAbsoluteTimerIRQStatus functions from the Autosar specification. It masks or demasks the IRQ for the timer, or acknowledges the interrupt request. If no action is specified it prints whether the IRQ is pending for the timer.
3125 \subsubsection{Example}
3127 \begin{verbatim} --> frbttimerirq0
3130 --> frbttimerirq0 EN
3133 \subsection{frbttransmit*}
3136 Transmit data in selected frame
3138 \subsubsection{Command syntax}
3140 \begin{verbatim} frbttransmit<FRID> <DATA>\end{verbatim}
3144 \item \texttt{\mbox{$<$}FRID\mbox{$>$}} is a decimal number specifying the ID of the frame for which a buffer has been configured.
3145 \item \texttt{\mbox{$<$}DATA\mbox{$>$}} is a sequence of hexadecimal numbers separated by spaces. Each number represents one byte of the message.
3148 \subsubsection{Description}
3151 The command stands for Fr\_TransmitTxLPdu function from the Autosar specification. The command finds the first buffer assigned to the specified frame ID and copies the given data into its data section in the message RAM. Transmit request is set after the data are copied, so transmission starts at the next occurrence of the frame in the communication cycle.
3153 \subsubsection{Example}
3155 \begin{verbatim} --> frbttransmit1 12 34 56 AA BB CC
3156 Data were set for transmission.\end{verbatim}
3158 \subsection{frbtversion}
3161 Print FlexRay driver version information
3163 \subsubsection{Command syntax}
3165 \begin{verbatim} frbtversion\end{verbatim}
3167 \subsubsection{Description}
3170 The command stands for Fr\_GetVersionInfo function from the Autosar specification. It reads and prints the information about vendor, module and version of the FlexRay driver
3172 \subsubsection{Example}
3174 \begin{verbatim} --> frbtversion
3177 sw_major_version: 0x1
3178 sw_minor_version: 0x2
3179 sw_patch_version: 0x4\end{verbatim}
3181 \subsection{frbtwup}
3184 Initiate the wake up procedure
3186 \subsubsection{Command syntax}
3188 \begin{verbatim} frbtwup\end{verbatim}
3190 \subsubsection{Description}
3193 The command stands for Fr\_SendWUP function from the Autosar specification. It initiates the wake up procedure by switching FlexRay controller state machine to WAKEUP state.
3195 \subsubsection{Example}
3197 \begin{verbatim} --> frbtwup
3198 Wake up pattern has been sent.\end{verbatim}
3200 \subsection{hbrcontrol*}
3203 Set the motor voltage direction and size in percent
3205 \subsubsection{Command syntax}
3207 \begin{verbatim} hbrcontrol<SPEED>\end{verbatim}
3209 where \texttt{\mbox{$<$}SPEED\mbox{$>$}} specifies direction and PWM duty cycle in percent (a number in range -100, 100).
3211 \subsubsection{Description}
3214 The command sets the direction and the size of the voltage at the HBR output.
3216 HBR has to be enabled by the \texttt{hbrenable} command before calling this command.
3218 \subsubsection{Examples}
3220 \begin{verbatim} --> hbrcontrol-25
3221 hbrcontrol =-25\end{verbatim}
3223 Rotates the motor to the left with 25\% duty cycle.
3224 \begin{verbatim} --> hbrcontrol25
3225 hbrcontrol =25\end{verbatim}
3227 Rotates the motor to the right with 25\% duty cycle.
3228 \begin{verbatim} --> hbrcontrol0
3229 hbrcontrol =0\end{verbatim}
3231 Stops the motor, but the H-Bridge output is active (low-side active free wheeling).
3233 \subsection{hbrdisable}
3236 Disable the H-bridge
3238 \subsubsection{Command syntax}
3240 \begin{verbatim} hbrdisable\end{verbatim}
3242 \subsubsection{Description}
3245 The command disables the H-bridge HBR, which means that the PWM is stopped and the enable signal is cleared. The watchdog task is left running, because it is harmless.
3247 After the H-bridge is disabled, it cannot be controlled by any command until it is enabled again by the \texttt{hbrenable} command.
3249 \subsubsection{Example}
3251 \begin{verbatim} --> hbrdisable
3252 hbrdisable=0\end{verbatim}
3254 Stops motor and disables the H-bridge.
3256 \subsection{hbrenable*}
3259 Enable the H-bridge and set its PWM period
3261 \subsubsection{Command syntax}
3263 \begin{verbatim} hbrenable<PER>\end{verbatim}
3265 where \texttt{\mbox{$<$}PER\mbox{$>$}} is PWM period in microseconds.
3267 \subsubsection{Description}
3270 This command enables the H-bridge (HBR pin), i.e. the enable signal the H-bridge chip is set, the watchdog reset task is started and the PWM is configured with the specified period and duty cycle 0\%.
3272 If the period is zero, the default frequency of 18kHz is used instead. Minimum period is 50. This command should be called before any other command starting with hbr is used. If H-bridge is already enabled, an error is printed.
3274 \subsubsection{Example}
3276 \begin{verbatim} --> hbrenable1000
3277 hbrenable =1000\end{verbatim}
3279 Enables HBR with period 1000 microseconds (frequency 1 kHz). HBR output is still inactive, but ready for other commands.
3284 Print help for commands
3286 \subsubsection{Syntax}
3289 help \mbox{$[$}command\mbox{$]$}
3291 \subsubsection{Description}
3294 This command without parameter prints the list of all available commands with short help text for each of them. If a parameter is provided, the command prints a long description for given command.
3296 \subsection{houtfail*}
3299 Test if some HOUT pin is in the fault state
3301 \subsubsection{Command syntax}
3303 \begin{verbatim} houtfail<PIN>\end{verbatim}
3305 where \texttt{\mbox{$<$}PIN\mbox{$>$}} is in range 1-6
3307 \subsubsection{Description}
3310 This command tests, if HOUT pin is in a good condition. When the circuit controlling HOUT pin detects some failure, it signals that on HOUT\_DIAG output. This command is supposed to read this output and print its state.
3312 Possible outputs of this command:
3314 \item OK - no failure detected
3315 \item FAIL - a failure detected
3316 \item NOT RUNNING - PWM was set set up and started
3319 Note: Before using this command, houtpwmstart and houtpwm commands should be called.
3321 \subsubsection{Example}
3323 \begin{verbatim} --> houtpwm6 1000 25
3328 Detects the state of the HOUT1 and prints OK, FAIL or NOT RUNNING.
3330 \subsection{houtifbk}
3333 Read values from HOUT current feedback
3335 \subsubsection{Command syntax}
3337 \begin{verbatim} houtifbk\end{verbatim}
3339 \subsubsection{Description}
3342 The command reads analog values from HOUT\_IFBK pins and prints them in a table.
3344 \subsubsection{Example}
3347 --\mbox{$>$} houtifbk HOUT1: 0 HOUT2: 134223784 HOUT3: 134223784 HOUT4: 0 HOUT5: 38924 HOUT6: 1342231444
3349 \subsection{houtpwm*}
3352 Set or get actual PWM parameters
3354 \subsubsection{Command syntax}
3356 \begin{verbatim} houtpwm<PIN> <PER> <DUTY>
3357 houtpwm<PIN>\end{verbatim}
3361 \item \texttt{\mbox{$<$}PIN\mbox{$>$}} is a number in range 1-6
3362 \item \texttt{\mbox{$<$}PER\mbox{$>$}} is a length of the PWM period in microseconds
3363 \item \texttt{\mbox{$<$}DUTY\mbox{$>$}} is a the PWM duty cycle in percent (0-100)
3366 \subsubsection{Description}
3369 This command can be used to set or get HOUT PWM parameters.
3371 \subsubsection{Example}
3373 \begin{verbatim} --> houtpwm1 1000 25\end{verbatim}
3375 HOUT1 PWM will have the period of 1ms and will be active for 25\% of this period.
3376 \begin{verbatim} --> houtpwm1
3377 houtpwm1_period=1000
3378 houtpwm1_duty=25\end{verbatim}
3380 Prints the actual period of HOUT1 PWM in microseconds and the duty cycle in percents.
3382 \subsection{houtstartpwm*}
3385 Start generating PWM signal on HOUT
3387 \subsubsection{Command syntax}
3389 \begin{verbatim} houtstartpwm<PIN>\end{verbatim}
3391 where \texttt{\mbox{$<$}PIN\mbox{$>$}} is a number in range 1-6
3393 \subsubsection{Description}
3396 This command starts to generate the PWM signal on the specified HOUT pin. The HOUT PWM has to be previously set by the houtpwm command, otherwise an error is printed.
3398 \subsubsection{Example}
3400 \begin{verbatim} --> houtpwm1 1000 25
3401 --> houtstartpwm1\end{verbatim}
3403 HOUT1 PWM generation will be started.
3405 \subsection{houtstoppwm*}
3408 Stop generating of PWM signal on HOUT
3410 \subsubsection{Command syntax}
3412 \begin{verbatim} houtstoppwm<PIN>\end{verbatim}
3414 where \texttt{\mbox{$<$}PIN\mbox{$>$}} is a number in range 1-6
3416 \subsubsection{Description}
3419 This command stops generating the PWM signal on the selected pin.
3421 \subsubsection{Example}
3423 \begin{verbatim} --> houtstoppwm1\end{verbatim}
3425 HOUT1 PWM generation will be deactivated.
3427 \subsection{lintest}
3430 Test the digital loopback on LIN
3432 \subsubsection{Command syntax}
3434 \begin{verbatim} lintest\end{verbatim}
3436 \subsubsection{Description}
3439 This command can be used for testing the LIN. The command starts to send a short message on the LIN port and is testing if it is correctly received via an internal loopback.
3441 \subsection{loutdiag*}
3444 Read a diagnostic value from an LOUT pin
3446 \subsubsection{Command syntax}
3448 \begin{verbatim} loutdiag<PIN>\end{verbatim}
3450 where \texttt{\mbox{$<$}PIN\mbox{$>$}} is a number in range 1-8
3452 \subsubsection{Description}
3455 The command reads a logical value of the LOUT diagnostic signal.
3457 \subsubsection{Example}
3459 \begin{verbatim} --> loutdiag1\end{verbatim}
3461 Reads value of the LOUT1 diagnostic signal.
3463 \subsection{loutset*}
3466 Set a value of the LOUT pin
3468 \subsubsection{Command syntax}
3470 \begin{verbatim} loutset<PIN> <VALUE>\end{verbatim}
3474 \item \texttt{\mbox{$<$}PIN\mbox{$>$}} is a number in range 1-8
3475 \item \texttt{\mbox{$<$}VALUE\mbox{$>$}} is a binary value to be set (0 or 1)
3478 \subsubsection{Description}
3481 The command sets the digital value on the LOUT pin.
3483 \subsubsection{Example}
3485 \begin{verbatim} --> loutset1 1\end{verbatim}
3488 \begin{verbatim} --> loutset2 0\end{verbatim}
3492 \subsection{pindir*}
3495 Set the pin direction
3497 \subsubsection{Command syntax}
3499 \begin{verbatim} pindir<NAME> <DIR>
3500 pindir<NAME>\end{verbatim}
3504 \item \texttt{\mbox{$<$}NAME\mbox{$>$}} is a string identifying the pin
3505 \item DIR is be either 0 (input) or 1 (output)
3508 \subsubsection{Description}
3511 This command is used to set or get direction of the particular pin.
3513 The list of valid pin names can be obtained with pinlist command.
3515 Most of the pins are accessible indirectly via other highlevel commands HBR\_EN is, for example, controlled by the hbrenable command. This command serves as supplement to highlevel commands for testing purpose.
3517 \subsubsection{Example}
3519 \begin{verbatim} --> pindirHBREN 1
3520 pindirHBREN=1\end{verbatim}
3522 Sets the HBR\_EN pin as output.
3523 \begin{verbatim} --> pindirHBREN
3524 pindirHBREN=1\end{verbatim}
3526 Gets the direction of the HBR\_EN pin.
3528 \subsection{pinlist}
3531 Print a list of all defined pins.
3533 \subsubsection{Command syntax}
3535 \begin{verbatim} pinlist\end{verbatim}
3537 \subsubsection{Description}
3540 The command prints a list of all defined pins accessible by pinval and pindir commands.
3542 \subsubsection{Example}
3544 \begin{verbatim} --> pinlist
3545 List of all defined pins. Those names can be used by pinval command.
3593 HOUT6DIAG\end{verbatim}
3595 \subsection{pinval*}
3598 Set or get the pin value
3600 \subsubsection{Command syntax}
3602 \begin{verbatim} pinval<NAME> <VAL>
3603 pinval<NAME>\end{verbatim}
3607 \item \texttt{\mbox{$<$}NAME\mbox{$>$}} is a string identifying the pin
3608 \item \texttt{\mbox{$<$}VAL\mbox{$>$}} can be 0 or 1
3611 \subsubsection{Description}
3614 This command is sets or gets a value of the particular pin.
3616 The list of valid pin names can be obtained with pinlist command.
3618 Most of the pins are accessible indirectly via other highlevel commands. HBR\_EN is, for example, controlled by the hbrenable command. This command serves as supplement to highlevel commands for testing purpose.
3620 \subsubsection{Example}
3622 \begin{verbatim} --> pinvalHBREN 1
3623 pinvalHBREN=1\end{verbatim}
3625 Sets the HBR\_EN pin to 1.
3626 \begin{verbatim} --> pinvalHBREN
3627 pinvalHBREN=1\end{verbatim}
3629 Gets a value of the HBR\_EN pin.
3631 \subsection{portlist}
3634 Print a list of all port names
3636 \subsubsection{Command syntax}
3638 \begin{verbatim} portlist\end{verbatim}
3640 \subsubsection{Description}
3643 This command prints the list of all defined ports accessible via the portval command. Each record of the list is a couple of PortName-PortInterface, where PortInterface is SPI, ADC or GPIO. The type of the MCU\mbox{$<$}-\mbox{$>$}port interface slightly modifies the meaning of the portval command.
3645 \subsubsection{Example}
3647 \begin{verbatim} --> portlist
3648 List of all defined ports with its type. Those names can be used by portval command.
3663 MOUTIN, GPIO\end{verbatim}
3665 \subsection{portval*}
3668 Read or write values from or to the port
3670 \subsubsection{Command syntax}
3672 \begin{verbatim} portval<NAME> <VAL>
3673 portval<NAME>\end{verbatim}
3677 \item \texttt{\mbox{$<$}NAME\mbox{$>$}} is a string specifying the name of the port
3678 \item \texttt{\mbox{$<$}VAL\mbox{$>$}} is a sequence of hexadecimal numbers, separated by spaces, e.g. 12 AA CD
3681 \subsubsection{Description}
3684 This command sets or gets values of all pins on the specified port. If the port is connected to the GPIO interface of the MCU, then when writing the value, the lowest significant bit of the argument is assigned to the first pin, the second bit is assigned to the second pin, etc. The command returns zero. When reading from the port, the command returns values for each pin.
3686 If the port is connected to the SPI interface of the MCU, then it is write only and the argument is interpreted as a command for the port controller. The command returns the response from the port controller. For command examples please refer to the project wiki
3688 If the port is connected to the ADC interface of the MCU, then it is read only and returns values for each ADC pin.
3690 Port names and interface type can be obtained with the portlist command.
3692 NOTE: For successful communication with the HBR, HBR\_EN pin must be set first.
3694 \subsubsection{Example}
3696 \begin{verbatim} --> portvalMOUTIN 3A
3706 This pair of commands sets: MOUT1INMOUT1IN=0 MOUT2IN=1 MOUT3IN=0 MOUT4IN=1 MOUT5IN=1 MOUT6IN=1 Which is shown in getter output
3708 \subsection{poweroff}
3711 Disables VBATEN and VBAT1EN power supply
3713 \subsubsection{Command syntax}
3715 \begin{verbatim} poweroff\end{verbatim}
3717 \subsubsection{Description}
3720 This command turns off VBAT and VBAT1 voltages.
3722 \subsection{poweron}
3725 Enable VBATEN and VBAT1EN power supply by using PWM hack
3727 \subsubsection{Command syntax}
3729 \begin{verbatim} poweron\end{verbatim}
3731 \subsubsection{Description}
3734 This command tries to work around error on VBAT power supply wiring and attempts to switch the power supply on.
3736 It turns on the VBAT voltage by slowly charging the capacitors connected to the VBAT1 signal by using the software-generated PWM signal with increasing duty cycle.
3738 The poweron command has to be launched before any access to any SPI peripherals, otherwise they will not work (or the power supply has to be electrically bypassed).
3740 Please note that parameters for the PWM signal may change from device to device and it might be necessary to tune them (in source code) for each device.
3742 \subsection{sdramlogtest}
3745 Open a command subprocessor for managing SDRAM logging
3747 \subsubsection{Command syntax}
3749 \begin{verbatim} sdramlogtest\end{verbatim}
3751 \subsubsection{Description}
3754 The command opens a subcommand processor, which contains testing commands for logging into SDRAM.
3756 \subsection{sdramtest}
3759 Test if the SDRAM module is connected and if so, measures its capacity
3761 \subsubsection{Command syntax}
3763 \begin{verbatim} sdramtest\end{verbatim}
3765 \subsubsection{Description}
3768 This command tests SDRAM address space by writing and reading a pattern to/from it. It detects the SDRAM capacity.
3770 \subsubsection{Example}
3772 \begin{verbatim} --> sdramtest
3773 SDRAM installed: 64 MB\end{verbatim}
3780 \subsubsection{Syntax}
3785 \subsubsection{Description}
3788 This command configures the LIN and CAN peripherals to enter sleep mode and turn the whole device into sleep mode. External signal on CAN or LIN will wake the device up.
3790 \subsection{spimst*}
3793 Request SPI master communication
3795 \subsubsection{Command syntax}
3797 \begin{verbatim} spimst<SPI> <ADDR> <DATA>\end{verbatim}
3801 \item \texttt{\mbox{$<$}SPI\mbox{$>$}} is a number in range 0 - 4
3802 \item \texttt{\mbox{$<$}ADDR\mbox{$>$}} is a number in range 0 - 2
3803 \item \texttt{\mbox{$<$}DATA\mbox{$>$}} is a sequence of hexadecimal numbers, separated by spaces, e.g. 12 AA CD
3806 \subsubsection{Description}
3809 The command sends given data to the SPI peripheral and prints the response. The response contains the address and the received data in parentheses.
3811 \subsubsection{Example}
3813 \begin{verbatim} --> spimst1 0 7F 00 00
3814 spirx:0x0(0x3f,0xc0,0xff)\end{verbatim}
3816 Sends reset command (0x7F0000) to the DIN peripheral.
3821 Translate response from an SPI peripheral
3823 \subsubsection{Command syntax}
3825 \begin{verbatim} spitr<NAME> <CMD> <RESP>\end{verbatim}
3829 \item \texttt{\mbox{$<$}NAME\mbox{$>$}} is a string specifying the name of the peripheral (one of DINSPI, LOUT, DAC12, DAC34, HBR, FRAY1 and FRAY2)
3830 \item \texttt{\mbox{$<$}CMD\mbox{$>$}} is a hexadecimal number in range 0 - FFFFFFFF
3831 \item \texttt{\mbox{$<$}RESP\mbox{$>$}} is a hexadecimal number in range 0 - FFFFFFFF
3834 \subsubsection{Description}
3837 This command translates a response from SPI from many different peripherals into a human readable form. The SPI response is in the form of a hexadecimal number, which encodes the information. This commands takes this response, the command which produced this response, the name of the peripheral and translates the response into the attribute-value table.
3839 \subsubsection{Example}
3841 \begin{verbatim} --> portvalDINSPI 7F 00 00
3842 portvalDINSPI=AAC03F
3843 --> spitrDINSPI 7F0000 3FC0AA
3868 spitrDINSPI=24\end{verbatim}
3870 Translates response 0x3FC0AA returned by command 0x7F0000 into a human readable form. Please notice LSB-\mbox{$>$}MSB conversion of the portval result. The necessity of the conversion depends on the controller of the examined port.
3872 \subsection{version}
3875 Print version of the software
3877 \subsubsection{Syntax}
3882 \subsubsection{Description}
3885 This command prints the version of the test software. The version number is the output of 'git describe' command, i.e. it is composed from the last tag in the git repository, the number of commits since the tag and the abbreviated commit hash.
3887 \subsubsection{Example}
3889 \begin{verbatim} --> version
3890 version=v0.2-109-ga81a9dd\end{verbatim}
3892 % html: End of file: `doc.html'
3897 \textit{Analog to Digital Converter.} \newline{}
3898 Hardware circuitry that converts a continuous physical quantity (usually voltage) to a
3899 digital number that represents the quantity's amplitude.
3902 \textit{Analog Input.} \newline{}
3903 Mnemonic to refer to or something related to the analog input (ADC) hardware module.
3906 \textit{Analog Output.} \newline{}
3907 Mnemonic to refer to or something related to the analog output (DAC) hardware module.
3910 \textit{Controller Area Network.} \newline{}
3911 The CAN Bus is a vehicle bus standard designed to allow microcontrollers and devices to
3912 communicate with each other within a vehicle without a host computer.
3913 In this project it is also used as mnemonic to refer to or something related to the CAN
3917 \textit{Code Generation Tools.} \newline{}
3918 Name given to the tool set produced by Texas Instruments used to compile, link, optimize,
3919 assemble, archive, among others. In this project is normally used as synonym for
3920 ``Texas Instruments ARM compiler and linker."
3923 \textit{Digital to Analog Converter.} \newline{}
3924 Hardware circuitry that converts a digital (usually binary) code to an analog signal
3925 (current, voltage, or electric charge).
3928 \textit{Digital Input.} \newline{}
3929 Mnemonic to refer to or something related to the digital input hardware module.
3932 \textit{Engine Control Unit.} \newline{}
3933 A type of electronic control unit that controls a series of actuators on an internal combustion
3934 engine to ensure the optimum running.
3937 \textit{Ethernet.} \newline{}
3938 Mnemonic to refer to or something related to the Ethernet hardware module.
3941 \textit{FlexRay.} \newline{}
3942 FlexRay is an automotive network communications protocol developed to govern on-board automotive
3944 In this project it is also used as mnemonic to refer to or something related to the FlexRay
3948 \textit{General Purpose Input/Output.} \newline{}
3949 Generic pin on a chip whose behavior (including whether it is an input or output pin) can be
3950 controlled (programmed) by the user at run time.
3953 \textit{H-Bridge.} \newline{}
3954 Mnemonic to refer to or something related to the H-Bridge hardware module. A H-Bridge is
3955 an electronic circuit that enables a voltage to be applied across a load in either direction.
3958 \textit{High-Power Output.} \newline{}
3959 Mnemonic to refer to or something related to the 10A, PWM, with current sensing, high-power
3960 output hardware module.
3963 \textit{Integrated Development Environment.} \newline{}
3964 An IDE is a Software application that provides comprehensive facilities to computer programmers
3965 for software development.
3968 \textit{Legacy Code Tool.} \newline{}
3969 Matlab tool that allows to generate source code for S-Functions given the descriptor of a C
3973 \textit{Local Interconnect Network.} \newline{}
3974 The LIN is a serial network protocol used for communication between components in vehicles.
3975 In this project it is also used as mnemonic to refer to or something related to the LIN
3979 \textit{Logic Output.} \newline{}
3980 Mnemonic to refer to or something related to the digital output hardware module.
3981 It is logic output (100mA), as opposed to power outputs (2A, 10A).
3984 \textit{Model-Based Design.} \newline{}
3985 Model-Based Design (MBD) is a mathematical and visual method of addressing problems associated
3986 with designing complex control, signal processing and communication systems.
3989 \textit{Matlab Executable.} \newline{}
3990 Type of binary executable that can be called within Matlab. In this document the common term
3991 used is `C MEX S-Function", which means Matlab executable written in C that implements a system
3995 \textit{(Motor) Power Output.} \newline{}
3996 Mnemonic to refer to or something related to the 2A push/pull power output hardware module.
3999 \textit{Pulse-width modulation.} \newline{}
4000 Technique for getting analog results with digital means. Digital control is used to create a
4001 square wave, a signal switched between on and off. This on-off pattern can simulate voltages
4002 in between full on and off by changing the portion of the time the signal spends on versus
4003 the time that the signal spends off. The duration of ``on time" is called the pulse width or
4004 \textit{duty cycle}.
4007 \textit{Rapid Prototyping Platform.} \newline{}
4008 Name of the automotive hardware board. Also generic term to define something related
4009 to the board, like the RPP Library, RPP Layer, RPP API, etc.
4012 \textit{Serial Communication Interface.} \newline{}
4013 Serial Interface for communication through hardware's UART using communication standard RS-232.
4014 In this project it is also used as mnemonic to refer to or something related to the Serial
4015 Communication Interface hardware module.
4018 \textit{SD-Card.} \newline{}
4019 Mnemonic to refer to or something related to the SD-Card hardware module.
4022 \textit{SD-RAM.} \newline{}
4023 Mnemonic to refer to or something related to the SD-RAM hardware module for logging.
4026 \textit{Target Language Compiler.} \newline{}
4027 Technology and language used to generate code in Matlab/Simulink.
4030 \textit{Universal Asynchronous Receiver/Transmitter.} \newline{}
4031 Hardware circuitry that translates data between parallel and serial forms.
4035 \chapter{References}
4038 \item Horn, M. (2013). \textit{Software obsluhující periferie a flexray na automobilové rídicí jednotce}.
4039 (Unpublished master's thesis, Czech Technical University in Prague, Prague, Czech Republic).
4041 \item \textit{Model-based design}. (n.d.). In Wikipedia. Retrieved March 10, 2013, from \newline{}
4042 \htmladdnormallink{http://en.wikipedia.org/wiki/Model-based\_design}{http://en.wikipedia.org/wiki/Model-based\_design}
4044 \item (2012). \textit{ARM Assembly Language Tools}. Texas Instruments.
4046 \item (2012). \textit{ARM Optimizing C/C++ Compiler}. Texas Instruments.
4048 \item (2013). \textit{Embedded Coder - Reference}. MathWorks.
4050 \item (2013). \textit{Embedded Coder - User's Guide}. MathWorks.
4052 \item Barry, R. (2009). \textit{Using the FreeRTOS real time kernel - A practical guide}.
4054 \item (2013). \textit{Simulink Coder - Reference}. MathWorks.
4056 \item (2013). \textit{Simulink - Target Language Compiler}. MathWorks.
4058 \item (2013). \textit{Simulink Coder - User's Guide}. MathWorks.
4060 \item (2013). \textit{Simulink - Developing S-Functions}. MathWorks.
4062 \item (2012). \textit{TMS570LS31x/21x 16/32-Bit RISC Flash Microcontroller - Technical Reference Manual}.
4068 % LocalWords: FreeRTOS RPP POSIX