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 代码

Guru**** 2539500 points
Other Parts Discussed in Thread: HALCOGEN, TMS570LS1224

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1043397/tms570ls1224-spi-code

器件型号:TMS570LS1224
主题中讨论的其他器件:HALCOGEN

我使用的是 TMS570LS1224器件、并配置了 HalCogen 和 CCS。

下面给出了 SPI 菊花链的代码。

我在代码中收到以下警告。

请告诉我如何更正这些警告。 如何以更好的方式优化以下代码?

您可以提供 SPI 菊花链代码示例吗?

代码:

/*用户代码开始(0)*/
/*用户代码结束*/

/*包含文件*/

#include "sys_common.h"

/*用户代码开始(1)*/
#include "mibspi.h"
/*用户代码结束*/

/**@fn void main (void)
*  @应用程序主函数简介
*  @请注意、默认情况下、此函数为空。
*
*  此函数在启动后调用。
*  用户可以使用此函数来实现应用程序。
*

/*用户代码开始(2)*/
/*用户代码结束*/
//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

布尔数据(uint16_t transmit);

int main (空)


/*用户代码开始(3)*/

   布尔检查;
   uint16_t txBuffer[]=  {复位、复位、复位};
   uint16_t txBuffer1[]= {START、START、START、START};
   uint16_t txBuffer2[]= {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[]= {停止、停止、停止};
   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();/*初始化 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);
/*用户代码结束*/





布尔数据(uint16_t transmit)


   布尔状态;
   mibspiSetData (mibspiREG1、0、发送);
   mibspiTransfer (mibspiREG1、0);
  status=!(mibspiIsTransferComplete (mibspiREG1、0))


警告:



"./source/sys_main.c、第63行:警告#225-D:隐式声明函数"数据"
"./source/sys_main.c、第45行:警告#179-D:变量"check"已声明、但从未引用
"./source/sys_main.c、第48行:警告#179-D:变量"txBuffer2"已声明但从未引用
"./source/sys_main.c、第49行:警告#179-D:变量"txBuffer3"已声明但从未引用
"./source/sys_main.c、第50行:警告#179-D:变量"txBuffer4"已声明但从未引用
"./source/sys_main.c "、第51行:警告#179-D:变量"txBuffer5"已声明但从未引用
"./source/sys_main.c "、第52行:警告#179-D:变量"txBuffer6"已声明但从未引用
"./source/sys_main.c、第53行:警告#179-D:变量"txBuffer7"已声明但从未引用
"./source/sys_main.c、第54行:警告#179-D:变量"txBuffer8"已声明但从未引用
"./source/sys_main.c、第55行:警告#179-D:变量"txBuffer9"已声明但从未引用
"./source/sys_main.c,第77行:警告#161-D:声明与以前的"数据"不兼容(在第63行声明)
"./source/sys_main.c、第80行:警告#169-D:"uint16_t"类型的参数与"uint16 *"类型的参数不兼容
已完成构建:"./source/sys_main.c

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    数据函数的参数应为 uint16_t *、而不是 uint16_t

    布尔数据(uint16_t*发送)