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.

CCS/LAUNCHXL-CC2640R2: Incorrect value read from ADS1220

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: ADS1220, CC2640

Tool/software: Code Composer Studio

Hello,

I have been trying to interface ads1220 with cc2640 launchpad. When I am connecting to ground the AIN2, values received by me are: 

SPI Initialized!

Sample 0: 255
Sample 1: 255
Sample 2: 255
Sample 3: 255
Sample 4: 255
Sample 5: 190
Sample 6: 190
Sample 7: 190
Sample 8: 190
Sample 9: 190
Sample 10: 255
Sample 11: 255
Sample 12: 255
Sample 13: 255
Sample 14: 255
Sample 15: 255
Sample 16: 255
Sample 17: 255
Sample 18: 255
Sample 19: 255
SPI closed!

Basic interfacing code is as follows:

uint16_t sample;
//uint16_t temperature;
uint8_t txBuffer[] = {0x43,0xA1,0x04,0x00,0x02} ;
uint8_t rxBuffer[20];

GPIO_init();

SPI_init();
Display_init();

SPI_Handle handle;
SPI_Params params;
SPI_Transaction transaction;


display = Display_open(Display_Type_UART, NULL);

if (display == NULL) {
while (1);
}

Display_printf(display, 0, 0, "Starting the Ads1220 example\n");

// Init SPI and specify non-default parameters
SPI_Params_init(&params);
params.bitRate = 1000000;
params.frameFormat = SPI_POL0_PHA1;
params.mode = SPI_MASTER;

// Configure the transaction
transaction.count = sizeof(txBuffer);
transaction.txBuf = txBuffer;
transaction.rxBuf = rxBuffer;

// Open the SPI and initiate the first transfer
handle = SPI_open(Board_SPI_MASTER, &params);

if (handle == NULL) {
Display_printf(display, 0, 0, "Error Initializing I2C\n");
while (1);
}
else {
Display_printf(display, 0, 0, "SPI Initialized!\n");
}


for (sample = 0; sample < 20; sample++) {

if(SPI_transfer(handle, &transaction))
{
Display_printf(display, 0, 0, "Sample %u: %d",
sample, rxBuffer[sample]);
}
else {
Display_printf(display, 0, 0, "I2C Bus fault.");
}

sleep(1);

}

SPI_close(handle);

Display_printf(display, 0, 0, "SPI closed!");

return (NULL);
}

Chip select pin is low throughout the proces.

  • Abhishek,

    1. Have you experimented with the "spimaster" from the CC2640R2 SDK? 
    2. Are you configuring your bit rate correctly based on the ADS1220 specs? The ADS datasheet says that the minimum clock period is 150ns. 
    3. How did you end up with "Display_printf(display, 0, 0, "I2C Bus fault.");" in your code?
    4. Have you used an oscilloscope to observe the integrity of the signal?
    5. How are you connecting the SPI pins between the two devices?

    BR,

    Seong

  • Abhishek,

    Have you made any progress on this?

    BR,

    Seong