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

CC1310: EasyLink_receive 不能正常工作

Part Number:CC1310

EasyLink_transmit 和 EasyLink_receiveAsync 能正常工作,但EasyLink_receive一直不能正常工作,请帮忙看看。相关代码和运行情况如下:

EasyLink_Status EasyLink_receive(EasyLink_RxPacket *rxPacket)
{
EasyLink_Status status = EasyLink_Status_Rx_Error;
RF_EventMask result;
// rfc_dataEntryGeneral_t *pDataEntry;

if ( (!configured) || suspended)
{
return EasyLink_Status_Config_Error;
}
//Check and take the busyMutex
if (Semaphore_pend(busyMutex, 0) == false)
{
return EasyLink_Status_Busy_Error;
}

memcpy(&EasyLink_cmdRx, &RF_cmdRxHS, sizeof(RF_cmdRxHS));
pReceiveDataEntry = (rfc_dataEntryGeneral_t*) rxBuffer;
//data entry rx buffer includes hdr (len-1Byte), addr (max 8Bytes) and data
pReceiveDataEntry->length = 256+6;
pReceiveDataEntry->status = 0;
dataRxQueue.pCurrEntry = (uint8_t*)pReceiveDataEntry;
dataRxQueue.pLastEntry = NULL;
EasyLink_cmdRx.pOutput = &rxStatistics_hs;
EasyLink_cmdRx.maxPktLen = EASYLINK_MAX_PAYLOAD_LENGTH;
EasyLink_cmdRx.pktConf.bUseCrc = 1;
EasyLink_cmdRx.pktConf.bRepeatOk = 1;
EasyLink_cmdRx.pktConf.bRepeatNok = 1;
EasyLink_cmdRx.rxConf.bAppendTimestamp = 1;
EasyLink_cmdRx.rxConf.bAutoFlushCrcErr = 0;
EasyLink_cmdRx.pQueue = &dataRxQueue; /* Set the Data Entity queue for received data */

if (rxPacket->rxTimeout != 0)
{
EasyLink_cmdRx.endTrigger.triggerType = TRIG_REL_START;
EasyLink_cmdRx.endTrigger.pastTrig = 0;
EasyLink_cmdRx.endTime = RF_getCurrentTime() + rxPacket->rxTimeout;
}
else
{
EasyLink_cmdRx.endTrigger.triggerType = TRIG_NEVER;
EasyLink_cmdRx.endTrigger.pastTrig = 1;
EasyLink_cmdRx.endTime = 0;
}

//Clear the Rx statistics structure
memset(&rxStatistics_hs, 0, sizeof(rfc_propRxOutput_t));

// result = RF_runCmd(rfHandle, (RF_Op*)&EasyLink_cmdRx, RF_PriorityHigh, 0, 0);
asyncCmdHndl = RF_postCmd(rfHandle, (RF_Op*)&EasyLink_cmdRx, RF_PriorityNormal,0, IRQ_RX_ENTRY_DONE);
/* Wait for Command to complete */
result = RF_pendCmd(rfHandle, asyncCmdHndl, RF_EventLastCmdDone);

if (result & RF_EventLastCmdDone)
{
//Check command status
if (EasyLink_cmdRx.status == PROP_DONE_OK)
{
//Check that data entry status indicates it is finished with
if (pReceiveDataEntry->status != DATA_ENTRY_FINISHED)
{
status = EasyLink_Status_Rx_Error;
}
//check Rx Statistics
else if ( rxStatistics_hs.nRxOk == 1)
{
//copy length from pDataEntry (- addrSize)
rxPacket->len = ((*(uint8_t*)(&pReceiveDataEntry->data + RX_FRAME_HSM_OFFSET_LEN)) |
(*(uint8_t*)(&pReceiveDataEntry->data + (RX_FRAME_HSM_OFFSET_LEN + 1))) << 8);
//copy payload
memcpy(&rxPacket->payload, (&pReceiveDataEntry->data + RX_FRAME_HSM_OFFSET_DATA), rxPacket->len);

rxPacket->rssi = rxStatistics_hs.lastRssi;

status = EasyLink_Status_Success;
// rxPacket->absTime = rxStatistics.timeStamp;
}
else if ( rxStatistics_hs.nRxBufFull == 1)
{
status = EasyLink_Status_Rx_Buffer_Error;
}
else
{
status = EasyLink_Status_Rx_Error;
}
}
else if ( EasyLink_cmdRx.status == PROP_DONE_RXTIMEOUT)
{
status = EasyLink_Status_Rx_Timeout;
}
else
{
status = EasyLink_Status_Rx_Error;
}
}

//Release the busyMutex
Semaphore_post(busyMutex);

return status;
}

EasyLink_cmdRx.status值一直为0x3441 

能正常工作的EasyLink_transmit 和 EasyLink_receiveAsync接口实现如下:

EasyLink_Status EasyLink_transmit(EasyLink_TxPacket *txPacket)
{
// RF_CmdHandle cmdHdl;
uint8_t *pu8Data;

EasyLink_Status status = EasyLink_Status_Tx_Error;

if ( (!configured) || suspended)
{
return EasyLink_Status_Config_Error;
}
if (txPacket->len > EASYLINK_MAX_DATA_LENGTH)
{
return EasyLink_Status_Param_Error;
}
//Check and take the busyMutex
if (Semaphore_pend(busyMutex, 0) == false)
{
return EasyLink_Status_Busy_Error;
}

/* Transmit */
pTransmitDataEntry = (rfc_dataEntryGeneral_t*)txBuffer;
pTransmitDataEntry->length = txPacket->len + NUM_APPENDED_BYTES_TX;
pTransmitDataEntry->status = DATA_ENTRY_PENDING;
pTransmitDataEntry->pNextEntry = (uint8_t*)pTransmitDataEntry; // Circle buffer.

dataTxQueue.pCurrEntry = (uint8_t*)pTransmitDataEntry;
dataTxQueue.pLastEntry = NULL;
/* txPaket copy and send. */
pu8Data = &pTransmitDataEntry->data;
memcpy(pu8Data, &txPacket->payload, txPacket->len);

memcpy(&EasyLink_cmdTx, &RF_cmdTxHS, sizeof(RF_cmdTxHS));
EasyLink_cmdTx.pQueue = &dataTxQueue;
EasyLink_cmdTx.startTrigger.triggerType = TRIG_NOW;
EasyLink_cmdTx.startTrigger.pastTrig = 1;
EasyLink_cmdTx.startTime = 0;
// RF_cmdTxHS.startTime = time;

RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&EasyLink_cmdTx, RF_PriorityHigh, 0, 0);

// cmdHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdTxHS, RF_PriorityNormal, &tx_callback, 0);
/* Wait for Command to complete */
// RF_EventMask result = RF_pendCmd(rfHandle, cmdHdl, EASYLINK_RF_EVENT_MASK);

if (result & RF_EventLastCmdDone)
{
status = EasyLink_Status_Success;
}

//Release the busyMutex
Semaphore_post(busyMutex);

return status;
}

EasyLink_Status EasyLink_receiveAsync(EasyLink_ReceiveCb cb, uint32_t absTime,uint32_t endtimeMs)
{
EasyLink_Status status = EasyLink_Status_Rx_Error;

//Check if not configure of already an Async command being performed
if ( (!configured) || suspended)
{
return EasyLink_Status_Config_Error;
}
if (EasyLink_CmdHandle_isValid(asyncCmdHndl))
{
return EasyLink_Status_Busy_Error;
}
//Check and take the busyMutex
if (Semaphore_pend(busyMutex, 0) == false)
{
return EasyLink_Status_Busy_Error;
}

rxCb = cb;

/* Receive */
memcpy(&EasyLink_cmdRx, &RF_cmdRxHS, sizeof(RF_cmdRxHS));

EasyLink_cmdRx.pOutput = &rxStatistics_hs;
EasyLink_cmdRx.pQueue = &dataRxQueue;
EasyLink_cmdRx.maxPktLen = EASYLINK_MAX_PAYLOAD_LENGTH;
EasyLink_cmdRx.pktConf.bUseCrc = 1;
EasyLink_cmdRx.pktConf.bRepeatOk = 0;
EasyLink_cmdRx.pktConf.bRepeatNok = 0;
EasyLink_cmdRx.rxConf.bAppendTimestamp = 1;
//add by yr
EasyLink_cmdRx.endTrigger.triggerType = TRIG_REL_START;
EasyLink_cmdRx.endTrigger.bEnaCmd = 0;
EasyLink_cmdRx.endTrigger.triggerNo = 0;
EasyLink_cmdRx.endTrigger.pastTrig = 0;
EasyLink_cmdRx.endTime = RF_convertMsToRatTicks(endtimeMs);

asyncCmdHndl = RF_postCmd(rfHandle, (RF_Op*)&EasyLink_cmdRx, RF_PriorityHigh, &rxDoneCallback, EASYLINK_RF_EVENT_MASK);

if (EasyLink_CmdHandle_isValid(asyncCmdHndl))
{
status = EasyLink_Status_Success;
}
else
{
//Callback will not be called, release the busyMutex
Semaphore_post(busyMutex);
}

return status;
}

Cherry Zhou:

您好我们已收到您的问题并升级到英文论坛寻求帮助,如有答复将尽快回复您。谢谢!

,

Cherry Zhou:

您好,EasyLink API 不支持高速模式,目前也无法为此添加支持。

,

ye lucy:

有英文论坛的链接吗?

另外,那为何异步模式可以接收到数据?发送也可以。

,

Cherry Zhou:

英文论坛链接如下,您可以先看下:

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1106489/cc1310-easylink_receive-is-not-able-to-work-properly

,

Cherry Zhou:

您好,工程师这边有新的答复了,您可以看下。

,

ye lucy:

我在哪个论坛是不是回复不了?

1. 一开机就进入接收模式,执行EasyLink_receive;

2. 进入EasyLink_receive函数之后,执行result = RF_pendCmd(rfHandle, asyncCmdHndl, RF_EventLastCmdDone);返回的result为0x3441.

,

Cherry Zhou:

您好,您提供的信息已经跟进给工程师了。

英文论坛需要使用公司域名的邮箱来注册,如您无法回复我会在英文论坛这边帮您跟进。

,

Cherry Zhou:

Hi,

ye lucy 说:返回的result为0x3441.

0x3441就代表这个command超时了。

#define HS_DONE_RXTIMEOUT     0x3441  ///< Operation stopped after end trigger while waiting for sync

赞(0)
未经允许不得转载:TI中文支持网 » CC1310: EasyLink_receive 不能正常工作
分享到: 更多 (0)