CMSIS-Driver Validation  Version 1.0
Driver Validation
 All Files Functions Variables 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. Select all tests that you wish to use. For more information on the test cases, check the Reference section.

Common Test Settings The common test settings help you to choose the output format of the test and the buffer sizes and buffer contest 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 and
  • Select your preferred Buffer pattern
dv_config_h.png
Configuration File DV_Config.h

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 buffer sizes you have set and add this as well.

Calculation Example

Let's assume that the default heap size in the startup file is 0x400 (which is 1024 bytes). Add 1024 for the framework and for example another 1024 if your buffer size is set to 512 bytes (default). This computes to a total heap of 3072 which is equivalent to 0xC04. Set this number in the startup file.

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.

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