<pre>
ip link set can0 down
ip link set can0 type can bitrate 1000000
-ip link set can0 down
+ip link set can0 up
</pre>
or on Debian based systems <tt>/etc/network/interfaces</tt>
configuration file can be used to setup CAN interface baudrate
The later setup works automatic even with CAN-USB converter hotplug.
</p>
+<h2 id="included_files">Project Included Files</h2>
<p>
The projects includes blocks library <b>socketcan_lib.slx</b>, simple
example of provided blocks use <b>cantransmit_ert.slx</b> and more
use of the block to send PDO messages to two stepper motors
controlled robotic arm. This simple CAN library does not
provide CANopen support yet so initial motors SDO parameters
-setup is solved by <b>canopen_2j_arm_setup</b> setup shell
+setup is solved by <b>canopen_2j_arm_setup</b> shell
script which invokes <tt>cansend</tt> command.
The variant of the model (<b>canopen_2j_arm_rpi.slx</b>) with
build parameters preset for crosscompilation to Raspberry Pi
The CAN-USB converter from 8devices has been used in this case.
</p>
+<h2 id="simulink_setup">Simulink Target Setup</h2>
+<p>
+Download/clone <a href="http://lintarget.sourceforge.net/">ERT Linux</a> target
+and Linux CAN bus toolbox repositories. The example expects the toolbox
+are placed into user local <tt>~/matlab/toolbox</tt> directory.
+Setup Matlab path for thee projects. One option is to use <tt>~/matlab/startup.m</tt>
+file for this purpose:
+</p>
+<pre>
+function startup(AddRem)
+
+disp 'Executing local setup stript ~/matlab/startup.m'
+
+restoredefaultpath
+
+[matlab_startup_dir, matlab_startup_filename, matlab_startup_dir_ext] = fileparts(mfilename('fullpath'));
+
+addpath(fullfile(matlab_startup_dir, 'toolbox/ert_linux/ert_linux'));
+addpath(fullfile(matlab_startup_dir, 'toolbox/socketcan-simulink/blocks'));
+</pre>
+<p>
+Use example model as base for the project or open <b>Simulation</b> → <b>Model Configuration Parameters</b>
+dialog and select <b>System target file</b> to <tt>ert_linux.tlc</tt> in <b>Code Genration</b> section.
+Check <b>Make command</b>. It should be something like:
+</p>
+<pre>
+make_rtw OPT_OPTS="-O2 -ggdb -Wall -D_BSD_SOURCE"
+</pre>
+<p>
+Use proper <tt>CC</tt> variable definition in case of cross compilation to some other target.
+See next example for Raspberry Pi:
+</p>
+<pre>
+make_rtw OPT_OPTS="-O2 -ggdb -Wall -D_BSD_SOURCE" CC=arm-rpi-linux-gnueabihf-gcc
+</pre>
+
<h2 id="links">Links</h2>
<dl>
<dt>Linux CAN bus toolbox repository</dt>
<dd><a href="http://rtime.felk.cvut.cz/gitweb/socketcan-simulink.git" target="_blank">http://rtime.felk.cvut.cz/gitweb/socketcan-simulink.git</a>
<br><tt>git clone git://rtime.felk.cvut.cz/socketcan-simulink.git</tt>
</dd>
+ <dt>Usable Simulink Embedded Coder Target for Linux</dt>
+ <dd>Michal Sojka, Pavel Pisa<br>
+ <a href="https://www.osadl.org/RTLWS-2014.rtlws-2014.0.html">16th Real-Time Linux Workshop</a>,
+ Düsseldorf, Germany, October 2014.
+ The <a href="http://rtime.felk.cvut.cz/publications/public/ert_linux.pdf">paper (PDF)</a>
+ and <a href="http://rtime.felk.cvut.cz/publications/public/ert_linux-rtlws2014.pdf">slides (PDF)</a>
+ are available from our
+ <a href="http://rtime.felk.cvut.cz/publications/">publications archive</a>.
+ </dd>
</dl>
</div>