This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to access the external interface output from ads8568 into DSP TMS320F28835.

Other Parts Discussed in Thread: TMS320F28335, ADS8568

8420.ITSV1P7_ANALOG_ADC.pdf I want example code how to give lead,  active  and trail in XTIMCLK how to enable XRD to get data. please help me. here i am also sending schematic.

#include "DSP2833x_Device.h"
#include "stdio.h"

//extern void Delay(unsigned int Data);

#define ADC_CS GpioDataRegs.GPADAT.bit.GPIO19
#define ADC_CNV_A GpioDataRegs.GPADAT.bit.GPIO9
#define ADC_CNV_B GpioDataRegs.GPADAT.bit.GPIO10
#define ADC_CNV_C GpioDataRegs.GPADAT.bit.GPIO11
#define ADC_CNV_D GpioDataRegs.GPADAT.bit.GPIO12
#define ADC_OUT GpioDataRegs.GPCDAT.all
#define ADC_RST GpioDataRegs.GPADAT.bit.GPIO20
#define ADC_INT GpioDataRegs.GPADAT.bit.GPIO0
#define ADC_WR GpioDataRegs.GPBDAT.bit.GPIO38
void Delay(unsigned int Data);
void ADC_Read(void);
void ADC_Reset(void);
void ADC_Init(void);
unsigned int reverse(unsigned int x);


void ADC_Init(void) //initialisation to their default values
{
ADC_INT = 1;
ADC_CS = 1;
ADC_WR = 1;
ADC_CNV_A = 0;
ADC_CNV_B = 0;
ADC_CNV_C = 0;
ADC_CNV_D = 0;
ADC_RST = 0;
}

void ADC_Reset(void) // ADC Reset
{
ADC_RST = 1;
Delay(0xFF);
ADC_RST = 0;
}

void ADC_Config(void) // ADC Config
{
GpioCtrlRegs.GPCDIR.all = 0xFFFFFFFF;
ADC_CS = 0;
ADC_WR = 0;
ADC_OUT = 0xC800;
Delay(0x05);
ADC_WR = 1;
Delay(0x02);
ADC_WR = 0;
ADC_OUT = 0x03FF;
Delay(0x05);
ADC_WR = 1;
ADC_CS = 1;
GpioCtrlRegs.GPCDIR.all = 0x00000000;
}


void ADC_Read(void)
{
unsigned int ADC_Data[8] = {0x0000};

ADC_CS = 0; // parallel interface enable
ADC_CNV_A = 1;
Delay(0x05);
while(!ADC_INT);
ADC_CNV_A = 0;
ADC_CS = 0; // parallel interface enable
ADC_Data[0] = ADC_OUT & 0xFFFF; //channel A0
ADC_Data[0] = reverse(ADC_Data[0]);
Delay(0x05);
ADC_Data[1] = ADC_OUT & 0xFFFF; //channel A1
ADC_Data[1] = reverse(ADC_Data[1]);

ADC_CNV_B = 1;
Delay(0x05);
ADC_CNV_B = 0;
Delay(0x05);
while(!ADC_INT);
ADC_Data[2] = ADC_OUT & 0xFFFF;
ADC_Data[2] = reverse(ADC_Data[2]); //channel B0
Delay(0x05);
ADC_Data[3] = ADC_OUT & 0xFFFF; //channel B1
ADC_Data[3] = reverse(ADC_Data[3]);

ADC_CNV_C = 1;
Delay(0x05);
ADC_CNV_C = 0;
Delay(0x05);
while(!ADC_INT);
ADC_Data[4] = ADC_OUT & 0xFFFF; //channel C0
ADC_Data[4] = reverse(ADC_Data[4]);
Delay(0x05);
ADC_Data[5] = ADC_OUT & 0xFFFF; //channel C1
ADC_Data[5] = reverse(ADC_Data[5]);

ADC_CNV_D = 1;
Delay(0x05);
ADC_CNV_D = 0;
Delay(0x05);
while(!ADC_INT);
ADC_Data[6] = ADC_OUT & 0xFFFF; //channel D0
ADC_Data[6] = reverse(ADC_Data[6]);
Delay(0x05);
ADC_Data[7] = ADC_OUT & 0xFFFF; //channel D1
ADC_Data[7] = reverse(ADC_Data[7]);


ADC_WR = 0; // Parallel data input in disabled
ADC_CS = 0; // parallel interface disable


}

unsigned int reverse(unsigned int x)
{
x = (((x & 0xaaaa) >> 1) | ((x & 0x5555) << 1));
x = (((x & 0xcccc) >> 2) | ((x & 0x3333) << 2));
x = (((x & 0xf0f0 ) >> 4) | ((x & 0x0f0f ) << 4));
x = (((x & 0xff00 ) >> 8) | ((x & 0x00ff ) << 8));
return((x >> 8) | (x << 8));

}

void Delay(unsigned int Data)
{
while(Data--);
}

  • Hi Pattan,

    We do not have any ready made code examples for you that combine the ADS8568 with the TMS320F28335.  If you looked through the code example that I pointed you to yesterday, you should see that the ADS8568 needs to be setup as a peripheral on the external memory interface on the DSP to work with the read and write strobes.  For help in getting the XINTF setup, please review these documents:

    You can also try posting a query in the C2000 microcontroller forum on how to setup the parallel interface for use with an external ADC.