CMSIS-Driver Validation  Version 2.0.0
Driver Validation
 All Files Functions Variables Typedefs Macros Groups Pages
SPI Server

The SPI Server is an application providing a set of features used by the CMSIS-Driver Validation suite to test the physical operation of the SPI driver.
It is located in the <pack root directory>\Tools\SPI_Server directory.

The SPI Server offers the following features:

Operation

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.
Most commands do not have any additional related data phase, but some do have additional input or output data exchange phase following the command.

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.

Configuration

Communication interface settings used during command exchange are set in the SPI_Server_Config.h configuration file.

spi_server_config_h.png
SPI_Server_Config.h configuration file in Configuration Wizard view mode

Configuration settings

Driver_SPI# selects the driver instance used by the SPI Server.
Communication settings specify the communication parameters for command exchange with the SPI Client:

Note
The SPI Server is receiving commands operating in SPI Slave mode with usage of the Slave Select line

Commands

Commands are encoded in human readable format (ASCII strings) so they can be viewed by the SPI bus analyzer and analyzed more easily.

Supported commands:

Note
For details about commands please refer to Abstract.txt file in the <pack root directory>\Tools\SPI_Server\Board\MCBSTM32F400 directory.

Picture below shows a capture of SPI Driver Validation validating functionality of the Master transfer with Slave Select line not used

spi_bus_master_ss_unused.png

Porting SPI Server to other targets

To create SPI Server application for a different target device, follow the steps below:

  1. Create a new project in µVision for your target device
  2. In the RTE window enable and configure the following software components:
    • CMSIS: CORE
    • CMSIS: RTOS2 (API): Keil RTX5 any variant
    • CMSIS Driver: SPI (API)
    • CMSIS Driver: VIO (API) select Virtual implementation if implementation for your target system is not available
    • Generic device specific components (startup, clock system, I/O, ...) as required (please consult device's documentation for more information)
    • Resolve any unresolved dependencies between components
  3. Copy the SPI_Server.c file from the <pack root directory>\Tools\SPI_Server\Source directory to the project root and add it to µVision project
  4. Copy the SPI_Server.h and SPI_Server_HW.h files from the <pack root directory>\Tools\SPI_Server\Include directory to the project root
  5. Copy the files specified below from the directory <pack root directory>\Tools\SPI_Server\Config to the project root and add them to µVision project:
    • SPI_Server_Config.h: also adapt this file as required by your device
    • SPI_Server_HW.c: also adapt this file for your device's specific handling of the SPI Slave Select line
  6. Add root of the project to include path (Options for Target -> C/C++ -> Include Paths: .\)
  7. Add the main.c file from a template (Right-click Source Group 1... and select Add New Item to Group, select User Code Template and choose the CMSIS-RTOS2 'main' function file from CMSIS: RTOS2:Keil RTX5) and update with code snippet below (replace app_main function):
    #include "SPI_Server.h"
    /*----------------------------------------------------------------------------
    * Application main thread
    *---------------------------------------------------------------------------*/
    __NO_RETURN static void app_main (void *argument) {
    (void)argument;
    SPI_Server_Start();
    for (;;) {}
    }
  8. Build and download the ported SPI Server application to the target device

Troubleshooting

Problems and solutions:

  1. SPI Server is not responding to commands
    • reset the SPI Server
    • check that communication settings between SPI Server and SPI Driver Validation are the same,
      if they are not, correct them, rebuild the application and download to the hardware

SPI Server on the Keil MCBSTM32F400

SPI Server is currently available for the Keil MCBSTM32F400 evaluation board.

uVision project and source files are available in the <pack root directory>\Tools\SPI_Server\Board\MCBSTM32F400 directory.

On the Keil MCBSTM32F400 the SPI2 interface is used, with the following pinout:

SPI function Pin
SPI Clock PB10
Master Output Slave Input (MOSI) PB15
Master Input Slave Output (MISO) PB14
Slave Select PI0
Note
IMPORTANT: Ground must be connected between SPI Server and Device (Driver) Under Test so that SPI signals have same ground potential.

For more information please consult Abstract.txt file in the project root.

Note
SPI Server on the Keil MCBSTM32F400 does not support National Semiconductor Microwire Frame Format.