Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ ifneq (,$(filter gnrc_mac,$(USEMODULE)))
USEMODULE += csma_sender
endif

ifneq (,$(filter gnrc_gomach,$(USEMODULE)))
USEMODULE += gnrc_netif
USEMODULE += random
USEMODULE += xtimer
USEMODULE += gnrc_mac
FEATURES_REQUIRED += periph_rtt
endif

ifneq (,$(filter nhdp,$(USEMODULE)))
USEMODULE += sock_udp
USEMODULE += xtimer
Expand Down
14 changes: 9 additions & 5 deletions examples/gnrc_networking_mac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ APPLICATION = gnrc_networking_mac
# If no BOARD is found in the environment, use this default:
BOARD ?= samr21-xpro

# Currently, LWMAC is only tested and evaluated through on samr21-xpro.
# Once LWMAC has also been tested through on other boards, the whitelist should be
# Currently, GoMacH has only been tested and evaluated through on samr21-xpro and iotlab-m3.
# Once GoMacH has also been tested through on other boards, the whitelist should be
# then accordingly extended.
BOARD_WHITELIST := samr21-xpro
# Notably, for LWMAC, we have only evaluated it on samr21-xpro nodes. To this end, if
# you are going to include LWMAC for testing, you should only run the example on samr21-xpro.
BOARD_WHITELIST := samr21-xpro iotlab-m3

# This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../..
Expand All @@ -33,8 +35,10 @@ USEMODULE += ps
USEMODULE += netstats_l2
USEMODULE += netstats_ipv6
USEMODULE += netstats_rpl
# Use LWMAC as the MAC layer protocol
USEMODULE += gnrc_lwmac
# Use GoMacH as the MAC layer protocol
USEMODULE += gnrc_gomach
# In case of using LWMAC MAC protocol instead of GoMacH, uncomment the following line and comment the above line
# USEMODULE += gnrc_lwmac

# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
Expand Down
15 changes: 9 additions & 6 deletions examples/gnrc_networking_mac/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# gnrc_networking_mac example

This example shows you how to try out communications between RIOT instances with LWMAC as the MAC layer ptotocol for IEEE 802.15.4 devices.
This example is generally based on `gnrc_networking` but embeds LWMAC to support low duty-cycle operation to conserve power. Also, it intends to show that the duty-cycled LWMAC can support popular upper layer protocols like UDP and RPL.
Currently, it seems that you can only use the samr21-xpro board to test this MAC, since some certain features of the protocol are only available on that platform. Also, the current implementation of LWMAC uses RTT as the underlying timer source. So, currently, LWMAC cannot run on nodes that don't have RTT. But, as a long-term plan, we will replace RTT by a general timer API as the underlying timer to make LWMAC available for more devices, when the related implementations are ready.
This example shows you how to try out communications between RIOT instances with duty-cycled MAC layer protocols (GoMacH and LWMAC) for IEEE 802.15.4 devices.
This example is generally based on `gnrc_networking` but embeds GoMacH (or LWMAC) to support low duty-cycle operation to conserve power. Also, it intends to show that the duty-cycled MAC protocol can support popular upper layer protocols like UDP and RPL.
Currently, it seems that you can only use samr21-xpro and iotlab-m3 boards (in case of using LWMAC, then only samr21-xpro board) to test with this example, since some certain features of the MAC protocol are only available on that platform. Also, the current implementations of GoMacH and LWMAC use RTT as the underlying timer source. So, currently, GoMacH and LWMAC cannot run on nodes that don't have RTT. But, as a long-term plan, we will replace RTT by a general timer API as the underlying timer to make GoMacH and LWMAC available for more devices, when the related implementations are ready.


## Usage
Expand All @@ -15,13 +15,16 @@ make flash
make term
```

## Print out the achieved duty-cyle of GoMacH

You can print out the radio duty-cyle (a roughly one) of GoMacH by setting the `GNRC_GOMACH_ENABLE_DUTYCYLE_RECORD` flag in `sys/include/net/gnrc/gomach/types.h` to "1". By doing so, each time when a device sends or receives a packet, it will print out its achieved radio duty-cycle value.

## Print out the achieved duty-cyle of LWMAC

You can print out the radio duty-cyle (a roughly one) of LWMAC by setting the `LWMAC_ENABLE_DUTYCYLE_RECORD` flag in `sys/include/net/gnrc/lwmac/types.h` to "1". By doing so, each time when a device sends or receives a packet, it will print out its radio duty-cycle value.
You can print out the radio duty-cyle (a roughly one) of LWMAC by setting the `LWMAC_ENABLE_DUTYCYLE_RECORD` flag in `sys/include/net/gnrc/lwmac/types.h` to "1". By doing so, each time when a device sends or receives a packet, it will print out its achieved radio duty-cycle value.
Also, by further enabling the debug flag in `sys/net/gnrc/link_layer/lwmac/tx_state_machine.c`, you will get the printout of how many preamble (WR) and time (sending delay) cost for sending this packet in the TX procedure of LWMAC.


## Try UDP transmissions with LWMAC
## Try UDP transmissions with LWMAC (or GoMacH)

In the RIOT shell, get to know the IP address of one node:

Expand Down
2 changes: 2 additions & 0 deletions examples/gnrc_networking_mac/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 Freie Universität Berlin
* 2017 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
Expand All @@ -14,6 +15,7 @@
* @brief Example application for demonstrating the RIOT network stack
*
* @author Hauke Petersen <[email protected]>
* @author Shuguo Zhuo <[email protected]>
*
* @}
*/
Expand Down
10 changes: 9 additions & 1 deletion sys/auto_init/netif/auto_init_at86rf2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#ifdef MODULE_GNRC_LWMAC
#include "net/gnrc/lwmac/lwmac.h"
#endif
#ifdef MODULE_GNRC_GOMACH
#include "net/gnrc/gomach/gomach.h"
#endif
#include "net/gnrc.h"

#include "at86rf2xx.h"
Expand All @@ -50,7 +53,12 @@ void auto_init_at86rf2xx(void)
LOG_DEBUG("[auto_init_netif] initializing at86rf2xx #%u\n", i);

at86rf2xx_setup(&at86rf2xx_devs[i], &at86rf2xx_params[i]);
#ifdef MODULE_GNRC_LWMAC
#if defined(MODULE_GNRC_GOMACH)
gnrc_netif_gomach_create(_at86rf2xx_stacks[i],
AT86RF2XX_MAC_STACKSIZE,
AT86RF2XX_MAC_PRIO, "at86rf2xx-gomach",
(netdev_t *)&at86rf2xx_devs[i]);
#elif defined(MODULE_GNRC_LWMAC)
gnrc_netif_lwmac_create(_at86rf2xx_stacks[i],
AT86RF2XX_MAC_STACKSIZE,
AT86RF2XX_MAC_PRIO, "at86rf2xx-lwmac",
Expand Down
Loading