Interfacing SPI ADC with TMS320C6745 DSP

Tags: how to interface spi adc with tms320c6745, tms320c6745 spi , how to work with tms320c6745 spi protocol , tms320c6745 spi interfacing, tms320c6745 spi example, spi example, dsp spi example, tms320c6745 spi example c code, c6745 spi interfacing example c c, dsp spi protocol , dsp adc, how to interface adc with tms320c6745, tms320c675 interface with adc, adc, 12 bit adc, 12 bit spi adc , MCP3202 12 bit spi adc c code, mcp3202 adc c program, map3202, mcp3202 spi adc c program, mcp3202 dsp c cprogram,
Overall rating

The TMS320C6745 EVALUATION BOARD is specially desgined for developers in dsp field as well as beginners. The kit is designed in such way that all the possible features of the DSP will be easily used by the everyone.

The kit supports in Code Composer Studio3.1 and later, with XDS100 v1 USB Emulator which is done USB port.


An analog-to-digital converter (abbreviated ADC, A/D or A to D) is a device that converts a continuous quantity to a discrete time digital representation. An ADC may also provide an isolated measurement. The reverse operation is performed by a digital-to-analog converter (DAC).

Typically, an ADC is an electronic device that converts an input analog voltage or current to a digital number proportional to the magnitude of the voltage or current.

Basic SPI

The ADCs are SPI Bus based which is a serial bus. So the number of pins in IC is very low. Total of 4 lines are required to interface it with TMS320C6745.

  • MISO (Master In Slave Out)
  • MOSI (Master Out Slave In)
  • SCK (Serial Clock)
  • CS (Chip Select)

As you know in synchronous serial communication their is a clock line (SCK in case of SPI) which synchronizes the transfer.

The clock is always controlled by the MASTER. In our case the TMS320C6745 is the MASTER and the MCP3202 is a slave on the bus. SPI is full duplex, that means data can be sent and received simultaneously.

MCP3202 is a successive approximation 12-bit Analog-to-Digital (A/D) Converter with on-board sample and hold circuitry. The MCP3202 is programmable to provide a single pseudo differential input pair or dual single-ended inputs.

Digital Output Code

The digital output code produced by an A/D Converter is a function of the input signal and the reference voltage. For the MCP3202, VDD is used as the reference voltage. As the VDD level is reduced, the LSB size is reduced accordingly. The theoretical digital output code produced by the A/D Converter is shown below.



      VIN  =  analog input voltage

      VDD  =  supply voltage

Circuit Diagram to Interface SPI ADC with TMS320C6745


C Program to Read Analog input through ADC using TMS320C6745


Title : Program to Read Analog input in TMS320C6745 kit through SPI ADC module



#include "stdio.h"

#include "c6745.h"

#include "spiadc.h"

signed int adc_value;

void main( void )


        static Uint8 spiadcbuf[3];

        C6745_init( );




                spiadcbuf[0] = 0x01; // setup command

                spiadcbuf[1] = 0xBF;


        spiadcbuf[2] = 0x00;

                spiadc_cycle(spiadcbuf, 3);  // Execute spiadc read cycle

                adc_value = ((spiadcbuf[1]&0x0f) << 8)| spiadcbuf[2];

                printf( "%x  \n",adc_value );





Join the World's Largest Technical Community

we respect your privacy.