-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples/lorawan: add possibility to use ABP + pm
- Loading branch information
Showing
3 changed files
with
112 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,25 @@ BOARD ?= b-l072z-lrwan1 | |
# This has to be the absolute path to the RIOT base directory: | ||
RIOTBASE ?= $(CURDIR)/../.. | ||
|
||
DEVEUI ?= 0000000000000000 | ||
APPEUI ?= 0000000000000000 | ||
APPKEY ?= 00000000000000000000000000000000 | ||
# Change this to abp to enable Activation By Personnalization mode | ||
ACTIVATION_MODE ?= otaa | ||
|
||
ifeq (otaa,$(ACTIVATION_MODE)) | ||
DEVEUI ?= 0000000000000000 | ||
APPEUI ?= 0000000000000000 | ||
APPKEY ?= 00000000000000000000000000000000 | ||
else ifeq (abp,$(ACTIVATION_MODE)) | ||
DEVADDR ?= 00000000 | ||
NWKSKEY ?= 00000000000000000000000000000000 | ||
APPSKEY ?= 00000000000000000000000000000000 | ||
RX2_FREQ ?= 869525000 | ||
RX2_DR ?= 3 | ||
else | ||
$(error Unsupported activation mode '$(ACTIVATION_MODE)') | ||
endif | ||
|
||
# Send a message every 20s after joining the network | ||
SEND_PERIOD_S ?= 20 | ||
|
||
# Pass these enviroment variables to docker | ||
DOCKER_ENV_VARS += DEVEUI | ||
|
@@ -28,6 +44,18 @@ USEPKG += semtech-loramac | |
USEMODULE += $(DRIVER) | ||
USEMODULE += fmt | ||
FEATURES_OPTIONAL += periph_rtc | ||
FEATURES_OPTIONAL += periph_eeprom | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
aabadie
Author
Contributor
|
||
|
||
CFLAGS += -DSEND_PERIOD_S=$(SEND_PERIOD_S) | ||
ifeq (otaa,$(ACTIVATION_MODE)) | ||
CFLAGS += -DUSE_OTAA | ||
else ifeq (abp,$(ACTIVATION_MODE)) | ||
CFLAGS += -DUSE_ABP | ||
endif | ||
|
||
# Enable deep sleep power mode (e.g. STOP mode on STM32) which | ||
# in general provides RAM retention after wake-up. | ||
CFLAGS += -DPM_BLOCKER_INITIAL=0x00000001 | ||
|
||
# Comment this out to disable code in RIOT that does safety checking | ||
# which is not needed in a production environment but helps in the | ||
|
@@ -52,8 +80,16 @@ endif | |
include $(RIOTBASE)/Makefile.include | ||
|
||
ifndef CONFIG_KCONFIG_USEMODULE_LORAWAN | ||
# OTAA compile time configuration keys | ||
CFLAGS += -DCONFIG_LORAMAC_APP_KEY_DEFAULT=\"$(APPKEY)\" | ||
CFLAGS += -DCONFIG_LORAMAC_APP_EUI_DEFAULT=\"$(APPEUI)\" | ||
CFLAGS += -DCONFIG_LORAMAC_DEV_EUI_DEFAULT=\"$(DEVEUI)\" | ||
ifeq (otaa,$(ACTIVATION_MODE)) | ||
# OTAA compile time configuration keys | ||
CFLAGS += -DCONFIG_LORAMAC_APP_KEY_DEFAULT=\"$(APPKEY)\" | ||
CFLAGS += -DCONFIG_LORAMAC_APP_EUI_DEFAULT=\"$(APPEUI)\" | ||
CFLAGS += -DCONFIG_LORAMAC_DEV_EUI_DEFAULT=\"$(DEVEUI)\" | ||
else ifeq (abp,$(ACTIVATION_MODE)) | ||
CFLAGS += -DCONFIG_LORAMAC_DEV_ADDR_DEFAULT=\"$(DEVADDR)\" | ||
CFLAGS += -DCONFIG_LORAMAC_APP_SKEY_DEFAULT=\"$(APPSKEY)\" | ||
CFLAGS += -DCONFIG_LORAMAC_NWK_SKEY_DEFAULT=\"$(NWKSKEY)\" | ||
CFLAGS += -DCONFIG_LORAMAC_DEFAULT_RX2_FREQ=$(RX2_FREQ) | ||
CFLAGS += -DCONFIG_LORAMAC_DEFAULT_RX2_DR=$(RX2_DR) | ||
endif | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@aabadie I think this might be the reason while the release tests are failing. Since after an experiment the node EEPROM is not reset, if the device had joined previously it will not attempt to join again...