You are currently viewing Interfacing SPI ADC with TMS320C6745 DSP

Interfacing SPI ADC with TMS320C6745 DSP

Spread the love

The TMS320C6745 DSP Development 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.

Circuit Diagram to Interface SPI ADC with TMS320C6745

C Program to Interfacing SPI ADC with TMS320C6745 DSP

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 );




Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.