我用nortos中rfEasyLinkTx和rfEasyLinkRx的测试单个模组接收 或者发送问题都测试成功,我现在想要的是单模组平时处于 Tx状态,需要发射数据时转为Tx,但是我目前测试发送从RX转到TX之后 数据没有发出成功,想请教下从RX转到TX是否需要调用哪些API来关闭RX,从TX转到RX又需要调试哪些API?
我的代码如下:
1、初始化
EasyLink_Params easyLink_params;
EasyLink_Params_init(&easyLink_params);
easyLink_params.ui32ModType = EasyLink_Phy_Custom;
if (EasyLink_init(&easyLink_params) != EasyLink_Status_Success){ while(1); }
2、初始化之后 进入RX状态:
EasyLink_receiveAsync(rxDoneCb, 0); //在while(1)中调用的
3、通过外部条件触发TX
EasyLink_TxPacket txPacket = { {0}, 0, 0, {0} };
//Display_printf(display, 0, 0, "Count = %d and it's address is 0x%x\n", count, &count);
uint32_t absTime;
static uint8_t txBurstSize = 0;
/* Create packet with incrementing sequence number and random payload */
txPacket.payload[0] = (uint8_t)(seqNumber >> 8);
txPacket.payload[1] = (uint8_t)(seqNumber++);
uint8_t i;
for (i = 2; i < RFEASYLINKTXPAYLOAD_LENGTH; i++)
{
txPacket.payload[i] = i;//rand();
}
txPacket.len = RFEASYLINKTXPAYLOAD_LENGTH;
txPacket.dstAddr[0] = 0xaa;
/* Add a Tx delay for > 500ms, so that the abort kicks in and brakes the burst */
if(EasyLink_getAbsTime(&absTime) != EasyLink_Status_Success)
{
// Problem getting absolute time
}
if(txBurstSize++ >= 10)
{
/* Set Tx absolute time to current time + 1s */
txPacket.absTime = absTime + EasyLink_ms_To_RadioTime(1000);
txBurstSize = 0;
}
/* Else set the next packet in burst to Tx in 100ms */
else
{
/* Set Tx absolute time to current time + 100ms */
txPacket.absTime = absTime + EasyLink_ms_To_RadioTime(100);
}
sendflag=1;
EasyLink_transmitAsync(&txPacket, txDoneCb);
user6497810:
补充:
调用 EasyLink_transmitAsync 返回的是EasyLink_Status_Busy_Error
user6497810:
补充:在发射数据之前调用EasyLink_abort();之后,每次进入txDoneCb的回调函数,status=10,并不是=0这个是怎么回事?
user6497810:
回复 user6497810:
补充:if (!EasyLink_CmdHandle_isValid(asyncCmdHndl)){return EasyLink_Status_Aborted;}
调用EasyLink_abort()之后 进入了这个判断,然后返回10,这个是什么原因引起的?
Kevin Qiu1:
回复 user6497810:
TX/RX切换参考:e2echina.ti.com/…/106253