AMR_T800/Devices/Libraries/Systems/CANopenSocket/docs/md_doc_LSSusage.html

207 lines
10 KiB
HTML
Executable File

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CANopenNode: LSS usage</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">CANopenNode
</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('md_doc_LSSusage.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">LSS usage </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>LSS (Layer settings service) is an extension to CANopen described in CiA DSP 305. The interface is described in CiA DS 309 3.0.0 (ASCII mapping). LSS allows the user to change node ID and bitrate, as well as setting the node ID on an unconfigured node.</p>
<p>LSS uses the the OD Identity register (0x1018) as an unique value to select a node. Therefore the LSS address always consists of four 32 bit values. This also means that LSS relies on this register to actually be unique. (<em>vendorID</em>, <em>productCode</em>, <em>revisionNumber</em> and <em>serialNumber</em> must be configured and unique on each device.)</p>
<h2>Preparation for testing on Linux virtual CAN</h2>
<p>LSS can be tested on Linux virtual CAN, similar as in gettingStarted.md.</p>
<ol type="1">
<li>Open terminal, setup <em>vcan0</em> and <em>cd</em> to CANopenNode directory.</li>
<li>Make some unique CANopen devices:<ul>
<li>Edit CO_OD.c, change initialization for identity, for example change line to <code>/*1018*/ {0x4, 0x1L, 0x2L, 0x3L, 0x4L},</code></li>
<li><code>make</code></li>
<li><code>mv canopend canopend4</code></li>
<li>Edit CO_OD.c, for example: <code>/*1018*/ {0x4, 0x1L, 0x2L, 0x3L, 0x5L},</code></li>
<li><code>make</code></li>
<li><code>mv canopend canopend5</code></li>
<li>Repeat this step and create three further "unique" CANopen devices.</li>
</ul>
</li>
<li>Clear default OD storage file. We will use default (empty) storage for all instances:<ul>
<li><code>echo "-" &gt; od_storage</code></li>
</ul>
</li>
<li>Run "master" with command interface and node-id = 1. Note that this device has enabled both: LSS master and LSS slave. But LSS master does not 'see' own LSS slave.<ul>
<li><code>make</code></li>
<li><code>./canopend vcan0 -i1 -c "stdio"</code></li>
</ul>
</li>
<li>Run one CANopen device with node-id=22 in own terminal:<ul>
<li><code>./canopend4 vcan0 -i22</code></li>
</ul>
</li>
<li>Run other unique CANopen devices with unconfigured node-id, each in own terminal:<ul>
<li><code>./canopend5 vcan0 -i0xFF</code></li>
<li><code>./canopend6 vcan0 -i0xFF</code></li>
<li><code>./canopend7 vcan0 -i0xFF</code></li>
<li><code>./canopend8 vcan0 -i0xFF</code></li>
</ul>
</li>
<li>Note that <code>lss_store</code> does not work in this example. For it to work, OD storage must be used properly.</li>
</ol>
<h2>Typical usage of LSS</h2>
<ul>
<li><p class="startli">Changing the node ID for a known slave, store the new node ID to eeprom, apply new node ID. The node currently has the node ID 22. </p><pre class="fragment"> help lss
lss_switch_sel 0x00000001 0x00000002 0x00000003 0x00000004
lss_set_node 10
lss_store
lss_switch_glob 0
22 reset communication
</pre><p class="startli">Note that the node ID change is not done until reset communication/node.</p>
</li>
<li><p class="startli">Changing the node ID for a known slave, store the new node ID to eeprom, apply new node ID. The node currently has an invalid node ID. </p><pre class="fragment"> lss_switch_sel 0x00000001 0x00000002 0x00000003 0x00000005
lss_set_node 11
lss_store
lss_switch_glob 0
</pre><p class="startli">Note that the node ID is automatically applied. This can be seen on <code>candump</code>.</p>
</li>
</ul>
<h2>LSS fastscan</h2>
<ul>
<li><p class="startli">Search for a node via LSS fastscan, store the new node ID to eeprom, apply new node ID </p><pre class="fragment"> _lss_fastscan
[0] 0x00000001 0x00000002 0x00000003 0x00000006
lss_set_node 12
lss_store
lss_switch_glob 0
</pre><p class="startli">To increase scanning speed, you can use </p><pre class="fragment">_lss_fastscan 25
</pre><p class="startli">where 25 is the scan step delay in ms. Be aware that the scan will become unreliable when the delay is set to low.</p>
<p class="startli">We won't configure this node now, reset LSS. Now we have 1+3 nodes operational in our example. </p><pre class="fragment">lss_switch_glob 0
</pre></li>
</ul>
<h2>Auto enumerate all nodes</h2>
<ul>
<li>Auto enumerate all nodes via LSS fastscan. Enumeration automatically begins at node ID 2 and node ID is automatically stored to eeprom. Like with _lss_fastscan, an optional parameter can be used to change default delay time. <pre class="fragment"> lss_allnodes
# Node-ID 2 assigned to: 0x00000001 0x00000002 0x00000003 0x00000007
# Node-ID 3 assigned to: 0x00000001 0x00000002 0x00000003 0x00000008
# Found 2 nodes, search finished.
[0] OK
</pre></li>
<li><p class="startli">To get further control over the fastscan process, the lss_allnodes command supports an extended parameter set. Auto enumerate all nodes via LSS fastscan. Set delay time to 25ms, set enumeration start to node ID 7, do not store LSS address in eeprom, enumerate only devices with vendor ID "0x428", ignore product code and software revision, scan for serial number </p><pre class="fragment"> lss_allnodes 25 7 0 2 0x428 1 0 1 0 0 0
</pre><p class="startli">The parameters are as following:</p><ul>
<li>25 scan step delay time in ms</li>
<li>7 enumeration start</li>
<li>0 store node IDs to eeprom; 0 = no, 1 = yes</li>
<li>2 vendor ID scan selector; 0 = fastscan, 2 = match value in next parameter</li>
<li>0x428 vendor ID to match</li>
<li>1 product code scan selector; 0 = fastscan, 1 = ignore, 2 = match value in next parameter</li>
<li>0 product code to match (ignored in this example)</li>
<li>1 software version scan selector; 0 = fastscan, 1 = ignore, 2 = match value in next parameter</li>
<li>0 software version to match (ignored in this example)</li>
<li>0 serial number scan selector; 0 = fastscan, 1 = ignore, 2 = match value in next parameter</li>
<li>0 serial number to match (not used in this example)</li>
</ul>
</li>
</ul>
<p>Note that only unconfigured nodes (those without a valid node ID) will take part in fastscan! </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Thu Dec 24 2020 14:30:50 for CANopenNode by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
</ul>
</div>
</body>
</html>