TSCH: add RADIO_DELAY_BEFORE_DETECT to rx guard time when waiting for a packet to be received

This commit is contained in:
Atis Elsts 2016-07-02 15:30:49 +03:00
parent 0313f9abf1
commit 081ec100a4
2 changed files with 4 additions and 5 deletions

View File

@ -580,7 +580,7 @@ PT_THREAD(tsch_tx_slot(struct pt *pt, struct rtimer *t))
tsch_radio_on(TSCH_RADIO_CMD_ON_WITHIN_TIMESLOT); tsch_radio_on(TSCH_RADIO_CMD_ON_WITHIN_TIMESLOT);
/* Wait for ACK to come */ /* Wait for ACK to come */
BUSYWAIT_UNTIL_ABS(NETSTACK_RADIO.receiving_packet(), BUSYWAIT_UNTIL_ABS(NETSTACK_RADIO.receiving_packet(),
tx_start_time, tx_duration + tsch_timing[tsch_ts_rx_ack_delay] + tsch_timing[tsch_ts_ack_wait]); tx_start_time, tx_duration + tsch_timing[tsch_ts_rx_ack_delay] + tsch_timing[tsch_ts_ack_wait] + RADIO_DELAY_BEFORE_DETECT);
TSCH_DEBUG_TX_EVENT(); TSCH_DEBUG_TX_EVENT();
ack_start_time = RTIMER_NOW() - RADIO_DELAY_BEFORE_DETECT; ack_start_time = RTIMER_NOW() - RADIO_DELAY_BEFORE_DETECT;
@ -753,7 +753,7 @@ PT_THREAD(tsch_rx_slot(struct pt *pt, struct rtimer *t))
if(!packet_seen) { if(!packet_seen) {
/* Check if receiving within guard time */ /* Check if receiving within guard time */
BUSYWAIT_UNTIL_ABS((packet_seen = NETSTACK_RADIO.receiving_packet()), BUSYWAIT_UNTIL_ABS((packet_seen = NETSTACK_RADIO.receiving_packet()),
current_slot_start, tsch_timing[tsch_ts_rx_offset] + tsch_timing[tsch_ts_rx_wait]); current_slot_start, tsch_timing[tsch_ts_rx_offset] + tsch_timing[tsch_ts_rx_wait] + RADIO_DELAY_BEFORE_DETECT);
} }
if(!packet_seen) { if(!packet_seen) {
/* no packets on air */ /* no packets on air */

View File

@ -346,9 +346,8 @@ typedef uint32_t rtimer_clock_t;
/* Delay between GO signal and start listening. /* Delay between GO signal and start listening.
* This value is so small because the radio is constantly on within each timeslot. */ * This value is so small because the radio is constantly on within each timeslot. */
#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15)) #define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15))
/* Delay between the SFD finishes arriving and it is detected in software. /* Delay between the SFD finishes arriving and it is detected in software. */
* Not important on this platform as it uses hardware timestamps for SFD */ #define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352))
#define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(0))
/* Timer conversion; radio is running at 4 MHz */ /* Timer conversion; radio is running at 4 MHz */
#define RADIO_TIMER_SECOND 4000000u #define RADIO_TIMER_SECOND 4000000u