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

关于EasyLink_transmitCcaAsync发送问题

CC1310EasyLink_transmitCcaAsync发送后,用EasyLink_receive进行接收,若没收到回应再次发送,会出现EasyLink_Status_Busy_Error错误,在此之前也使用了EasyLink_abort()也没用,该怎么解决?

Kevin Qiu1:

/! \brief Sends a Packet with non blocking call if the channel is idle.
//!
//! This function is a non blocking call to send a packet. It will check for a
//! clear channel prior to transmission. If the channel is busy it will backoff
//! for a random period, in time units of EASYLINK_CCA_BACKOFF_TIMEUNITS, before
//! reassessing. It does this a certain number
//! (EASYLINK_MAX_CCA_BACKOFF_WINDOW - EASYLINK_MIN_CCA_BACKOFF_WINDOW)
//! of times before quitting unsuccessfully and running to the callback.
//! If the Tx is successfully scheduled then the callback will be called once
//! the Tx is complete.
//!
//! \param txPacket The descriptor for the packet to be Tx'ed.
//! \param cbThe tx done function pointer.
//!
//! \return ::EasyLink_Status
//
//*****************************************************************************
extern EasyLink_Status EasyLink_transmitCcaAsync(EasyLink_TxPacket *txPacket,EasyLink_TxDoneCb cb);

看下这里的说明,返回EasyLink_Status_Busy_Error说明通道繁忙,检查下是否有占用通道

user6340973:

回复 Kevin Qiu1:

通道繁忙该如何解决?

Kevin Qiu1:

回复 user6340973:

在TX 之前使用EasyLink_abort()

user6340973:

回复 Kevin Qiu1:

使用EasyLink_abort()返回的状态是 EasyLink_Status_Aborted

Kevin Qiu1:

回复 user6340973:

你是在TX之前使用的吗,还做了哪些修改,把代码传上来看看

user6340973:

回复 Kevin Qiu1:

case SEND_DATA:if(sentcnt >= sent_cycle ){send_temp = jugedata;if(resend_flag == 0){sprintf(senddata,"%2d:%d ",test_num,send_temp);test_num++;if(test_num >= 100){test_num = 0;}}else{resentcnt++;}GetPublishData(g_message);debug_print("\r\n publish message: %s",g_message);if((send_status == SEND_FAIL) && (resentcnt > 0)){if(EasyLink_abort() == EasyLink_Status_Aborted || EasyLink_abort() == EasyLink_Status_Success){if(EasyLink_abort() == EasyLink_Status_Success){debug_print("\r\nEasyLink_abort success.");}cancel_CMD();mydelay_ms(10);device_TX();}}else{device_TX();}if(TX_finish_flag ==TX_FINISH){mydelay_ms(10);SetMainTaskState(RECEIVE_ACK);}}else{SetMainTaskState(TASK_END);}break;case RECEIVE_ACK:if(EasyLink_abort() == EasyLink_Status_Aborted || EasyLink_abort() == EasyLink_Status_Success){device_RX();}if((send_status == SEND_FAIL) && (resentcnt <= RESEND_CNT)){resend_flag =1;SetMainTaskState(SEND_DATA);}else{send_status = SEND_FAIL;resentcnt =0;sentcnt = 0;resend_flag =0;memset(senddata,0,sizeof(senddata));SetMainTaskState(TASK_END);}memset(g_message,0,sizeof(g_message));break;case TASK_END:IntoStopMode();sleep(10);RecoverFromStopMode();SetMainTaskState(ADC_SAMPLE);break;其中,device_TX();的代码如下:
void device_TX(void)
{frequence_to_TX();//修改发送频段mydelay_ms(5);ListenBeforeTalk();发送数据
}void ListenBeforeTalk(void)
{uint32_t absTime;EasyLink_TxPacket lbtPacket = { {0}, 0, 0, {0} };#if RFEASYLINKLBT_RETRANSMIT_PACKETSif(bAttemptRetransmission == false){
#endif // RFEASYLINKLBT_RETRANSMIT_PACKETS// zero out the packetmemset(&lbtPacket, 0, sizeof(EasyLink_TxPacket));sprintf(&lbtPacket.payload[0],"%s",g_message);lbtPacket.len = strlen(g_message) +1; //RFEASYLINKLBT_PAYLOAD_LENGTH;/** Address filtering is enabled by default on the Rx device with the* an address of 0xAA. This device must set the dstAddr accordingly.*/lbtPacket.dstAddr[0] = 0xaa;debug_print("\r\n address : 0x%0x",lbtPacket.dstAddr[0]);/* Set Tx absolute time to current time + 100ms */if(EasyLink_getAbsTime(&absTime) != EasyLink_Status_Success){// Problem getting absolute time}lbtPacket.absTime = absTime + EasyLink_ms_To_RadioTime(100);
#if RFEASYLINKLBT_RETRANSMIT_PACKETS}
#endif // RFEASYLINKLBT_RETRANSMIT_PACKETS// Set the Transmit done flag to false, callback will set it to truelbtDoneFlag = false;EasyLink_transmitCcaAsync(&lbtPacket, lbtDoneCb);//tx_status=EasyLink_getRssi(tx_rssi);if(easylink_channel_flag == EASYLINK_STATUS_SUCCESS){debug_print("\r\n EasyLink_Status_Success");}else if(easylink_channel_flag == EASYLINK_STATUS_BUSY){debug_print("\r\n EasyLink_Status_Busy_Error");}else{debug_print("\r\n EasyLink Status RX buffer error!");}/* Wait forever for TX to complete */while(lbtDoneFlag == false){};if(lbtDoneFlag == true ){TX_finish_flag = TX_FINISH;}
}

Kevin Qiu1:

回复 user6340973:

看下这里:e2e.ti.com/…/2096905

赞(0)
未经允许不得转载:TI中文支持网 » 关于EasyLink_transmitCcaAsync发送问题
分享到: 更多 (0)