您好:
我使用for循环语句发送串口数据,但是数据发送不正确,当我使用断点仿真时,数据就能正常发送。程序部分如下:
for(i=0; i<8; i++)
{
txBuffer_reg=txBuffer[i];
int cout = UART_writePolling(gCLI.cfg.cliUartHandle,&txBuffer_reg,sizeof(txBuffer_reg));
}
是因为不能用for循环发送数据吗?
谢谢!
您好:
我使用for循环语句发送串口数据,但是数据发送不正确,当我使用断点仿真时,数据就能正常发送。程序部分如下:
for(i=0; i<8; i++)
{
txBuffer_reg=txBuffer[i];
int cout = UART_writePolling(gCLI.cfg.cliUartHandle,&txBuffer_reg,sizeof(txBuffer_reg));
}
是因为不能用for循环发送数据吗?
谢谢!
您好:
串口输出是加载在开箱检测的demo cli_task任务中, 串口数据输出的时间如何确认?如何在上一帧完成后,在发送下一帧数据?
谢谢
user6310217 说:串口数据输出的时间如何确认?
通过串口波特率和串口传输数据量来计算获得。
user6310217 说:如何在上一帧完成后,在发送下一帧数据?
你说的帧是射频的frame?射频的frame帧的周期在射频配置里面设定
您好:
因为程序根据需要设置第一字节为奇校验后面字节为偶校验。所以我程序中加入了如下程序;
发送跟接收都是同样的思路。但现在接收不到正确的数据。
请问这种设置奇偶的方法是否可行。
for(i=0; i<8; i++)
{
txBuffer_reg=txBuffer[i];
int status = UART_writePolling(gCLI.cfg.cliUartHandle,&txBuffer_reg,sizeof(txBuffer_reg));
if (status < 0)
{
System_printf("Error: Unable to send out the data [%d] on UART-3 [Error %d]\n",i, status);
return ;
}
memset ((void *)&rxBuffer_Reg, 0, 1);
if(i== 0 )
{
if( txBuffer_reg == 0x2E)
{
UART_close(gMmwMCB.commandUartHandle);
UART_Params_init(&uartParams);
uartParams.clockFrequency = gMmwMCB.cfg.platformCfg.sysClockFrequency;
uartParams.baudRate = gMmwMCB.cfg.platformCfg.commandBaudRate;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.isPinMuxDone = 1;
uartParams.parityType = UART_PAR_EVEN ;//校验位为偶
gMmwMCB.commandUartHandle = UART_open(0, &uartParams);
if (gMmwMCB.commandUartHandle == NULL)
{
System_printf("Error: Unable to open the Command UART Instance\n");
MmwDemo_debugAssert (0);
return;
}
}
else
{
break;
}
}
else
{
;
}