![]() |
CMSIS-Driver Validation
Version 1.3.0
Driver Validation
|
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, in worst case, for every transferred byte. The interrupt handling overhead for each byte can produce 10 times slower transfer than DMA. 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 system tick value is stored and then the transfer is set up and started. The software then needs to determine when the transfer has ended and calculate required time difference by using previously stored system ticks and current 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
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).