运行的是CC26X2例程库中的rfPacketTx例程,RF_runCmd会一直阻塞不返回,RF_postCmd不会。
硬件是LP-CC2652RB Launch Pad,用SmartRF Studio测试可以正常收发,应该排除硬件故障。
既无法发送信息也无法接收
Alvin Chen:
首先你的SDK版本是什么?如果是2.40以上你的芯片必须是E版本。
此外SDK里面的:/* Set the frequency */RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
while(1){/* Create packet with incrementing sequence number and random payload */packet[0] = (uint8_t)(seqNumber >> 8);packet[1] = (uint8_t)(seqNumber++);uint8_t i;for (i = 2; i < PAYLOAD_LENGTH; i++){packet[i] = rand();}
/* Send packet */RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx,RF_PriorityNormal, NULL, 0);也就是你所说的两个函数没有直接关联。
user4821682:
回复 Alvin Chen:
我知道它们没有关联
按照我的理解,runCmd是阻塞的,而postCmd是非阻塞的,由runCmd阻塞我有理由怀疑postCmd虽然返回了但是也没有正确执行。
芯片的完整丝印是XCC2652 RB1F E 我认为它是E版本的,SDK版本是3.10.01.11。
Alvin Chen:
回复 user4821682:
RunCmd:
Runs synchronously a (chain of) RF operation(s) Allows a (chain of) operation(s) to be posted to the command queue and then waits for it to complete.Postcmd:
Post an RF operation (chain) to the command queue Post an RF_Op to the RF command queue of the client with handle h. The command can be the first in a chain of RF operations or a standalone RF operation. If a chain of operations are posted they are treated atomically, i.e. either all or none of the chained operations are run. All operations must be posted in strictly increasing chronological order. Function returns immediately.