Skip to content

Commit 318ab48

Browse files
author
Jarkko Paso
authored
Merge pull request #2064 from ARMmbed/IOTTHD-3426
Iotthd 3426
2 parents 1e1f69a + 1a9be20 commit 318ab48

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

source/MAC/IEEE802_15_4/mac_mcps_sap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,7 @@ static int8_t mcps_pd_data_cca_trig(protocol_interface_rf_mac_setup_s *rf_ptr, m
18381838
// Use double CCA check with FHSS for data packets only
18391839
if (rf_ptr->fhss_api && !rf_ptr->mac_ack_tx_active && !rf_ptr->active_pd_data_request->asynch_request) {
18401840
if ((buffer->tx_time - (rf_ptr->multi_cca_interval * (rf_ptr->number_of_csma_ca_periods - 1))) > mac_mcps_sap_get_phy_timestamp(rf_ptr)) {
1841-
buffer->csma_periods_left = rf_ptr->number_of_csma_ca_periods;
1841+
buffer->csma_periods_left = rf_ptr->number_of_csma_ca_periods - 1;
18421842
buffer->tx_time -= (rf_ptr->multi_cca_interval * (rf_ptr->number_of_csma_ca_periods - 1));
18431843
}
18441844
}

source/MAC/IEEE802_15_4/mac_pd_sap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// Measured 3750us with 1280 byte secured packet from calculating TX time to starting CSMA timer on PHY.
4242
// Typically varies from 500us to several milliseconds depending on packet size and the platform.
4343
// MAC should learn and make this dynamic by sending first few packets with predefined CSMA period.
44-
#define MIN_FHSS_CSMA_PERIOD_US 4000
44+
#define MIN_FHSS_CSMA_PERIOD_US 5000
4545

4646
static int8_t mac_data_interface_tx_done_cb(protocol_interface_rf_mac_setup_s *rf_ptr, phy_link_tx_status_e status, uint8_t cca_retry, uint8_t tx_retry);
4747
static void mac_sap_cca_fail_cb(protocol_interface_rf_mac_setup_s *rf_ptr);
@@ -448,7 +448,8 @@ static int8_t mac_data_interface_tx_done_cb(protocol_interface_rf_mac_setup_s *r
448448
mac_tx_done_state_set(rf_ptr, MAC_UNKNOWN_DESTINATION);
449449
return PHY_TX_NOT_ALLOWED;
450450
}
451-
if (--active_buf->csma_periods_left > 0) {
451+
if (active_buf->csma_periods_left > 0) {
452+
active_buf->csma_periods_left--;
452453
active_buf->tx_time += rf_ptr->multi_cca_interval;
453454
mac_pd_sap_set_phy_tx_time(rf_ptr, active_buf->tx_time, true);
454455
return PHY_RESTART_CSMA;

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -861,12 +861,6 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8],
861861
fhss_structure->ws->drift_per_millisecond_ns += drift_per_ms_tmp;
862862
}
863863
tr_debug("synch to parent: %s, drift: %"PRIi32"ms in %"PRIu32" seconds, compensation: %"PRIi32"ns per ms", trace_array(eui64, 8), true_bc_interval_offset - own_bc_interval_offset + ((int32_t)(fhss_structure->ws->bc_slot - own_bc_slot) * bc_timing_info->broadcast_interval), US_TO_S(time_since_last_synch_us), fhss_structure->ws->drift_per_millisecond_ns);
864-
// Temporary debug traces (IOTTHD-3426)
865-
int32_t drift_tmp = true_bc_interval_offset - own_bc_interval_offset + ((int32_t)(fhss_structure->ws->bc_slot - own_bc_slot) * bc_timing_info->broadcast_interval);
866-
if ((drift_tmp > 5) || (drift_tmp < -5)) {
867-
tr_debug("High drift");
868-
}
869-
tr_debug("%"PRIu32" tr_bc_int_off: %"PRIu32", own_bc_int_off: %"PRIu32", received bc slot: %u, slots since RX: %u, own slot: %u, time from RX: %"PRIu32", prev synch: %"PRIu32", timeout: %"PRIu32", is BC: %i", fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api), true_bc_interval_offset, own_bc_interval_offset, bc_timing_info->broadcast_slot, slots_since_reception, own_bc_slot, time_from_reception_ms, prev_synchronization_time, timeout, fhss_structure->ws->is_on_bc_channel);
870864
}
871865
return 0;
872866
}

test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ bool test_mac_cca_prepare_cb()
829829

830830
memset(&test_packet, 0, sizeof(mac_pre_build_frame_t));
831831
rf_ptr.active_pd_data_request = &test_packet;
832-
test_packet.csma_periods_left = 1;
832+
test_packet.csma_periods_left = 0;
833833
test_packet.fcf_dsn.frametype = FC_BEACON_FRAME;
834834
test_packet.asynch_request = false;
835835
fhss_callback_response = -1;

0 commit comments

Comments
 (0)