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.

TIDC-CC2650STK-SENSORTAG: SPI Interface (devPack TIDA-00650, ADS1220) with Z-Stack_Home_1.2.2a - Reading from thermocouple sensor

Part Number: TIDC-CC2650STK-SENSORTAG
Other Parts Discussed in Thread: TIDA-00650, Z-STACK, ADS1220

Hi,

I'm trying to work with the SPI interface, in particular I'm trying to configure the ADC (ADC1220) of the TIDA-00650 board (http://www.ti.com/tool/TIDA-00650).

The ADC only supports the mode: SPI MODE1 (CPOL = 0, CPHA = 1, data transmitted on the rising edge and sampled on the falling edge).

Using the SPI library in Z-Stack_Home_1.2.2a...I am trying to communicate with the ADC, but something is wrong!!!

Initializing the SPI interface with bspSpiOpen() with these parameters:

/*******************************************************************************
 * @fn          bspSpiOpen
 *
 * @brief       Open the RTOS SPI driver
 *
 * @param       none
 *
 * @return      none
 */
void bspSpiOpen(void)
{
  if (spiHandle == NULL)
  {
    //SPI_init(); // adds
    /*  Configure SPI as master, 4 mHz bit rate*/
    SPI_Params_init(&spiParams);
    spiParams.bitRate = 500000;                                                               // Default: 4000000;
    spiParams.mode         = SPI_MASTER;
    spiParams.transferMode = SPI_MODE_BLOCKING;
    spiParams.frameFormat = SPI_POL0_PHA1;                                      // Default: SPI_POL0_PHA0

    /* Attempt to open SPI. */
    spiHandle = SPI_open(Board_SPI0, &spiParams);

    if (spiHandle == NULL)
    {
      Task_exit();
    }
  }
}

and the following PIN configuration (Board.c, in C:\ti\tirtos_simplelink_2_11_01_09\packages\ti\boards\SensorTag\CC26XXST_0120\Board.c):

#if defined(TIDA_00650)
// PIN table for the SPI
static PIN_Config TIDA00650_PinTable[] =
{
  // SPI Interface
  Board_DP0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,/* DevPack : TIDA-00650 | LED (green) --> OFF */
  Board_DP3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,/* DevPack : TIDA-00650 | PWR_UP_CHIP --> LOW */
  Board_DP1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN,/* DevPack : TIDA-00650 | nCS_ADC     --> LOW */
  Board_DP2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,   /* DevPack : TIDA-00650 | nDRDY_ADC   --> LOW */
  PIN_TERMINATE /* Terminate list */
};

I can't communicate (COMMAND BYTE di ADS1220) with ADC.

Instead if I use a lower bitrate (spiParams.bitrate = 5000) YES: I can write the ADC registers (WREG), I can start the temperature measurement conversion (START / SYNC), but ...

... in reading the data (RDATA) I get values but they are incorrect.

Note. I tried to read from a test card (with ARDUINO) and read the thermocouple temperature correctly.

What am I doing wrong?

thanks to everyone!

  • Hi,

    Please take scope shots of the two cases, and compare:
    - Sensor tag and ADC
    - Arduino and ADC

    Also consider using a simpler standalone application with just SPI enabled.

    Regards,
    Toby

  • Hi Toby,

    I have already performed the multimeter test in both cases, in particular:

    - with WREG, configuring the registers for the subsequent reading from the RT1 (PT100): CONFIG0 to CONFIG3

    - with RREG I subsequently read the contents of the same registers and they are correctly configured (with the values written by me with WREG).

    in fact, by measuring the voltage across the resistor R12 (3.24 K) I read about 1.62 which corresponds exactly to the configured VREF:

    CONFIG3 = 100 011 0 0 --> External reference voltage is used for VREF (IDAC1 + IDAC2 across RREF:

    RREF × 2 × IDAC1 = 3.24 kΩ × 2 × 250 μA = 1.62 V

    Same behavior for configuration for reading from the thermocouple.

    The problem is that when I read through the START / SYNC () and then RRDATA () commands I do not receive correct values.

    P.S. Then I don't understand why it doesn't let me set a bitrate of 500000 (for example), but only a low value like 5000.

  • We need to check that the RREAD is correctly sent, and also with the correct timing parameters as outlined in the ADS1220 datasheet.

    Can you provide the scope shots for each command you send?

    Then the ADS1220 experts can comment on the behavior observed.

  • Hi Filippo,

    As Toby has mentioned, we really need to see some scope shots of the communication.  If you are able to write and read back the register settings, you should be able to capture the correct data.  Can you also send us the data result you are seeing and the result you are expecting?  I would also like to know the register settings and the exact input configuration you are using.

    After issuing the START/SYNC command, you need to wait until the conversion completes before sending the RDATA command.  The end of conversion is signaled by the DRDY pin transitioning from high to low.

    If you are using a prototyping solution where the SCLK, MISO and MOSI signals are coming to the ADS1220 via wires from one board to another, there may be issues with noise and inductance/capacitance that is preventing you from communication at faster SCLK speed.  Here again oscilloscope shots near the ADS1220 digital pins will show if there are timing issues due to transition timing of the clock edges.  A good ground and bypass capacitors are also necessary.

    Lastly, can you send a schematic of how you have the ADS1220 connected?

    Best regards,

    Bob B