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.

ADS8694: Analog data reading problem

Part Number: ADS8694
Other Parts Discussed in Thread: TM4C1294NCPDT,

Hii,

I am using TM4C1294NCPDT  to communicate with ADS8694, i am able to set registers and read it back but while reading analog data i am getting below data and ones check attached code and i am getting same data as below when i connected channel 1 to either 5V or GND

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "inc/tm4c1294ncpdt.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/debug.h"
#include "inc/hw_gpio.h"
#include "driverlib/timer.h"
#include "driverlib/pwm.h"
#include "driverlib/adc.h"
#include <math.h>
#include "driverlib/fpu.h"
#include "driverlib/uart.h"
#include "driverlib/flash.h"
#include "inc/hw_ssi.h"
#include "driverlib/ssi.h"


void ssi_init(void)
{
    uint32_t ui32SysClkFreq;

    ui32SysClkFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);  //Enable ssi2
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); //Enable PORT D GPIO to be used with ssi2 data and frame signals

    GPIOPinConfigure(GPIO_PD3_SSI2CLK);

    GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_2);              // ~CS - configure it as GPIO output
    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, GPIO_PIN_2);

    GPIOPinConfigure(GPIO_PD1_SSI2XDAT0);//mosi
    GPIOPinConfigure(GPIO_PD0_SSI2XDAT1);//miso
    GPIOPinTypeSSI(GPIO_PORTD_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_3);

    SSIConfigSetExpClk(SSI2_BASE, ui32SysClkFreq, SSI_FRF_MOTO_MODE_1, SSI_MODE_MASTER, 4000000, 8);
    SSIEnable(SSI2_BASE);
}



int main(void)
{

    uint32_t data[10];
    printf("Well come....\n");
    ssi_init();
    int i,j;
for(i=0;i<6;i++)
{
    SysCtlDelay(8000000);

    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, 0x00);//cs low
    SysCtlDelay(1200);

    SSIDataPut(SSI2_BASE, 0x0D);
    while(SSIBusy(SSI2_BASE));

    SSIDataPut(SSI2_BASE, 0x05);
    while(SSIBusy(SSI2_BASE));

    SSIDataPut(SSI2_BASE, 0xFF);//dummy
    while(SSIBusy(SSI2_BASE));

    SysCtlDelay(1200);
    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, GPIO_PIN_2);//cs high

    SysCtlDelay(4000000);

    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, 0x00);//cs low
    SysCtlDelay(1200);

    SSIDataPut(SSI2_BASE, 0x0C);//auto sec read mode
    while(SSIBusy(SSI2_BASE));

    SSIDataPut(SSI2_BASE, 0xFF);//dummy
   // while(SSIBusy(SSI2_BASE));
    SSIDataGet(SSI2_BASE,&data[2]);

    SSIDataPut(SSI2_BASE, 0xFF);//dummy
    //while(SSIBusy(SSI2_BASE));
    SSIDataGet(SSI2_BASE,&data[3]);

    SysCtlDelay(1200);
    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, GPIO_PIN_2);//cs high

    printf("Data1 = %x\n",data[2]);
    printf("Data2 = %x\n",data[3]);
    SysCtlDelay(8000000);
}

    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, 0x00);//cs low
    SysCtlDelay(1200);

    SSIDataPut(SSI2_BASE, 0xC4);//
    while(SSIBusy(SSI2_BASE));

    SSIDataPut(SSI2_BASE, 0x00);//
    while(SSIBusy(SSI2_BASE));

    SSIDataPut(SSI2_BASE, 0xFF);//dummy
    while(SSIBusy(SSI2_BASE));

    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, GPIO_PIN_2);//cs high



 while(1)
 {

     SSIDataPut(SSI2_BASE, 0x00);//dummy
     SSIDataPut(SSI2_BASE, 0x00);//dummy

    SSIDataPut(SSI2_BASE, 0xFF);//dummy
    while(SSIBusy(SSI2_BASE));
    SSIDataGet(SSI2_BASE,&data[0]);

    SSIDataPut(SSI2_BASE, 0xFF);//dummy
    while(SSIBusy(SSI2_BASE));
    SSIDataGet(SSI2_BASE,&data[1]);

    SSIDataPut(SSI2_BASE, 0xFF);//dummy
    while(SSIBusy(SSI2_BASE));
    SSIDataGet(SSI2_BASE,&data[2]);

    SysCtlDelay(1200);
    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, GPIO_PIN_2);//cs high



    for(j=0;j<3;j++)
    {
        printf("data[%d] = %x\n",j,data[j]);
    }

    printf("\n");

   // SysCtlDelay(8000000);
 }


}

  • Hi Nagaraju,

    Can you please provide the following information?

    1. Oscilloscope plots for /CS, SCLK, SDI and SDO. This will allow us to verify the timing. 
    2. Your schematic and test conditions including analog input voltage and the voltage measured on the REFIO pin.

    Thanks.

    Best&regards,

    Dale

  • Hi Nagaraju,

    I have not receive a feedback for three weeks. I will close this thread. You can start a new query if you have any questions.

    Regards,

    Dale