I've been using the CCA feature on the CC1101 for months without any visible problem. In all cases, this feature was enabled in low-power motes transmitting short frames (< 15 bytes) every few seconds (or minutes). Now I'm working on a more ambitious project, an "always-in-RX-mode" device that listens for commands and immediately replies with a packet longer than 24 bytes.
In order to test this device, I'm sending around 3 commands per second to it. Well, the problem is that, after some packets received, the CC1101 stops sending responses and receiving commands.. After that, strobing the CC1101 with SRES sometime works but the IC shows the same problem after a few packets received. Then, my uC still works but the CC1101 remains blocked at MARCSTATE=RX (0x0D). Unpowering/repowering the CC1101 is the only action that seems to better unblock the situation although, as I said before, the problem ends by reappearing again.
The weird thing is that this only happens with CCA enabled. Otherwise, my device works flawlessly This device is being tested with the rest of motes unpowered so that the CCA mechanism should not find any obstacle.
And this is the critical piece of code, where transmissions are undertaken:
bool CC1101::sendData(CCPACKET packet)
{
byte marcState;
// Enter RX state
setRxState();
// Check that the RX state has been entered
while ((readStatusReg(CC1101_MARCSTATE) & 0x1F) != 0x0D)
delay(1);
delayMicroseconds(500);
// Set data length at the first position of the TX FIFO
writeReg(CC1101_TXFIFO, packet.length);
// Write data into the TX FIFO
writeBurstReg(CC1101_TXFIFO, packet.data, packet.length);
// CCA enabled: will enter TX state only if the channel is clear
cmdStrobe(CC1101_STX);
// Check that TX state is being entered (state = RXTX_SETTLING)
marcState = readStatusReg(CC1101_MARCSTATE) & 0x1F;
if((marcState != 0x13) && (marcState != 0x14) && (marcState != 0x15))
{
setRxState(); // Back to RX state
return false;
}
// Wait for the sync word to be transmitted
wait_GDO0_high();
// Wait until the end of the packet transmission
wait_GDO0_low();
// Enter back into RX state
setRxState();
// Check that the TX FIFO is empty
if((readStatusReg(CC1101_TXBYTES) & 0x7F) == 0)
return true;
return false;
}
Thanks in advance for your help!
Daniel.