This problem really puzzles me...
There are 70 transmitters and a receiver based on CC2530.
Each transmitter keeps sending a packet containing a unique transmitter-id every 4 to 5 seconds. The Receiver has to record all the 70 ids asap.
I didn't use CCA at first, the RF sending codes are as follows:
UINT8 status;
ISTXON; // Sending
// Waiting for transmission to finish
while(!(RFIRQF1 & IRQ_TXDONE) );
RFIRQF1 = ~IRQ_TXDONE;
status= SUCCESS;
return status;
The receiver could receive all the 70 ids in about 10 seconds. (I have tested for about 40 times)
I thought there must be some RF conflicts, so I tried to improve the performance. What I have done is only add CCA in transmitter's RF sending codes.
UINT8 status = FAILED;
UINT8 randnumber;
macInitRandom();
halRfReceiveOn(); //macInitRandom will turn Receive off
while(status == FAILED) {
ISRXON;
// Wait for RSSI to become valid
while(!(RSSISTAT & RSSI_VALID));
ISSAMPLECCA;
if (FSMSTAT1 & SAMPLED_CCA) { //if idle
randnumber = macRandomByte();
if ((randnumber & 0x07) == 0x01) { // Probability of randnumber == 1 is about 1/8
HAL_INT_OFF();
ISTXONCCA;
HAL_INT_ON();
if (FSMSTAT1 & SAMPLED_CCA) {//if idle
status = SUCCESS;
while(!(RFIRQF1 & IRQ_TXDONE) );
RFIRQF1 = ~IRQ_TXDONE;
break;
}
}
}
halMcuWaitUs(500);
}
With the above modification, the receiver could finish his work in 10 seconds, too. How ever, it would spend more then 10 seconds (up to 60+) seconds to receive all the transmitter-id sometimes. The probability of overtime is about 10% ~ 20%.
The CCA setting is:
CCACTRL0 = 0xF8;
CCACTRL1 = 0x0A;
Is the CCA value too low?
Thanks for any help.