如题!
Viki Shi:
怀疑是EasyLink_transmit返回错误导致的问题,你看一下这边,是否跟你的情况一致: e2e.ti.com/…/1773054
gui tan:
回复 Viki Shi:
我看看。不过从另一个板子上,监听到的数据 。是能发送数据出来的!
Felix ZF:
下面是关于EasyLink_transmit和EasyLink_transmitAsync两个API的功能描述。
EasyLink_transmit是blocking call,只有等到发送完成后才能继续执行后面的语句。代码执行会block在下面标黄的RF_pendCmd处,直到EasyLink_cmdPropTx命令执行完成后,才继续往下执行。
代码不是被block在Event_pend处,所以,你post event看起来没有效果。
//*****************************************************************************////! \brief Sends a Packet with blocking call.//!//! This function is a blocking call to send a packet. If the Tx is//! successfully scheduled then the function will block until the Tx is//! complete.//!//! \param txPacket – The descriptor for the packet to be Tx'ed.//!//! \return EasyLink_Status////*****************************************************************************extern EasyLink_Status EasyLink_transmit(EasyLink_TxPacket *txPacket);
//*****************************************************************************////! \brief Sends a Packet with non blocking call.//!//! This function is a non blocking call to send a packet. If the Tx is//! successfully scheduled then the callback will be call once the Tx is//! complete. The Tx will timeout if EasyLink_Ctrl_AsyncTx_TimeOut//! ctrl message is used to set the timeout to something other than 0.//!//! \param txPacket – The descriptor for the packet to be Tx'ed.//! \param cb – The tx done function pointer.//!//! \return EasyLink_Status////*****************************************************************************extern EasyLink_Status EasyLink_transmitAsync(EasyLink_TxPacket *txPacket, EasyLink_TxDoneCb cb);
EasyLink_Status EasyLink_transmit(EasyLink_TxPacket *txPacket){
…………
// Send packet RF_CmdHandle cmdHdl = RF_postCmd(rfHandle, (RF_Op*)&EasyLink_cmdPropTx, RF_PriorityNormal, 0, EASYLINK_RF_EVENT_MASK);
// Wait for Command to complete RF_EventMask result = RF_pendCmd(rfHandle, cmdHdl, (RF_EventLastCmdDone | RF_EventCmdError));
…………
}
gui tan:
回复 Felix ZF:
对的!从仿真来看,它会卡在这里停住了!不走了。
gui tan:
回复 Felix ZF:
还有就这个函数在定时器回调函数中调用!
Felix ZF:
回复 gui tan:
不要把这种blocking call放在callback里执行,callback里的执行内容要尽可能少。
你在callback置个标志位,在主循环中调用easylink_transmit试试。
gui tan:
回复 Felix ZF:
对的!可以了、几天了 这个问题。好了