Skip to main content

How to use SPI library


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.

SPI (Serial Peripheral Interface) library make the use of the SPI/SSP interface very easy.

Use cases:

  • SPI based Temperature sensors
  • Memories like Flash and EEPROM
  • Audio codecs
  • DAC (Digital to Analog Converter)
  • MMC and SD cards
  • and many more..

SPI Library‚Äč

For general information about SPI, please have a look at this article.

We provide free SPI Library including sample demo source codes.

NOTE: Please use compatible SPI Channel if you want to maintain compatibility between different Colibri modules.

Demo Application showing how to use external SPI DAC Chip‚Äč

This tutorial demonstrates the use of Toradex SPI library to interface MCP4921 12-bit digital to analog converter (DAC) with Colibri T20 module using Evaluation board v3.1A to generate waveform.

Hardware setup‚Äč

The following pin connections have to be made between MCP4921 12-bit DAC and Evaluation Board v3.1A.

MCP4921SPI SignalEvaluation Board V3.1A (Silkscreen)
 DAC_CS Chip Select (CS) SODIMM_86 / SSP_FRM
 DAC_SDI Master Out Slave In (MOSI) SODIMM_92 / SSP_TXD
 +5V (2.7V - 5.5V operational range) - 3.3V

Download Project‚Äč

VS2008 ProjectVS2013 ProjectVS2015 ProjectModule compatibilityLanguage
SPI--PXA / TegraC
SPI--PXA / TegraC#
SPI--VFxx / iMX6C#

It is always recommended to update the libraries first before compiling the demo project. Click on this link to get latest libraries.

Demo application in C‚Äč

Demo application in VCsharp‚Äč


Sine waveform

Square waveform

Sawtooth waveform

Triangle waveform

Send Feedback!