Search by Tags

How to use SPI library

 

Compare with Revision




Subscribe for this article updates

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.

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

Download Project

Project Module compatibility Language Library Version
SPI PXA / Tegra C Toradex CE Library (Old)
SPI VFxx / iMX6 C Toradex CE Library (New)
SPI PXA / Tegra C# Toradex CE Library (Old)
SPI VFxx / iMX6 C# Toradex CE Library (New)

Demo application in C

Demo application in VCsharp

Output

Sine waveform

Square waveform

Sawtooth waveform

Triangle waveform