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!