This article aims to help the developer, to use Toradex SPI library in VCSharp.
SPI Library provides easy access to SPI interface available on Toradex computer modules. SPI (Serial Peripheral Interface) library configures the SSP (Synchronous Serial Port) unit to be used as a standard SPI interface.
Some of the devices that can be interfaced using SPI interface are:
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 (any module can be used) and Evaluation board V3.1A to generate Square, Sine, Sawtooth and Triangle Waveforms.
The following pin connections have to be made between MCP4921 12-bit DAC and Evaluation Board v3.1A for running the SPI Library on Colibri T20.
|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|
This application demonstrates how to use Toradex SPI library to read/ write operation on SPI chip.
Follow the steps as mentioned below:
Screenshot of Demo application running.
Oscilloscope output showing Square- wave output from DAC.
Oscilloscope output showing Sine- wave output from DAC.
Oscilloscope output showing Sawtooth- wave output from DAC.
Oscilloscope output showing triangle- wave output from DAC.