您的位置:首页 > 其它

Zigbee网关 上电时Zstack串口乱码

2015-11-11 13:22 1316 查看
Zstack定义定义宏ZTOOL_P1的时候,系统开机的时候回输出一串乱码,



用16进制显示试试



乱码的十六进制字符串是

FE 06 41 80 01 02 00 02 04 00 C2

后经查找该字符串找到原因,这时开机的时候系统认为上次重启ZTOOL返回的状态信息

http://www.ti.com.cn/cn/lit/an/swra444/swra444.pdf



经仔细查找,虽然没找到合适的解决方法,简单通过注释掉MT/MT_TASK.c中的串口打印函数该乱码即可消失

/***************************************************************************************************
* @fn      MT_TransportSend
*
* @brief   Fill in SOP and FCS then send out the msg
*
* @param   uint8 *pBuf - pointer to the message that contains CMD, length, data and FCS
*
* @return  None
***************************************************************************************************/
void MT_TransportSend(uint8 *pBuf)
{
uint8 *msgPtr;
uint8 dataLen = pBuf[0]; /* Data length is on byte #1 from the pointer */

/* Move back to the SOP */
msgPtr = pBuf-1;

/* Insert SOP */
msgPtr[0] = MT_UART_SOF;

/* Insert FCS */
msgPtr[SPI_0DATA_MSG_LEN - 1 + dataLen] = MT_UartCalcFCS (pBuf, (3 + dataLen));

/* Send to UART */
#ifdef MT_UART_DEFAULT_PORT
//HalUARTWrite(MT_UART_DEFAULT_PORT, msgPtr, dataLen + SPI_0DATA_MSG_LEN);
#endif

/* Deallocate */
osal_msg_deallocate(msgPtr);
}
#endif /* MT_TASK */
/***************************************************************************************************
***************************************************************************************************/


注释掉

//HalUARTWrite(MT_UART_DEFAULT_PORT, msgPtr, dataLen + SPI_0DATA_MSG_LEN);
经测试,乱码已经消失。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: