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.

ADS127L01 reading data problem.

Other Parts Discussed in Thread: TM4C123GH6PM, ADS127L01

Hi Ai am trying to read data from ADS127L01. here is my initialization code. I get random code back when I do SSIGetData . Not sure what is the  right way of reading data which is actually 32 bit in 16 bit data transmissions in one go.  i am using ADS127L01 EVM but using my own CPU TM4C123Gh6PM to control ADS127L01.

Attache SSI logic signals screenshot.

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_SSI2));
ROM_GPIOPinConfigure(GPIO_PB6_SSI2RX);
ROM_GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_6);
ROM_GPIOPinConfigure(GPIO_PB5_SSI2FSS);
ROM_GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_5);
ROM_GPIOPinConfigure(GPIO_PB7_SSI2TX);
ROM_GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_7);
ROM_GPIOPinConfigure(GPIO_PB4_SSI2CLK);
ROM_GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4);

ROM_SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_1, SSI_MODE_MASTER, 8000000, 16);
ROM_SSIEnable(SSI2_BASE);

ROM_GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_3); //DREADY PIN active low.
ROM_GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);

uint32_t data[2] = {0,0};
uint32_t result;
char res[80];

ROM_SSIDataPut(SSI2_BASE, 0x08);
while(SSIBusy(SSI2_BASE));
SysCtlDelay(8000);

while(GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_3));

ROM_SSIDataPut(SSI2_BASE, 0x12);
while(SSIBusy(SSI2_BASE));

ROM_SSIDataGet(SSI2_BASE, &data[0]); //
while(SSIBusy(SSI2_BASE));

ROM_SSIDataGet(SSI2_BASE, &data[1]); //
while(SSIBusy(SSI2_BASE));

ROM_SSIDataPut(SSI2_BASE, 0x0A);
while(SSIBusy(SSI2_BASE));

result = data[1]+((data[0]<<16)&0x00FF0000);
//result = (data[1] ) | (data[0]<<16);
sprintf(res, " %d, %d, %.2f, [ %d, %X ] \n",data[0],data[1], (float)result*ADCRES, result, result);
UARTprintf("%s",res);
//UARTprintf("Bytes: %d, %d, [ %d, %X ]\n", data[0], data[1], result ,result);

  • Hello Harish,

    Did you ensure that the SSI Master (in this case the MCU) is giving out the correct data. Is the screen shot captured when the ROM_SSIDataPut(SSI2_BASE, 0x08); and ROM_SSIDataPut(SSI2_BASE, 0x12); were called?

    If yes, then did you check if the SSI slave is expecting any commands before it starts transmitting meaningful data?

    How to combine 2 16-bit data chuncks into one 32-bit word depends on what is being transmitted first, MSB or LSB. Please refer the datasheet, specifically the frame format and FIFO operation of the SSI section.

    Thanks,
    Sai
  • Hi Sai,

                     Yes er datasheet 0x08 code is to start ADC conversion and 0x012 is to read data. which is being sent by CPU correctly. I am not sure if I shd  SSLGetData twice  to read 32 bit data? or something else. Because I know each transfer will only do 16 bits at a time. Any thoughts.

    pasting from datasheet of  ADS127L01.

  • Hello Harish,

    Since the MCU is sending the correct values to initiate the data transfer from the ADS127L01, looks like the issue is only during the read. Since you are expecting 32 bits of data, I believe you should call the SPIGetData twice.

    Please refer the data sheet of ADS127L01 to see how the data is being transmitted over SPI , LSB first or MSB first. Then refer the MCUs datasheet to see how the data received on the SPI is stored in the FIFO. This should tell how to format the received data.

    Typically devices have a known value (like device ID) that could be read out to make sure that the data is being received correctly. If this device has such a value, then try to read it first before reading the actual ADC values.

    Thanks,
    Sai
  • Thanks I was able to fix .

  • Your "Verified Answer" provides little of benefit to anyone here!    (thus it's not proper to characterize it as an "answer" - is that not so?)