Skip to main content

Windows CE Library - SPI Library (SPILib)


this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.


This library manages the SPI interfaces via polling

Current Version


Application Notes

SPILib supports up to 6 SPI ports on Colibri and Apalis modules.

The SPILib can be used in PIO-mode or DMA mode. PIO mode is more efficient for transfers < 32 SPI Words.

In SPI slave mode, data can easily get lost if packets are larger than FIFO size (32 frames on T20/T30). Use DMA mode instead.

Library API

Click here for the library API

Other Resources

Windows CE Libraries Overview

Colibri SPI

How to use SPI library

Revision History

DateRevChange Notes
29/06/2015V5.4Fix default pin configuration for PXA300.
Implemented automatic default pin selection for all SPI channels on Colibri T20/T30 and Apalis T30.
Added code to detect and resolve conflicting AltFn settings on multiple pins (Tegra).
Added configuration options for Tegra (wait method, chip select number/behavior, packed mode).
Support all 6 SPI channels on T30. This is a requirement for CAN1 on Apalis T30.
Replace printf debug messages with regular debug output.
Improve stability of SPI communication on Tegra. Performance may be slightly degraded.
30/10/2014V5.3Fix issue on T20/T30 modules: Small SPI transfers using DMA caused the application to freeze.
Fix issue on T20/T30 modules: SPI transfers using DMA caused the application to freeze, if transfer size was not a multiple of 4.
27/05/2014V5.2Non-standard SPI pin configurations can now be defined as GPIO numbers instead of SODIMM pins. This is to support on-module SPI channels, e.g. for the Apalis on-module CAN controllers
Adjust default SPI pin configurations for Apalis
15/04/2014V5.1Add TegSpiSetWaitMethod() to choose between interrput-driven and busyLoop waiting
Use DMA-like SPI control method even in non-DMA mode to prevent possible data loss of received data.
Remove deprecated functions TegWriteSPIUnpacdked() and TegReadSPIUnpacked()
Fix issue that caused a data abort when calling SPIInit() the 2nd time
11/03/2014V5.0Fix bit rate calculation
Pre-allocate memory for DMA, instead of allocating it for each transfer
Performance improvements
Fix pin initialization
23/09/2013V4.1Change default SDK to Colibri600 / Added support for T30's SPI5 and SPI6
12/08/2013V4.0.1Improved performance of SPIReadWritePolling(), SPIReadPolling() and SPIWritePolling() on Tegra processors

Send Feedback!