From 87337e12fccf8ffb3f2f930903bff0cf777edc5a Mon Sep 17 00:00:00 2001 From: Yasuyuki Tanaka Date: Sat, 26 Nov 2016 11:47:59 +0100 Subject: [PATCH 1/3] Revert coordinator selection based on node-id for Cooja mote (example/ipv6/rpl-tsch/node.c) --- examples/ipv6/rpl-tsch/node.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/ipv6/rpl-tsch/node.c b/examples/ipv6/rpl-tsch/node.c index a49540f7a..108308988 100644 --- a/examples/ipv6/rpl-tsch/node.c +++ b/examples/ipv6/rpl-tsch/node.c @@ -170,15 +170,21 @@ PROCESS_THREAD(node_process, ev, data) static enum { role_6ln, role_6dr, role_6dr_sec } node_role; node_role = role_6ln; + int coordinator_candidate = 0; + +#ifdef CONTIKI_TARGET_Z1 /* Set node with MAC address c1:0c:00:00:00:00:01 as coordinator, * convenient in cooja for regression tests using z1 nodes * */ - -#ifdef CONTIKI_TARGET_Z1 extern unsigned char node_mac[8]; unsigned char coordinator_mac[8] = { 0xc1, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; - if(memcmp(node_mac, coordinator_mac, 8) == 0) { + coordinator_candidate = (memcmp(node_mac, coordinator_mac, 8) == 0); +#elif CONTIKI_TARGET_COOJA + coordinator_candidate = (node_id == 1); +#endif + + if(coordinator_candidate) { if(LLSEC802154_ENABLED) { node_role = role_6dr_sec; } else { @@ -187,7 +193,6 @@ PROCESS_THREAD(node_process, ev, data) } else { node_role = role_6ln; } -#endif #if CONFIG_VIA_BUTTON { From 106731cec1ea0f20153df39eef73e802a6ee73e1 Mon Sep 17 00:00:00 2001 From: Yasuyuki Tanaka Date: Sat, 26 Nov 2016 11:47:59 +0100 Subject: [PATCH 2/3] TSCH: update README.md - add cooja / Cooja mote as supported platform - correct Rx mode requirements --- core/net/mac/tsch/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/net/mac/tsch/README.md b/core/net/mac/tsch/README.md index fc07f4007..143bc0482 100644 --- a/core/net/mac/tsch/README.md +++ b/core/net/mac/tsch/README.md @@ -42,6 +42,7 @@ It has been tested on the following platforms: * Zolertia Zoul (`zoul`, tested on hardware) * OpenMote-CC2538 (`openmote-cc2538`, tested on hardware) * CC2650 (`srf06-cc26xx`, tested on hardware) + * Cooja mote (`cooja`, tested with cooja) This implementation was present at the ETSI Plugtest event in Prague in July 2015, and did successfully inter-operate with all @@ -83,7 +84,7 @@ Orchestra is implemented in: A simple TSCH+RPL example is included under `examples/ipv6/rpl-tsch`. To use TSCH, first make sure your platform supports it. -Currently, `jn516x`, `sky`, `z1`, `cc2538dk`, `zoul`, `openmote-cc2538`, and `srf06-cc26xx` are the supported platforms. +Currently, `jn516x`, `sky`, `z1`, `cc2538dk`, `zoul`, `openmote-cc2538`, `srf06-cc26xx`, and `cooja` are the supported platforms. To add your own, we refer the reader to the next section. To add TSCH to your application, first include the TSCH module from your makefile with: @@ -179,7 +180,7 @@ Instead, TSCH will poll the driver for incoming packets, from interrupt, exactly TSCH will check when initializing (in `tsch_init`) that the radio driver supports all required features, namely: * get and set Rx mode (`RADIO_PARAM_RX_MODE`) as follows: - * enable address filtering with `RADIO_RX_MODE_ADDRESS_FILTER` + * disable address filtering with `RADIO_RX_MODE_ADDRESS_FILTER` * disable auto-ack with `RADIO_RX_MODE_AUTOACK` * enable poll mode with `RADIO_RX_MODE_POLL_MODE` * get and set Tx mode (`RADIO_PARAM_TX_MODE`) as follows: From a4adc257e805602b8daa156d33b50a27c7e120a3 Mon Sep 17 00:00:00 2001 From: Yasuyuki Tanaka Date: Sat, 26 Nov 2016 11:47:59 +0100 Subject: [PATCH 3/3] Add RTIMERTICKS_TO_US_64() macro (platform/cooja) --- platform/cooja/rtimer-arch.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/cooja/rtimer-arch.h b/platform/cooja/rtimer-arch.h index 390e1ac56..ffd23c824 100644 --- a/platform/cooja/rtimer-arch.h +++ b/platform/cooja/rtimer-arch.h @@ -38,8 +38,9 @@ #define RTIMER_ARCH_SECOND UINT64_C(1000000) -#define US_TO_RTIMERTICKS(US) (US) -#define RTIMERTICKS_TO_US(T) (T) +#define US_TO_RTIMERTICKS(US) (US) +#define RTIMERTICKS_TO_US(T) (T) +#define RTIMERTICKS_TO_US_64(T) (T) rtimer_clock_t rtimer_arch_now(void); int rtimer_arch_check(void);