TI中文支持网
TI专业的中文技术问题搜集分享网站

tms570ls3137开发板sci串口发送数据,在terminal没有收到

Other Parts Discussed in Thread:TMS570LS3137, HALCOGEN

在tms570ls3137开发板上测试sci_uart_9600这个示例,按照示例程序,LIN/SCI串口可以在terminal收到数据,但是通过SCI串口发送确收不到数据。

Susan Yang:

在例程说明中

Enable SCILIN driver而不是SCI driver

器件上有两个SCI模块。一个SCI / LIN模块(TRM)在数据表中称为LIN,另一个是SCI,在HALCoGen中也称为SCI 。可以将SCI / LIN模块编程为作为SCI或LIN工作。该模块的核心是SCI。增强了SCI的硬件功能,以实现LIN兼容性。

另外请参考 www.ti.com/…/spna124a.pdf

,

user6343407:

我要测SCI模块,不测SCI/LIN模块,我把例程改为SCI driver配置,main函数里的#define UART scilinREG 改为#define UART sciREG,其他不变,但是在ccs的terminal里没有收到数据。

,

Susan Yang:

在终端上键入任何内容之前,应先调用sciReceive。

,

user6343407:

调用sciReceive终端还是没有收到数据,能给我一个测试sci(不是lin/sci)收发数据的示例吗?

,

Susan Yang:

请您参考下面的程序

unsigned char receive_command[4];unsigned int Task_Number;void main()
{/** - Initialize SCI Routines to receive Command and transmit data */sciInit();/** - Configure SCI to receive 8 bytes of Command information */
sciReceive(sciREG1, 4, receive_command);/** - Clear the Task Number */
Task_Number = 0;while(1)
{switch(Task_Number)
{case 1:Task_Number = 0;break;case 2:Task_Number = 0;break;case 3:Task_Number = 0;break;
}}}/* The command starts with "*" and ends with "!". For example *02!
* */
void sciNotification(sciBASE_t *sci, unsigned flags)
{/** Check for the Valid Command
* * - Starter
* ! - End of Command
*/
if(receive_command[0] == '*' && receive_command[3] == '!')
{/** - 2nd and 3rd byte received are Task Number,* combine them to form one decimal Number */Task_Number = (unsigned int)(((receive_command[1] - 48) * 10) + (receive_command[2] - 48));/** - Get ready to receive the next Command */
sciReceive (sciREG1, 4, receive_command);/** - Acknowledge once the Valid Command is received */
sciSend (sciREG1, 11, (unsigned char *) "*VALID CMD!");}else{/** - Get ready to receive the next Command */
sciReceive (sciREG1, 4, receive_command);
/** - Acknowledge once the InValid Command is received */
sciSend (sciREG1, 10, (unsigned char *) "Wrong CMD!");}}

,

user6343407:

这是sci接收数据的示例吗?我需要sci发送字节数据的示例,终端是接收端。

,

Susan Yang:

请问您有测试该程序吗?可以成功运行吗?

赞(0)
未经允许不得转载:TI中文支持网 » tms570ls3137开发板sci串口发送数据,在terminal没有收到
分享到: 更多 (0)