Attention: 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:
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.
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.
The following pin connections have to be made between MCP4921 12-bit DAC and Evaluation Board v3.1A.
MCP4921 | SPI Signal | Evaluation Board V3.1A (Silkscreen) |
DAC_CS | Chip Select (CS) | SODIMM_86 / SSP_FRM |
DAC_SCK | Serial Clock (SCLK) | SODIMM_88 / SSP_SCLK |
DAC_SDI | Master Out Slave In (MOSI) | SODIMM_92 / SSP_TXD |
+5V (2.7V - 5.5V operational range) | - | 3.3V |
GND | - | GND |
VS2008 Project | VS2013 Project | VS2015 Project | Module compatibility | Language | Library Version |
---|---|---|---|---|---|
SPI | - | - | PXA / Tegra | C | Toradex CE Library (Old) |
SPI | SPI | SPI | Tegra / VFxx / iMX6 | C | Toradex CE Library (New) |
SPI | - | - | PXA / Tegra | C# | Toradex CE Library (Old) |
SPI | - | - | VFxx / iMX6 | C# | Toradex CE Library (New) |
Note: It is always recommended to update the libraries first before compiling the demo project. Click on this link to get latest libraries.
Sine waveform
Square waveform
Sawtooth waveform
Triangle waveform