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.

TMS570LS1224: SPI Code

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN,

I am using TMS570LS1224 device and configured with HalCogen and CCS.

The code for SPI daisy chain have been given below.

I am getting the below warnings in the code.

Please tell me how to correct these warnings. How to optimize the below code in a better way?

Can you please give sample for SPI daisy chain code?

Code:

/* USER CODE BEGIN (0) */
/* USER CODE END */

/* Include Files */

#include "sys_common.h"

/* USER CODE BEGIN (1) */
#include "mibspi.h"
/* USER CODE END */

/** @fn void main(void)
*   @brief Application main function
*   @note This function is empty by default.
*
*   This function is called after startup.
*   The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
/* USER CODE END */
//uint16 count = 3;

#define reset 0XD000
#define start 0X2A00
#define stop  0X3A00
#define write_c5 0X9900
#define data_c5 0X0000
#define write_c3 0X9E00
#define data_c3 0XE700
#define read_c5 0XB900
#define read_c3 0XBE00



#define read

boolean data ( uint16_t transmit );

int main(void)
{

/* USER CODE BEGIN (3) */

    boolean check;
    uint16_t txBuffer[] =   { reset, reset, reset, reset };
    uint16_t txBuffer1[] =  { start, start, start, start };
    uint16_t txBuffer2[] =  { write_c5, write_c5, write_c5, write_c5 };
    uint16_t txBuffer3[] =  { data_c5, data_c5, data_c5, data_c5 };
    uint16_t txBuffer4[] =  { write_c3, write_c3, write_c3, write_c3 };
    uint16_t txBuffer5[] =  { data_c3, data_c3, data_c3, data_c3 };
    uint16_t txBuffer6[] =  { stop, stop, stop, stop };
    uint16_t txBuffer7[] =  { read_c5, read_c5, read_c5, read_c5 };
    uint16_t txBuffer8[] =  { read_c3, read_c3, read_c3, read_c3 };
    uint16_t txBuffer9[] =  { read_c5, read_c5, read_c5, read_c5 };



    mibspiInit(); /*initialize the spi */

  //  mibspiEnableLoopback(mibspiREG1, Digital_Lbk);

  check=data(txBuffer);
  while (check);
  check=data(txBuffer1);
  while (check);
  check=data(txBuffer2);
  while (check);
  check=data(txBuffer3);
  while (check);
  check=data(txBuffer4);
  while (check);
  check=data(txBuffer5);
  while (check);
  check=data(txBuffer6);
  while (check);
  check=data(txBuffer7);
  while (check);
  check=data(txBuffer8);
  while (check);
  check=data(txBuffer9);



    while(1);
/* USER CODE END */

}



boolean data ( uint16_t transmit)

{
    boolean status;
    mibspiSetData(mibspiREG1, 0, transmit);
    mibspiTransfer(mibspiREG1,0);
   status=!(mibspiIsTransferComplete(mibspiREG1,0))
}

Warnings:



"../source/sys_main.c", line 63: warning #225-D: function "data" declared implicitly
"../source/sys_main.c", line 45: warning #179-D: variable "check" was declared but never referenced
"../source/sys_main.c", line 48: warning #179-D: variable "txBuffer2" was declared but never referenced
"../source/sys_main.c", line 49: warning #179-D: variable "txBuffer3" was declared but never referenced
"../source/sys_main.c", line 50: warning #179-D: variable "txBuffer4" was declared but never referenced
"../source/sys_main.c", line 51: warning #179-D: variable "txBuffer5" was declared but never referenced
"../source/sys_main.c", line 52: warning #179-D: variable "txBuffer6" was declared but never referenced
"../source/sys_main.c", line 53: warning #179-D: variable "txBuffer7" was declared but never referenced
"../source/sys_main.c", line 54: warning #179-D: variable "txBuffer8" was declared but never referenced
"../source/sys_main.c", line 55: warning #179-D: variable "txBuffer9" was declared but never referenced
"../source/sys_main.c", line 77: warning #161-D: declaration is incompatible with previous "data" (declared at line 63)
"../source/sys_main.c", line 80: warning #169-D: argument of type "uint16_t" is incompatible with parameter of type "uint16 *"
Finished building: "../source/sys_main.c"