Simplelink: keep retrying CCA until a valid CCA info is obtained
@@ -620,16 +620,25 @@ cca_request(cmd_cca_req_t *cmd_cca_req)
}
/* Perform the CCA request */
+ do {
+ memset(cmd_cca_req, 0x00, sizeof(cmd_cca_req_t));
+ cmd_cca_req->commandNo = CMD_IEEE_CCA_REQ;
+ cmd_cca_req->ccaInfo.ccaState = CCA_STATE_INVALID;
+
stat = RF_runImmediateCmd(ieee_radio.rf_handle, (uint32_t *)cmd_cca_req);
+ if(stat != RF_StatCmdDoneSuccess) {
+ LOG_ERR("CCA request command failed, stat=0x%02X\n", stat);
if(stop_rx) {
netstack_stop_rx();
}
-
- if(stat != RF_StatCmdDoneSuccess) {
- LOG_ERR("CCA request command failed, stat=0x%02X\n", stat);
return RF_RESULT_ERROR;
}
+ } while(cmd_cca_req->ccaInfo.ccaState == CCA_STATE_INVALID);
+
+ if(stop_rx) {
+ netstack_stop_rx();
+ }
return RF_RESULT_OK;
}
