CMSIS-Driver Validation  Version 1.0
Driver Validation
 All Files Functions Variables Typedefs Macros Groups Pages
Reading Test Results

The tests SPI_Loopback_CheckBusSpeed and USART_Loopback_CheckBaudrate may issue warnings when using the default settings (especially loopback communication tests for SPI and USART):

CMSIS-Driver Test Suite   Nov 18 2015   09:26:38 

TEST 01: SPI_GetCapabilities              PASSED
TEST 02: SPI_Initialization               PASSED
TEST 03: SPI_PowerControl                 
  DV_SPI.c (244) [WARNING] Low power is not supported
TEST 04: SPI_Config_PolarityPhase         PASSED
TEST 05: SPI_Config_DataBits              PASSED
TEST 06: SPI_Config_BitOrder              
  DV_SPI.c (315) [WARNING] Bit order LSB_MSB is not supported
TEST 07: SPI_Config_SSMode                
  DV_SPI.c (343) [WARNING] Slave select MASTER_HW_INPUT is not supported
TEST 08: SPI_Config_BusSpeed              PASSED
TEST 09: SPI_Config_CommonParams          PASSED
TEST 10: SPI_Send                         PASSED
TEST 11: SPI_Receive                      PASSED
TEST 12: SPI_Loopback_CheckBusSpeed       
  DV_SPI.c (525) [WARNING] At 25000kHz: measured time is 2.437125 x expected time
TEST 13: SPI_Loopback_Transfer            PASSED
TEST 14: SPI_CheckInvalidInit             NOT EXECUTED

The measured time is depending mainly on two factors: DMA and software overhead.

If you are not using DMA for data transfer, an interrupt is generated for every byte that is transfered in worst case. The interrupt handling overhead for each byte can become so large that the factor is quickly over 10. DMA will transfer the data without overhead. Thus, only bus speed/baudrate tests with DMA enabled should be considered for optimization. In case DMA cannot be used (because no DMA channel is left to be used for example), the user needs to be aware that the data rates will decrease significantly.

The software overhead is introduced by the way the measurement is done. When the measurement is started a number of system ticks are captured and then the transfer is set up and started. The software then needs to determine when the transfer has ended and capture again the system ticks. Usually, the software overhead is a constant number of CPU cycles. The total amount of time required for the software overhead depends on the actual CPU that is used and on the optimization level used during build.
Increasing the Buffer size for baudrate test reduces the software overhead effect. The following calculation example explains why.

Calculation Example

SPI bus speed = 25 Mbps

  • Buffer size for baudrate tests = 512 byte (default value, equals 512 * 8 bit)
  • Actual bus speed = 18 Mbps (read from driver)
  • Expected time to transfer data = 227 µs (512 * 8 bit/18 Mbps)
  • Measured time = 245 µs = 227 µs + 18 µs (coming from a software overhead)
  • This results in a measured/expected time ratio of 1.08 which will lead to a warning

Using a buffer size of 8192 bytes in the example above will reduce the software overhead to less than 1% (which will issue no warning anymore).