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>Test Setup</title>
7 <title>CMSIS-Driver Validation: Test Setup</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 1.4.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 class="current"><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('test_setup.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>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><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">Test Setup </div> </div>
114 <div class="contents">
115 <div class="textblock"><h1><a class="anchor" id="step1"></a>
116 Step 1: Create an MDK project with your target microcontroller device</h1>
117 <h1><a class="anchor" id="step2"></a>
118 Step 2: Add required software components</h1>
119 <p>For proper operation, add the following software components in the <b>Manage Run-Time Environment</b> window:</p>
121 <li><b>CMSIS Driver Validation:Framework</b></li>
122 <li><b>CMSIS Driver Validation:driver</b>, driver interfaces to be tested</li>
123 <li><b>CMSIS Driver:driver</b>, driver implementations to be tested</li>
124 <li><b>CMSIS:RTOS2 (API):Keil RTX5</b></li>
125 <li><b>Compiler:I/O:STDOUT</b>, variant <b>ITM</b> (if your hardware does not support ITM select <b>User</b> or <b>EVR</b>)</li>
126 <li>Resolve any unresolved component dependecies</li>
128 <h1><a class="anchor" id="step3"></a>
129 Step 3: Add main.c</h1>
130 <p>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>main</b> file from <b>Device:Startup</b> or <b>CMSIS-RTOS2:Keil RTX5</b>.</p>
131 <p>Add this include: </p>
132 <div class="fragment"><div class="line">include <span class="stringliteral">"cmsis_dv.h"</span></div>
133 </div><!-- fragment --><p>In the main function, after kernel initialization, create the <code>cmsis_dv</code> thread: </p>
134 <div class="fragment"><div class="line">osThreadNew(<a class="code" href="group__framework__funcs.html#gaf2fc6d3011404f9d07346948bcc6c74d">cmsis_dv</a>, NULL, NULL);</div>
135 </div><!-- fragment --><p> to run all tests that you have chosen in the next step.</p>
136 <h1><a class="anchor" id="step4"></a>
137 Step 4: Configure DV_Config.h</h1>
138 <p>Open <code>DV_Config.h</code> under the <b>CMSIS Driver Validation</b> group in the Project window.</p>
140 <img src="dv_config_h.png" alt="dv_config_h.png"/>
141 <div class="caption">
142 Configuration File DV_Config.h</div></div>
143 <p> <b>Common Test Settings</b></p>
144 <p>The common test settings help you to choose the output format of the test, buffer sizes and buffer content that should be used for the send, receive, and transfer tests:</p>
146 <li>The <b>Print</b> <b>Output</b> <b>Format</b> lets you select if you wish to create the output as plain text or as styled XML.</li>
147 <li><b>Buffer</b> <b>sizes</b> lets you select the buffer sizes that are used for data transfer. This setting has a direct impact on required <a class="el" href="test_setup.html#step6">heap</a>.</li>
148 <li>You can specify also the <b>Buffer size for baudrate test</b>. For USART you can set the <b>Percentual tolerance for baudrate test</b> and for SPI the <b>Percentual trigger for bus speed test</b>. Depending on the device <a class="el" href="test_setup.html#step7">configuration</a>, for example when DMA is not used, the transfers may have larger overhead which is more significant for higher bus speeds. The transfer overhead is reduced for larger transfer buffer sizes.</li>
149 <li>Select your preferred <b>Buffer pattern</b></li>
151 <p><b>Driver-specific Settings</b></p>
152 <p>Every interface has specific settings that can be changed in the according section:</p>
154 <li>You need to specify the driver instance number (<b>Driver_<em>interface</em>#</b>) used for the test. This is especially important for microcontroller devices that have multiple peripherals of the same kind.</li>
155 <li>Some drivers can have additional baudrate or timing settings.</li>
156 <li>Select all driver tests that you wish to use. Note that all tests can run independently from each other. You do not need to specify a certain order.</li>
158 <dl class="section note"><dt>Note</dt><dd>For more information on additional settings and the different driver test cases, check the <a href="./modules.html" class="el">Reference</a> section. </dd>
160 For WiFi driver validation some settings depend on the test environment and they need to be set properly, for details please refer to <a class="el" href="group__wifi__config.html">WiFi Configuration</a> section.</dd></dl>
161 <h1><a class="anchor" id="step5"></a>
162 Step 5: Configure Keil RTX5</h1>
163 <p>Open <b>RTX_Config.h</b> and set:</p>
165 <li><b>Default Thread stack size [bytes]</b> to <em>2048</em> </li>
166 <li><b>Global Dynamic Memory size [bytes]</b> to <em>8192</em> (Note 1)</li>
168 <dl class="section note"><dt>Note</dt><dd>Note 1: This setting is only necessary for WiFi driver testing, for other tests default setting of 4096 is sufficient.</dd></dl>
169 <h1><a class="anchor" id="step6"></a>
170 Step 6: Configure Heap</h1>
171 <p>Depending on the buffer sizes that you have chosen in <a class="el" href="test_setup.html#step4">Step 4</a>, you need to add more heap. Depending on how heap is configured in your system open your startup_<em>device</em>.s file from the <b>Device</b> group in the <b>Project</b> window or use a linker script to adjust the heap setting. Click on the <a href="http://www.keil.com/support/man/docs/uv4/uv4_ut_configwizard.htm" target="_blank">Configuration Wizard</a> view. Increase the heap size:</p>
173 <li>for the validation framework add 1024 bytes.</li>
174 <li>double the largest buffer size you have set in the configuration file and add this as well.</li>
176 <p>Refer to the <a class="el" href="resource_requirements.html">Resource Requirements</a> section for a calculation example.</p>
177 <h1><a class="anchor" id="step7"></a>
178 Step 7: Configure the Device</h1>
179 <p>Depending on your device, you might have different pin/hardware configuration options. Usually, you can configure the device using the <code>RTE_Device.h</code> file from the <b>Device</b> group. Enable all interfaces you wish to use in the tests and make all necessary pin-out changes required by your actual board layout (consult the board schematics). The pre-built <a class="el" href="examples.html">examples</a> are already configured for the underlying hardware.</p>
180 <p>For a robust test with good coverage, implement various targets with different settings:</p>
182 <li><b>Enable/disable</b> the <b>DMA</b> controller of your device</li>
183 <li>Set different <b>buffer</b> <b>sizes</b> in <a class="el" href="test_setup.html#step4">DV_Config.h</a></li>
184 <li>Select different compiler <b>optimization</b> <b>levels</b> in the <a href="http://www.keil.com/support/man/docs/uv4/uv4_dg_adscc.htm" target="_blank">C/C++ tab</a> of the <b>Options for Target</b> dialog.</li>
186 <h1><a class="anchor" id="step8"></a>
187 Step 8: Setup Additional Hardware</h1>
188 <p>For the interfaces that support loopback testing: <a class="el" href="group__eth__funcs.html">Ethernet</a>, <a class="el" href="group__spi__funcs.html">SPI</a>, and <a class="el" href="group__usart__funcs.html">USART</a>, connect the following pins on your target hardware together (refer to the hardware schematics):</p>
190 <li>Ethernet: RX+ and TX+, RX- and TX-</li>
191 <li>SPI: MISO and MOSI</li>
192 <li>USART: RX and TX</li>
194 <p>For WiFi specific hardware requirements please refer to <a class="el" href="group__wifi__requirements.html">WiFi Requirements</a>.</p>
195 <h1><a class="anchor" id="step9"></a>
196 Step 9: Download and Run the Project</h1>
197 <p>In the <b>Options for Target</b> dialog, under debug settings, if you use ITM as standard output channel ensure that <b>Trace</b> and ITM port <span class="XML-Token">0</span> are enabled and that the correct clock frequency is set:</p>
199 <img src="target_dialog.png" alt="target_dialog.png"/>
200 <div class="caption">
201 ITM Channel setting</div></div>
202 <p> Build, load and run the project. The output is displayed in the <b>Debug (printf) Viewer</b> window:</p>
203 <pre class="fragment">CMSIS-Driver ETH Test Report Nov 15 2019 15:25:59
205 TEST 01: ETH_MAC_GetCapabilities PASSED
206 TEST 02: ETH_MAC_Initialization PASSED
207 TEST 03: ETH_MAC_PowerControl
208 DV_ETH.c (163): [WARNING] Low power is not supported
210 TEST 04: ETH_MAC_SetBusSpeed
211 DV_ETH.c (197): [WARNING] Link speed 1G is not supported
213 TEST 05: ETH_MAC_Config_Mode PASSED
214 TEST 06: ETH_MAC_Config_CommonParams PASSED
215 TEST 07: ETH_PHY_Initialization PASSED
216 TEST 08: ETH_PHY_PowerControl
217 DV_ETH.c (300): [WARNING] Low power is not supported
219 TEST 09: ETH_PHY_Config PASSED
220 TEST 10: ETH_Loopback_Transfer PASSED
221 TEST 11: ETH_PHY_CheckInvalidInit NOT EXECUTED
222 TEST 12: ETH_MAC_CheckInvalidInit NOT EXECUTED
224 Test Summary: 12 Tests, 10 Passed, 0 Failed.
226 </pre><p>If you see warnings during loopback transfer tests, please read the section <a class="el" href="test_results.html">Reading Test Results</a> which gives you more information on how to interpret the results. </p>
227 </div></div><!-- contents -->
228 </div><!-- doc-content -->
229 <!-- start footer part -->
230 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
232 <li class="footer">Generated on Mon Dec 2 2019 12:02:22 for CMSIS-Driver Validation by ARM Ltd. All rights reserved.
234 <a href="http://www.doxygen.org/index.html">
235 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6