The CCA measurement is controlled with two parameters mode and edthrs:
| mode | The CCA-Mode parameter is set in the sub register SR_CCA_MODE and has the following meaning: | |
| edthrs | If a signal is present, which has an energy value above the energy threshold, the CCA measurement reports a busy medium. The edthrs value is a 4 bit value, which is converted to an energy value =RSSI_BASE_VAL+2*edthrs. This parameter is only relevant for mode=1 and mode=3. |
The CCA measurement itself is carried out with one of the sequences PHY_DO_CCA. It returns two values cca and done:
| cca | This parameter is retrieved from the sub register SR_CCA_STATUS and has the following meaning:
| |
| done | This parameter is retrieved from the sub register SR_CCA_DONE. The value 1 means, that a previously started CCA measurement is completed correctly, otherwise the CCA measurement is not (yet) completed. |
cca = (trx_status>>6)&1 and done = (trx_status>>7)&1.
trx_bit_write(SR_CCA_MODE, mode); trx_bit_write(SR_CCA_ED_THRES, edthrs);
mode = trx_bit_read(SR_CCA_MODE); edthrs = trx_bit_read(SR_CCA_ED_THRES);
CCA measurements can be done from state RX_ON. The measurement is started by writing the value 1 to the sub register SR_CCA_REQUEST. The measurement is finished after 140us and the radio transceiver is switched back to state RX_ON.
The completion of the measurement can be verified in the sub register SR_CCA_DONE. In general, the result parameters for the measurement need special handling, which is described here.
trx_bit_write(SR_CCA_REQUEST, 1); delay_us(140); stat = trx_reg_read(RG_TRX_STATUS); cca=(stat>>6)&1; done=(stat>>7)&1; ASSERT(done==1);
1.5.2