1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <title>SPI Server</title>
7 <title>CMSIS-Driver Validation: SPI Server</title>
8 <link href="tabs.css" rel="stylesheet" type="text/css"/>
9 <link href="drv.css" rel="stylesheet" type="text/css" />
10 <script type="text/javascript" src="jquery.js"></script>
11 <script type="text/javascript" src="dynsections.js"></script>
12 <script type="text/javascript" src="printComponentTabs.js"></script>
13 <link href="navtree.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="resize.js"></script>
15 <script type="text/javascript" src="navtree.js"></script>
16 <script type="text/javascript">
17 $(document).ready(initResizable);
18 $(window).load(resizeHeight);
20 <link href="search/search.css" rel="stylesheet" type="text/css"/>
21 <script type="text/javascript" src="search/search.js"></script>
22 <script type="text/javascript">
23 $(document).ready(function() { searchBox.OnSelectItem(0); });
25 <link href="stylsheetf" rel="stylesheet" type="text/css" />
28 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
30 <table cellspacing="0" cellpadding="0">
32 <tr style="height: 46px;">
33 <td id="projectlogo"><img alt="Logo" src="keilarm.png"/></td>
34 <td style="padding-left: 0.5em;">
35 <div id="projectname">CMSIS-Driver Validation
36  <span id="projectnumber">Version 2.0.0</span>
38 <div id="projectbrief">Driver Validation</div>
44 <!-- end header part -->
45 <div id="DRVnav" class="tabs1">
47 <script type="text/javascript">
49 writeComponentTabs.call(this);
54 <!-- Generated by Doxygen 1.8.6 -->
55 <script type="text/javascript">
56 var searchBox = new SearchBox("searchBox", "search",false,'Search');
58 <div id="navrow1" class="tabs">
60 <li><a href="index.html"><span>Main Page</span></a></li>
61 <li><a href="pages.html"><span>Usage and Description</span></a></li>
62 <li><a href="modules.html"><span>Reference</span></a></li>
64 <div id="MSearchBox" class="MSearchBoxInactive">
66 <img id="MSearchSelect" src="search/mag_sel.png"
67 onmouseover="return searchBox.OnSearchSelectShow()"
68 onmouseout="return searchBox.OnSearchSelectHide()"
70 <input type="text" id="MSearchField" value="Search" accesskey="S"
71 onfocus="searchBox.OnSearchFieldFocus(true)"
72 onblur="searchBox.OnSearchFieldFocus(false)"
73 onkeyup="searchBox.OnSearchFieldChange(event)"/>
74 </span><span class="right">
75 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
82 <div id="side-nav" class="ui-resizable side-nav-resizable">
84 <div id="nav-tree-contents">
85 <div id="nav-sync" class="sync"></div>
88 <div id="splitbar" style="-moz-user-select:none;"
89 class="ui-resizable-handle">
92 <script type="text/javascript">
93 $(document).ready(function(){initNavTree('group__spi__server.html','');});
95 <div id="doc-content">
96 <!-- window showing the filter options -->
97 <div id="MSearchSelectWindow"
98 onmouseover="return searchBox.OnSearchSelectShow()"
99 onmouseout="return searchBox.OnSearchSelectHide()"
100 onkeydown="return searchBox.OnSearchSelectKey(event)">
101 <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Pages</a></div>
103 <!-- iframe showing the search results (closed by default) -->
104 <div id="MSearchResultsWindow">
105 <iframe src="javascript:void(0)" frameborder="0"
106 name="MSearchResults" id="MSearchResults">
111 <div class="headertitle">
112 <div class="title">SPI Server<div class="ingroups"><a class="el" href="group__dv__spi.html">SPI Validation</a></div></div> </div>
114 <div class="contents">
115 <p>The <b>SPI Server</b> is an application providing a set of features used by the CMSIS-Driver Validation suite to test the physical operation of the SPI driver.<br/>
116 It is located in the <code><pack root directory></code><b>\Tools\SPI_Server</b> directory.</p>
117 <p>The SPI Server offers the following features:</p>
119 <li>read of the <b>version</b> information</li>
120 <li>read of the <b>capabilities</b> information</li>
121 <li>set and read of the <b>data buffers content</b></li>
122 <li>read of the last <b>transfer count</b></li>
123 <li><b>transfer</b> in Slave or Master mode</li>
124 <li><b>generation of mode fault</b> by activation of the Slave Select line during Slave transfer</li>
126 <h1><a class="anchor" id="spi_server_oper"></a>
128 <p>The SPI Server is continuously waiting on a command from the SPI Client (Driver Validation), after the command is received it is executed, and the process repeats.<br/>
129 Most commands do not have any additional related data phase, but some do have additional input or output data exchange phase following the command.</p>
130 <p>The SPI Server behaves as an SPI Slave except when command for Master transfer was requested, in which case it executes the requested Master transfer and reverts to Slave mode.</p>
131 <h1><a class="anchor" id="spi_server_config"></a>
133 <p>Communication interface settings used during command exchange are set in the <b>SPI_Server_Config.h</b> configuration file. </p>
135 <img src="spi_server_config_h.png" alt="spi_server_config_h.png"/>
136 <div class="caption">
137 SPI_Server_Config.h configuration file in Configuration Wizard view mode</div></div>
138 <h2><a class="anchor" id="spi_server_config_detail"></a>
139 Configuration settings</h2>
140 <p><b>Driver_SPI#</b> selects the driver instance used by the SPI Server.<br/>
141 <b>Communication settings</b> specify the communication parameters for command exchange with the SPI Client:</p>
143 <li><b>Clock / Frame Format</b> setting specifies the clock or frame format used for command exchange.</li>
144 <li><b>Data Bits</b> setting specifies the number of data bits per item used for command exchange.</li>
145 <li><b>Bit Order</b> setting specifies the bit order used for command exchange.</li>
147 <dl class="section note"><dt>Note</dt><dd>The SPI Server is receiving commands operating in SPI Slave mode with usage of the Slave Select line</dd></dl>
148 <h1><a class="anchor" id="spi_server_commands"></a>
150 <p>Commands are encoded in human readable format (ASCII strings) so they can be viewed by the SPI bus analyzer and analyzed more easily.</p>
151 <p>Supported commands:</p>
153 <li><b>GET VER</b>: used to retrieve version of the SPI Server application</li>
154 <li><b>GET CAP</b>: used to retrieve capabilities of the SPI Server (the Server auto-detects capabilities upon reception of this command)</li>
155 <li><b>SET BUF</b>: used to initialize receive or transmit buffer content of the SPI Server</li>
156 <li><b>GET BUF</b>: used to retrieve receive or transmit buffer content of the SPI Server</li>
157 <li><b>SET COM</b>: used to specify transfer configuration for the next transfer</li>
158 <li><b>XFER</b>: used to trigger a transfer</li>
159 <li><b>GET CNT</b>: used to retrieve number of transferred items in the last transfer</li>
161 <dl class="section note"><dt>Note</dt><dd>For details about commands please refer to <b>Abstract.txt</b> file in the <code><pack root directory></code>\Tools\SPI_Server\Board\MCBSTM32F400 directory.</dd></dl>
162 <p>Picture below shows a capture of SPI Driver Validation validating functionality of the Master transfer with Slave Select line not used </p>
164 <img src="spi_bus_master_ss_unused.png" alt="spi_bus_master_ss_unused.png"/>
166 <h1><a class="anchor" id="spi_server_porting"></a>
167 Porting SPI Server to other targets</h1>
168 <p>To create SPI Server application for a different target device, follow the steps below:</p>
170 <li>Create a new project in µVision for your target device</li>
171 <li>In the RTE window enable and configure the following software components:<ul>
172 <li><b>CMSIS: CORE</b></li>
173 <li><b>CMSIS: RTOS2 (API): Keil RTX5</b> any variant</li>
174 <li><b>CMSIS Driver: SPI (API)</b></li>
175 <li><b>CMSIS Driver: VIO (API)</b> select <b>Virtual</b> implementation if implementation for your target system is not available</li>
176 <li>Generic device specific components (startup, clock system, I/O, ...) as required (please consult device's documentation for more information)</li>
177 <li>Resolve any unresolved dependencies between components</li>
180 <li>Copy the <b>SPI_Server.c</b> file from the <code><pack root directory></code><b>\Tools\SPI_Server\Source</b> directory to the project root and add it to µVision project</li>
181 <li>Copy the <b>SPI_Server.h</b> and <b>SPI_Server_HW.h</b> files from the <code><pack root directory></code><b>\Tools\SPI_Server\Include</b> directory to the project root</li>
182 <li>Copy the files specified below from the directory <code><pack root directory></code><b>\Tools\SPI_Server\Config</b> to the project root and add them to µVision project:<ul>
183 <li><b>SPI_Server_Config.h</b>: also adapt this file as required by your device</li>
184 <li><b>SPI_Server_HW.c</b>: also adapt this file for your device's specific handling of the SPI Slave Select line</li>
187 <li>Add root of the project to include path (<b>Options for Target</b> -> <b>C/C++</b> -> <b>Include Paths: .\</b>)</li>
188 <li>Add the <b>main.c</b> file from a template (Right-click <b>Source Group 1...</b> and select <b>Add New Item to Group</b>, select <b>User Code Template</b> and choose the <b>CMSIS-RTOS2 'main' function</b> file from <b>CMSIS: RTOS2:Keil RTX5</b>) and update with code snippet below (replace <code>app_main</code> function): <div class="fragment"><div class="line"><span class="preprocessor">#include "SPI_Server.h"</span></div>
189 <div class="line"> </div>
190 <div class="line"><span class="comment">/*----------------------------------------------------------------------------</span></div>
191 <div class="line"><span class="comment"> * Application main thread</span></div>
192 <div class="line"><span class="comment"> *---------------------------------------------------------------------------*/</span></div>
193 <div class="line">__NO_RETURN <span class="keyword">static</span> <span class="keywordtype">void</span> app_main (<span class="keywordtype">void</span> *argument) {</div>
194 <div class="line"> (void)argument;</div>
195 <div class="line"> SPI_Server_Start();</div>
196 <div class="line"> <span class="keywordflow">for</span> (;;) {}</div>
197 <div class="line">}</div>
198 </div><!-- fragment --></li>
199 <li>Build and download the ported SPI Server application to the target device</li>
201 <h1><a class="anchor" id="spi_server_troubleshooting"></a>
203 <p>Problems and solutions:</p>
205 <li>SPI Server is not responding to commands<ul>
206 <li>reset the SPI Server</li>
207 <li>check that communication settings between SPI Server and SPI Driver Validation are the same,<br/>
208 if they are not, correct them, rebuild the application and download to the hardware</li>
212 <h1><a class="anchor" id="spi_server_MCBSTM32F400"></a>
213 SPI Server on the Keil MCBSTM32F400</h1>
214 <p>SPI Server is currently available for the <b>Keil MCBSTM32F400</b> evaluation board.</p>
215 <p>uVision project and source files are available in the <code><pack root directory></code><b>\Tools\SPI_Server\Board\MCBSTM32F400</b> directory.</p>
216 <p>On the Keil MCBSTM32F400 the <b>SPI2</b> interface is used, with the following pinout:</p>
217 <table class="doxtable">
219 <th align="left">SPI function </th><th align="center">Pin </th></tr>
221 <td align="left">SPI Clock </td><td align="center">PB10 </td></tr>
223 <td align="left">Master Output Slave Input (MOSI) </td><td align="center">PB15 </td></tr>
225 <td align="left">Master Input Slave Output (MISO) </td><td align="center">PB14 </td></tr>
227 <td align="left">Slave Select </td><td align="center">PI0 </td></tr>
229 <dl class="section note"><dt>Note</dt><dd>IMPORTANT: Ground must be connected between SPI Server and Device (Driver) Under Test so that SPI signals have same ground potential.</dd></dl>
230 <p>For more information please consult <b>Abstract.txt</b> file in the project root.</p>
231 <dl class="section note"><dt>Note</dt><dd>SPI Server on the Keil MCBSTM32F400 does not support National Semiconductor Microwire Frame Format. </dd></dl>
232 </div><!-- contents -->
233 </div><!-- doc-content -->
234 <!-- start footer part -->
235 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
237 <li class="footer">Generated on Wed Jul 15 2020 10:47:11 for CMSIS-Driver Validation by ARM Ltd. All rights reserved.
239 <a href="http://www.doxygen.org/index.html">
240 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6