]> begriffs open source - cmsis-driver-validation/blob - Doxygen/DriverValidation.txt
added missing index file for online docs
[cmsis-driver-validation] / Doxygen / DriverValidation.txt
1 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2 /**
3 \mainpage Introduction
4
5 This manual explains the scope and the usage of the Software Pack for \b CMSIS-Driver \b Validation.
6 <a href="http://www.keil.com/pack/doc/CMSIS/Driver/html/index.html" target="_blank">CMSIS-Driver</a> are standard peripheral
7 API interfaces that connect microcontroller peripherals with middleware or the user application. 
8
9 The Software Pack for CMSIS-Driver validation provides:
10   - Configurable validation tests for several CMSIS-Driver interfaces
11   - Example projects that show the usage of the CMSIS-Driver validation
12
13 The CMSIS-Driver validation tests and verifies:
14   - \b API \b interface \b interaction using the driver capabilities as well as valid and invalid parameters.
15   - \b Data \b communication with various transfer sizes and communication parameters (i.e. baudrate).
16   - \b Loopback \b communication (for some interfaces) for testing the underlying hardware.
17   - \b Transfer \b speed of the data communication with time measurement of data transfers (for interfaces with loopback
18     functionality).
19
20 The CMSIS-Driver Validation requires
21 <a href="http://www.keil.com/pack/doc/CMSIS/RTOS/html/index.html" target="_blank">CMSIS-RTOS</a> functionality and can be
22 used to verify the setup and configuration of the CMSIS-Driver interfaces in a user system. It is also used to validate
23 implementation of a CMSIS-Driver interface.
24
25 The diagram below is an overview of the configuration for CMSIS-Driver validation.
26
27 \image html DVSuite.png
28
29 This manual contains the following chapters:
30   - \ref test_setup - Describes the general setup of the CMSIS-Driver validation test and how to generate test output.
31   - \ref test_results - Explains how to interpret the test results from loopback tests.
32   - \ref examples - Contains information of several example projects including the required hardware setup.
33   - \ref resource_requirements - Lists memory and CMSIS-RTOS requirements.
34   - <a class="el" href="./modules.html">Reference</a> - explains the individual tests for the various CMSIS-Driver
35     interfaces.
36
37 The Software Pack for CMSIS-Driver validation current tests the following interfaces:
38   - \ref eth_funcs - Interface to Ethernet MAC and PHY peripheral.
39   - \ref i2c_funcs - Inter-Integrated Circuit (I2C) multi-master serial single-ended bus interface driver.
40   - \ref mci_funcs - Memory card interface for SD/MMC memory.
41   - \ref spi_funcs - Serial Peripheral Interface (SPI) driver.
42   - \ref usart_funcs - Universal Synchronous and Asynchronous Receiver/Transmitter
43     (USART) interface driver.
44   - \ref usbd_funcs - Universal Serial Bus (USB) interface driver (USB Device communication only).
45
46 This manual assumes that you are familiar with MDK. Refer to
47 <a href="http://www2.keil.com/mdk5/install" target="_blank">MDK Version 5 - Getting Started</a> for additional information.
48
49 <hr>
50
51 Revision History
52 ----------------
53
54 Version  | Description
55 :--------|:------------------------------------------
56 V1.1     | Added USB Host, CAN and Ethernet Precision Time Protocol tests
57 V1.0     | Initial release for CMSIS-Driver API V2.0
58 */
59
60 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
61 /**
62 \page test_setup Test Setup
63
64 \section step1 Step 1: Create an MDK project with your target microcontroller device
65
66
67 \section step2 Step 2: Add required software components
68
69 For proper operation, add the following software components in the <b>Manage Run-Time Environment</b> window:
70 - <b>CMSIS:RTOS (API):Keil RTX</b>
71 - <b>Compiler:I/O:STDOUT</b>, variant \b ITM or \b User if your hardware does not support ITM.
72 - <b>CMSIS:CMSIS Driver Validation:Framework</b>
73 - Any other component from <b>CMSIS:CMSIS Driver Validation</b>
74 - Resolve any validation messages
75
76
77 \section step3 Step 3: Add main.c
78
79 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
80 \b main file from <b>Device:Startup</b> or <b>CMSIS-RTOS:RTOS:Keil RTX</b>.
81
82 Add this include:
83 \code
84 include "cmsis_dv.h"
85 \endcode
86
87 In the main function, after initialization, call
88 \code
89 cmsis_dv();
90 \endcode
91 to run all tests that you have chosen in the next step.
92
93
94 \section step4 Step 4: Configure DV_Config.h
95
96 Open \c DV_Config.h under the <b>CMSIS Driver Validation</b> group in the Project window.
97
98 \image html dv_config_h.png "Configuration File DV_Config.h"
99
100 <b>Common Test Settings</b>
101
102 The common test settings help you to choose the output format of the test and the buffer sizes and buffer content that should
103 be used for the send, receive, and transfer tests:
104 - The \b Print \b Output \b Format lets you select if you wish to create the output as plain text or as styled XML.
105 - The <b>Buffer size for assertions results</b> determines the size of the buffer that can be observed in the \b Watch
106   window.
107 - \b Buffer \b sizes lets you select the buffer sizes that are used for data transfer. This setting has a direct impact on
108   required \ref step6 "heap".
109 - You can specify also the <b>Buffer size for baudrate test</b>. For USART you can set the <b>Percentual tolerance for baudrate 
110   test</b> and for SPI the <b>Percentual trigger for bus speed test</b>. Depending on the device \ref step7 "configuration", for 
111   example when DMA is not used, the transfers may have larger overhead which is more significant for higher bus speeds. The 
112   transfer overhead is reduced for larger transfer buffer sizes.
113 - Select your preferred <b>Buffer pattern</b>
114
115 <b>Driver-specific Settings</b>
116
117 Every interface has specific settings that can be changed in the according section:
118 - You need to specify the driver instance number (<b>Driver_<i>interface</i>#</b>) is used for the test. This is especially
119   important for microcontroller devices that have multiple peripherals of the same kind.
120 - Some drivers can have additional baudrate or timing settings.
121 - Select all driver tests that you wish to use. Note that all tests can run independently from each other. You do not need to
122   specify a certain order.
123
124 \note For more information on additional settings and the different driver test cases, check the
125 <a class="el" href="./modules.html">Reference</a> section.
126
127
128 \section step5 Step 5: Configure Keil RTX
129
130 Open \b RTX_Conf_CM.c and edit set:
131 - <b>Default Thread stack size [bytes]</b> to \a 2048
132 - <b>Main Thread stack size [bytes]</b> to \a 2048
133 - <b>RTOS Kernel Timer input clock frequency [Hz]</b> to the correct frequency of your device.
134
135
136 \section step6 Step 6: Configure Heap
137
138 Depending on the buffer sizes that you have chosen in \ref step4 "step 4", you need to add more heap. Open your
139 startup_<i>device</i>.s file from the \b Device group in the \b Project window. Click on \b Configuration \b Wizard. Increase
140 the heap size:
141 - For the validation framework add 1024 bytes.
142 - double the largest buffer size you have set in the configuration file and add this as well.
143
144 Refer to the \ref resource_requirements section for a calculation example.
145
146
147 \section step7 Step 7: Configure the Device
148
149 Depending on your device, you might have different pin/hardware configuration options. Usually, you can configure the device
150 using the \c RTE_Device.h file from the \b Device group. Enable all interfaces you wish to use in the tests and make all
151 necessary pin-out changes required by your actual board layout (consult the board schematics). The pre-built
152 \ref examples "examples" are already configured for the underlying hardware.
153
154 For a robust test with good coverage, implement various targets with different settings:
155 - \b Enable/disable the \b DMA controller of your device
156 - Set different \b buffer \b sizes in \ref step4 "DV_Config.h"
157 - Select different compiler \b optimization \b levels in the
158   <a href="http://www.keil.com/support/man/docs/uv4/uv4_dg_adscc.htm" target="_blank">C/C++ tab</a> of the
159   <b>Options for Target</b> dialog.
160
161
162 \section step8 Step 8: Make Hardware Connections for Loopback Tests
163
164 These interfaces support loopback testing: \ref eth_funcs "Ethernet", \ref spi_funcs "SPI", and \ref usart_funcs "USART".
165 Connect the following pins on your target hardware together (refer to the hardware schematics):
166
167 - Ethernet: RX+ and TX+, RX- and TX-
168 - SPI: MISO and MOSI
169 - USART: RX and TX
170
171
172 \section step9 Step 9: Download and Run the Project
173
174 In the <b>Options for Target</b> dialog, under debug settings, ensure that \b Trace and ITM port \token{0} are enabled and
175 that the correct clock frequency is set:
176
177 \image html target_dialog.png "ITM Channel setting"
178
179 Build, load and run the project. The output is displayed in the <b>Debug (printf) Viewer</b> window:
180
181 \verbatim
182 CMSIS-Driver Test Suite   Oct  8 2015   17:12:21 
183
184 TEST 01: ETH_MAC_GetCapabilities          PASSED
185 TEST 02: ETH_MAC_Initialization           PASSED
186 TEST 03: ETH_MAC_PowerControl             
187   DV_ETH.c (163) [WARNING] Low power is not supported
188 TEST 04: ETH_MAC_SetBusSpeed              
189   DV_ETH.c (197) [WARNING] Link speed 1G is not supported
190 TEST 05: ETH_MAC_Config_Mode              PASSED
191 TEST 06: ETH_MAC_Config_CommonParams      PASSED
192 TEST 07: ETH_PHY_Initialization           PASSED
193 TEST 08: ETH_PHY_PowerControl             
194   DV_ETH.c (300) [WARNING] Low power is not supported
195 TEST 09: ETH_PHY_Config                   PASSED
196 TEST 10: ETH_Loopback_Transfer            PASSED
197 TEST 11: ETH_PHY_CheckInvalidInit         NOT EXECUTED
198 TEST 12: ETH_MAC_CheckInvalidInit         NOT EXECUTED
199
200 Test Summary: 12 Tests, 10 Executed, 7 Passed, 0 Failed, 3 Warnings.
201 Test Result: WARNING
202 \endverbatim
203
204 If you see warnings during loopback transfer tests, please read the section \ref test_results which gives you more
205 information on how to interpret the results.
206 */
207
208
209 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
210 /**
211 \page test_results Reading Test Results
212
213 The tests \ref SPI_Loopback_CheckBusSpeed and \ref USART_Loopback_CheckBaudrate may issue warnings when using the default
214 settings (especially loopback communication tests for SPI and USART):
215 \verbatim
216 CMSIS-Driver Test Suite   Nov 18 2015   09:26:38 
217
218 TEST 01: SPI_GetCapabilities              PASSED
219 TEST 02: SPI_Initialization               PASSED
220 TEST 03: SPI_PowerControl                 
221   DV_SPI.c (244) [WARNING] Low power is not supported
222 TEST 04: SPI_Config_PolarityPhase         PASSED
223 TEST 05: SPI_Config_DataBits              PASSED
224 TEST 06: SPI_Config_BitOrder              
225   DV_SPI.c (315) [WARNING] Bit order LSB_MSB is not supported
226 TEST 07: SPI_Config_SSMode                
227   DV_SPI.c (343) [WARNING] Slave select MASTER_HW_INPUT is not supported
228 TEST 08: SPI_Config_BusSpeed              PASSED
229 TEST 09: SPI_Config_CommonParams          PASSED
230 TEST 10: SPI_Send                         PASSED
231 TEST 11: SPI_Receive                      PASSED
232 TEST 12: SPI_Loopback_CheckBusSpeed       
233   DV_SPI.c (525) [WARNING] At 25000kHz: measured time is 2.437125 x expected time
234 TEST 13: SPI_Loopback_Transfer            PASSED
235 TEST 14: SPI_CheckInvalidInit             NOT EXECUTED
236 \endverbatim
237
238 The measured time is depending mainly on two factors: \b DMA and \b software \b overhead.
239
240 If you are not using \b DMA for data transfer, an interrupt is generated, in worst case, for every transferred byte. The
241 interrupt handling overhead for each byte can produce 10 times slower transfer than DMA. DMA will transfer the data
242 without overhead. Thus, only bus speed/baudrate tests with DMA enabled should be considered for
243 optimization. In case DMA cannot be used (because no DMA channel is left to be used for example), the user needs to be aware
244 that the data rates will decrease significantly.
245
246 The \b software \b overhead is introduced by the way the measurement is done. When the measurement is started a system tick 
247 value is stored and then the transfer is set up and started. The software then needs to determine when the transfer 
248 has ended and calculate required time difference by using previously stored system ticks and current system ticks.
249 Usually, the software overhead is a constant number of CPU cycles. The total amount of time required for the software overhead 
250 depends on the actual CPU that is used and on the optimization level used during build. \n
251 Increasing the <b>Buffer size for baudrate test</b> reduces the software overhead effect. The following calculation example
252 explains why.
253
254 \b Calculation \b Example
255
256 SPI bus speed = 25 Mbps
257
258 - Buffer size for baudrate tests = 512 byte (default value, equals 512 * 8 bit)
259 - Actual bus speed = 18 Mbps (read from driver)
260 - Expected time to transfer data = 227 µs (512 * 8 bit/18 Mbps)
261 - Measured time = 245 µs = 227 µs + 18 µs (coming from a software overhead)
262 - This results in a measured/expected time ratio of 1.08 which will lead to a warning
263
264 Using a buffer size of 8192 bytes in the example above will reduce the software overhead to less than 1% (which will issue no
265 warning anymore).
266 */
267
268
269 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
270 /**
271 \page examples Examples
272
273 This Software Pack contains a set or pre-built examples that show how to use the validation suite together with real
274 hardware. The following example projects are available. Use
275 <a href="http://www2.keil.com/mdk5/packinstaller" target="_blank">Pack Installer</a> to copy them to your machine:
276
277 - \subpage examples_samv71XU
278 - \subpage examples_xmc4500_relax
279 - \subpage examples_mcbstm32f200
280 - \subpage examples_mcbstm32f400
281 - \subpage examples_stm32f746g
282
283 \anchor example_targets
284 Targets
285 -------
286
287 All projects contain two targets:
288 - \b Create \b XML or \b Create \b Report: Test results and statistics are printed to the file \c TestReport\TestReport.xml. 
289   Open the file in a web browser of your choice.
290 - \b Debug: Results and statistics are printed to the Debug (printf) Viewer window through the ITM output. You can also
291   examine the results in the \b test_report buffer structure which is accessible through the \b Watch window.
292 */
293
294
295 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
296 /**
297 \page examples_samv71XU Atmel SAMV71 Xplained Ultra
298
299 Software Setup
300 --------------
301
302 Using <a href="http://www2.keil.com/mdk5/packinstaller" target="_blank">Pack Installer</a>, copy the example project
303 <b>CMSIS-Driver Validation (SAMV71-XULTRA)</b> to your machine.
304
305 -# Choose one of the available \ref example_targets and build the project.
306 -# If you wish to test the loopback mode for some of the interfaces, refer to the next section for proper board
307    configuration.
308 -# Run the test on the target hardware.
309
310 \note To communicate with the development board, a debug adapter from the
311 <a href="http://www2.keil.com/mdk5/ulink/" target="_blank">ULINK</a> family is required.
312
313 Hardware Setup
314 --------------
315
316 The loopback settings for SPI and USART are done in SW. The SAMV71 device offers an internal loopback mode. The setting is
317 done in the file \c DV_Config.h (please use the \b Text \b Editor mode to see the appropriate \c \#defines). For Ethernet,
318 use a loopback plug as described in \ref eth_loopback "Loopback Communication Setup". 
319 */
320
321
322 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
323 /**
324 \page examples_xmc4500_relax Infineon XMC4500 Relax Kit
325
326 Software Setup
327 --------------
328
329 Using <a href="http://www2.keil.com/mdk5/packinstaller" target="_blank">Pack Installer</a>, copy the example project
330 <b>CMSIS-Driver Validation (XMC4500 Relax Lite Kit)</b> to your machine.
331
332 -# Choose one of the available \ref example_targets and build the project.
333 -# If you wish to test the loopback mode for some of the interfaces, refer to the next section for proper board
334    configuration.
335 -# Run the test on the target hardware using the on-board JLink-Lite debug adapter.
336
337 Hardware Setup
338 --------------
339
340 The following picture shows the necessary external loopback connections for the Keil MCBSTM32F400 evaluation board:
341  - UART2: \b P0.4 (UART2_RX)  and \b P0.5 (UART2_TX)  (Header X2)
342  - SPI0:  \b P5.0 (SPI0_MOSI) and \b P5.1 (SPI0_MISO) (Header X2)
343  - For Ethernet use a loopback plug as described in \ref eth_loopback "Loopback Communication Setup". 
344
345 \image html xmc4500.png  "Connections for Loop Back Communication Tests on Infineon XMC4500 Relax Kit"
346 */
347
348
349 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
350 /**
351 \page examples_mcbstm32f200 Keil MCBSTM32F200
352
353 Software Setup
354 --------------
355
356 Using <a href="http://www2.keil.com/mdk5/packinstaller" target="_blank">Pack Installer</a>, copy the example project
357 <b>CMSIS-Driver Validation (MCBSTM32F200)</b> to your machine.
358
359 -# Choose one of the available \ref example_targets and build the project.
360 -# If you wish to test the loopback mode for some of the interfaces, refer to the next section for proper board
361    configuration.
362 -# Run the test on the target hardware.
363
364 \note To communicate with the development board, a debug adapter from the
365 <a href="http://www2.keil.com/mdk5/ulink/" target="_blank">ULINK</a> family is required.
366
367
368 Hardware Setup
369 --------------
370
371 The following picture shows the necessary external loopback connections for the Keil MCBSTM32F400 evaluation board:
372  - SPI2: \b PB14 (SPI2_MISO) and \b PB15 (SPI2_MOSI)
373  - USART1: \b PB6 (USART1_TX) and \b PB7 (USART1_RX)
374  - For Ethernet use a loopback plug as described in \ref eth_loopback "Loopback Communication Setup". 
375
376 \image html mcbstm32f400.png  "Connections for Loop Back Communication Tests on Keil MCBSTM32F200"
377 */
378
379
380 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
381 /**
382 \page examples_mcbstm32f400 Keil MCBSTM32F400
383
384 Software Setup
385 --------------
386
387 Using <a href="http://www2.keil.com/mdk5/packinstaller" target="_blank">Pack Installer</a>, copy the example project
388 <b>CMSIS-Driver Validation (MCBSTM32F400)</b> to your machine.
389
390 -# Choose one of the available \ref example_targets and build the project.
391 -# If you wish to test the loopback mode for some of the interfaces, refer to the next section for proper board
392    configuration.
393 -# Run the test on the target hardware.
394
395 \note To communicate with the development board, a debug adapter from the
396 <a href="http://www2.keil.com/mdk5/ulink/" target="_blank">ULINK</a> family is required.
397
398
399 Hardware Setup
400 --------------
401
402 The following picture shows the necessary external loopback connections for the Keil MCBSTM32F400 evaluation board:
403  - SPI2: \b PB14 (SPI2_MISO) and \b PB15 (SPI2_MOSI)
404  - USART1: \b PB6 (USART1_TX) and \b PB7 (USART1_RX)
405  - For Ethernet use a loopback plug as described in \ref eth_loopback "Loopback Communication Setup". 
406
407 \image html mcbstm32f400.png  "Connections for Loop Back Communication Tests on Keil MCBSTM32F400"
408 */
409
410
411 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
412 /**
413 \page examples_stm32f746g STMicroelectronics STM32F746G-Discovery
414
415 Software Setup
416 --------------
417
418 Using <a href="http://www2.keil.com/mdk5/packinstaller" target="_blank">Pack Installer</a>, copy the example project
419 <b>CMSIS-Driver Validation (STM32F746G-Discovery)</b> to your machine.
420
421 -# Choose one of the available \ref example_targets and build the project.
422 -# If you wish to test the loopback mode for some of the interfaces, refer to the next section for proper board
423    configuration.
424 -# Run the test on the target hardware using the on-board ST-Link/V2.
425
426
427 Hardware Setup
428 --------------
429
430 The following picture shows the necessary external loopback connections for the STM32F746G-Discovery evaluation board:
431  - SPI2: \b D12 (SPI2_MISO) and \b D11 (SPI2_MOSI)
432  - USART6: \b D1 (USART6_TX) and \b D0 (USART6_RX)
433  - For Ethernet use a loopback plug as described in \ref eth_loopback "Loopback Communication Setup". 
434
435 \image html stm32f746G-disco.png  "Connections for Loop Back Communication Tests on STM32F746G-Discovery"
436 */
437
438 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
439 /**
440 \page resource_requirements Resource Requirements
441
442 \section heap_req Heap Requirements
443 Heap is used by memory allocation functions. It is configured in the
444 <a class="el" href="http://www.keil.com/support/man/docs/gsac/gsac_startupcodecortex.htm" target="_blank">startup_device.s</a>
445 file located under the \b Device component class.
446
447 Additional memory is allocated for the validation framework and for the buffers that are used in the driver tests. 
448
449 For the validation framework add 1024 bytes of heap. Then, double the amount of the largest buffer size specified in the
450 \ref step4 "DV_Config.h" file and add this as well.
451
452 | Option (under section Heap Configuration)                         | Increase Value by
453 | :---------------------------------------------------------------- | :----------------------
454 | Heap Size (in Bytes)                                              | + (1024 + 2 x maximum buffer size)
455
456 \b Calculation \b Example
457
458 Let's assume that the default heap size in your device's startup file is \c 0x400 (which is 1024 bytes). Add 1024 for the
459 framework and for example another 2048 bytes if you are using the default \b Buffer \b Size of 512 bytes but you have set the
460 <b>Buffer size for baudrate tests</b> to 1024 bytes. This computes to a total heap of 3584 bytes which is equivalent to
461 \c 0xE00. Set this number in the startup file.
462
463
464 \section rtos_req CMSIS-RTOS Requirements
465
466 Although the CMSIS-Driver Validation requires a CMSIS-RTOS to be present, it is not creating any additional threads. For
467 proper operation, you need to add a certain amount of thread stack size to the \c main thread. 
468
469 The thread requirements need to be reflected in the CMSIS-RTOS configuration. Refer to the
470 <a class="el" href="http://www.keil.com/pack/doc/cmsis/RTOS/html/index.html" target="_blank">CMSIS-RTOS Reference</a> for further details.
471
472 For <a class="el" href="http://www.keil.com/pack/doc/cmsis/RTOS/html/rtxImplementation.html" target="_blank">CMSIS-RTOS RTX</a>, thread
473 requirements are configured in the
474 <a class=el href="http://www.keil.com/pack/doc/cmsis/RTOS/html/configure.html" target="_blank">RTX_Conf_CM.c</a> file located
475 under the \b CMSIS component class:
476
477 <table class="doxtable" summary="CMSIS-RTOS Configuration">
478     <tr>
479       <th align="left">Option (under section Thread Configuration)</th>
480       <th>Set Value to</th>
481     </tr>
482     <tr>
483       <td>Default Thread stack size [bytes]</td>
484       <td>2048</td>
485     </tr>
486     <tr>
487       <td>Main Thread stack size [bytes]</td>
488       <td>2048</td>
489     </tr>
490 </table>
491
492 \note Do not forget to set the correct <b>RTOS Kernel Timer input clock frequency [Hz]</b> otherwise the tests will not run
493 properly on the device.
494 */