CMSIS-Driver Validation  Version 1.2.0
Driver Validation
 All Files Functions Variables Typedefs Macros Groups Pages
Test Setup

Step 1: Create an MDK project with your target microcontroller device

Step 2: Add required software components

For proper operation, add the following software components in the Manage Run-Time Environment window:

  • CMSIS:RTOS (API):Keil RTX
  • Compiler:I/O:STDOUT, variant ITM or User if your hardware does not support ITM.
  • CMSIS:CMSIS Driver Validation:Framework
  • Any other component from CMSIS:CMSIS Driver Validation
  • Resolve any validation messages

Step 3: Add main.c

Right-click Source Group 1... and select Add New Item to Group. Select User Code Template and choose the main file from Device:Startup or CMSIS-RTOS:RTOS:Keil RTX.

Add this include:

include "cmsis_dv.h"

In the main function, after initialization, call

to run all tests that you have chosen in the next step.

Step 4: Configure DV_Config.h

Open DV_Config.h under the CMSIS Driver Validation group in the Project window.

dv_config_h.png
Configuration File DV_Config.h

Common Test Settings

The common test settings help you to choose the output format of the test and the buffer sizes and buffer content that should be used for the send, receive, and transfer tests:

  • The Print Output Format lets you select if you wish to create the output as plain text or as styled XML.
  • The Buffer size for assertions results determines the size of the buffer that can be observed in the Watch window.
  • Buffer sizes lets you select the buffer sizes that are used for data transfer. This setting has a direct impact on required heap.
  • You can specify also the Buffer size for baudrate test. For USART you can set the Percentual tolerance for baudrate test and for SPI the Percentual trigger for bus speed test. Depending on the device configuration, 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.
  • Select your preferred Buffer pattern

Driver-specific Settings

Every interface has specific settings that can be changed in the according section:

  • You need to specify the driver instance number (Driver_interface#) is used for the test. This is especially important for microcontroller devices that have multiple peripherals of the same kind.
  • Some drivers can have additional baudrate or timing settings.
  • 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.
Note
For more information on additional settings and the different driver test cases, check the Reference section.

Step 5: Configure Keil RTX

Open RTX_Conf_CM.c and edit set:

  • Default Thread stack size [bytes] to 2048
  • Main Thread stack size [bytes] to 2048
  • RTOS Kernel Timer input clock frequency [Hz] to the correct frequency of your device.

Step 6: Configure Heap

Depending on the buffer sizes that you have chosen in step 4, you need to add more heap. Open your startup_device.s file from the Device group in the Project window. Click on Configuration Wizard. Increase the heap size:

  • For the validation framework add 1024 bytes.
  • double the largest buffer size you have set in the configuration file and add this as well.

Refer to the Resource Requirements section for a calculation example.

Step 7: Configure the Device

Depending on your device, you might have different pin/hardware configuration options. Usually, you can configure the device using the RTE_Device.h file from the Device 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 examples are already configured for the underlying hardware.

For a robust test with good coverage, implement various targets with different settings:

  • Enable/disable the DMA controller of your device
  • Set different buffer sizes in DV_Config.h
  • Select different compiler optimization levels in the C/C++ tab of the Options for Target dialog.

Step 8: Make Hardware Connections for Loopback Tests

These interfaces support loopback testing: Ethernet, SPI, and USART. Connect the following pins on your target hardware together (refer to the hardware schematics):

  • Ethernet: RX+ and TX+, RX- and TX-
  • SPI: MISO and MOSI
  • USART: RX and TX

Step 9: Download and Run the Project

In the Options for Target dialog, under debug settings, ensure that Trace and ITM port 0 are enabled and that the correct clock frequency is set:

target_dialog.png
ITM Channel setting

Build, load and run the project. The output is displayed in the Debug (printf) Viewer window:

CMSIS-Driver Test Suite   Oct  8 2015   17:12:21 

TEST 01: ETH_MAC_GetCapabilities          PASSED
TEST 02: ETH_MAC_Initialization           PASSED
TEST 03: ETH_MAC_PowerControl             
  DV_ETH.c (163) [WARNING] Low power is not supported
TEST 04: ETH_MAC_SetBusSpeed              
  DV_ETH.c (197) [WARNING] Link speed 1G is not supported
TEST 05: ETH_MAC_Config_Mode              PASSED
TEST 06: ETH_MAC_Config_CommonParams      PASSED
TEST 07: ETH_PHY_Initialization           PASSED
TEST 08: ETH_PHY_PowerControl             
  DV_ETH.c (300) [WARNING] Low power is not supported
TEST 09: ETH_PHY_Config                   PASSED
TEST 10: ETH_Loopback_Transfer            PASSED
TEST 11: ETH_PHY_CheckInvalidInit         NOT EXECUTED
TEST 12: ETH_MAC_CheckInvalidInit         NOT EXECUTED

Test Summary: 12 Tests, 10 Executed, 7 Passed, 0 Failed, 3 Warnings.
Test Result: WARNING

If you see warnings during loopback transfer tests, please read the section Reading Test Results which gives you more information on how to interpret the results.