From d526323ce24a5dfb63c369aa0caa4ebb6f951792 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Sat, 24 Feb 2018 15:35:58 -0800 Subject: [PATCH] CSMA for Cooja motes: increase backoff_period --- os/net/mac/csma/csma-output.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/os/net/mac/csma/csma-output.c b/os/net/mac/csma/csma-output.c index 65403324e..74803ecf1 100644 --- a/os/net/mac/csma/csma-output.c +++ b/os/net/mac/csma/csma-output.c @@ -154,9 +154,15 @@ neighbor_queue_from_addr(const linkaddr_t *addr) static clock_time_t backoff_period(void) { +#if CONTIKI_TARGET_COOJA + /* Increase normal value by 20 to compensate for the coarse-grained + radio medium with Cooja motes */ + return MAX(20 * CLOCK_SECOND / 3125, 1); +#else /* CONTIKI_TARGET_COOJA */ /* Use the default in IEEE 802.15.4: aUnitBackoffPeriod which is * 20 symbols i.e. 320 usec. That is, 1/3125 second. */ return MAX(CLOCK_SECOND / 3125, 1); +#endif /* CONTIKI_TARGET_COOJA */ } /*---------------------------------------------------------------------------*/ static int