CC1310 rfPacketRx接收数据如何避免阻塞
我合并了rfPacketTx和rfPacketRx这两个例程,希望能实现从A模块发送数据包到B模块,B收到后返回给A应答,这样A、B模块要都需要开启收发功能。
TX和 RX分别放到2个任务中,TX先初始化,再初始化RX,但是一旦执行RX任务下的
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &callback, IRQ_RX_ENTRY_DONE);后,就阻塞在里面了,
TX任务也被阻塞了,无法发送。
请问要在一个模块上做到RX, TX功能应如何处理?
根据您的描述建议您使用Listen Before Talk例程做发送。
收发例程可以参考Wireless Sensor Network。
- The Wireless Sensor Network (WSN) Node and Concentrator examples illustrate how to create a very basic sensor network consisting of one or many Node device(s) and a Concentrator device. The example shows how to form a one-to-many network where the Nodes send messages to the Concentrator.
- The Node use the Sensor Controller Engine to periodically read the value of the light sensor.
- Whenever the sensor value change, the main controller wakes up and sends a packet with the value to the Concentrator.
- The Concentrator is always waiting for incoming packet.
- Once a packet is received, the Concentrator sends an acknowledgement packet in return and displays the data on an LCD (if the kit has one)
希望对您有所帮助,谢谢!
Hi, Susan Yang:
Listen Before Talk里是以TX为例,加入了pNextOp和RF_cmdPropCs.csEndTime、RF_cmdCountBranch.counter等,这些参数可理解为等待时间吗?
那么RX也用这样类似的方法,就可以避免阻塞了吗?
半双工通信,通过握手协议切换收发状态。
利用例程easylink:使用中断函数非阻塞
if (EasyLink_transmit(¤tRadioOperation.easyLinkTxPacket) != EasyLink_Status_Success)
{
System_abort("EasyLink_transmit failed");
}
}
/* Enter RX */
if (EasyLink_receiveAsync(rxDoneCallback, 0) != EasyLink_Status_Success)
{
System_abort("EasyLink_receiveAsync failed");
}
Eggsy Pang:
嗯,已使用easylink,实现非阻塞方式收发。