Skip to content

LoRaWAN: Fixing incorrect NetID causing ABP Failures #7641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2018
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: 1 addition & 7 deletions features/lorawan/lorastack/mac/LoRaMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ using namespace mbed;
*/
#define DOWN_LINK 1

/**
* A mask for the network ID.
*/
#define LORAWAN_NETWORK_ID_MASK ( uint32_t )0xFE000000


LoRaMac::LoRaMac()
: _lora_time(),
_lora_phy(NULL),
Expand Down Expand Up @@ -1434,7 +1428,7 @@ lorawan_status_t LoRaMac::prepare_join(const lorawan_connect_t *params, bool is_
const static uint8_t nwk_skey[] = MBED_CONF_LORA_NWKSKEY;
const static uint8_t app_skey[] = MBED_CONF_LORA_APPSKEY;

_params.net_id = (MBED_CONF_LORA_DEVICE_ADDRESS & LORAWAN_NETWORK_ID_MASK);
_params.net_id = (MBED_CONF_LORA_DEVICE_ADDRESS & LORAWAN_NETWORK_ID_MASK) >> 25;
_params.dev_addr = MBED_CONF_LORA_DEVICE_ADDRESS;

memcpy(_params.keys.nwk_skey, nwk_skey, sizeof(_params.keys.nwk_skey));
Expand Down
5 changes: 5 additions & 0 deletions features/lorawan/lorawan_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@

#include "platform/Callback.h"

/**
* A mask for the network ID.
*/
#define LORAWAN_NETWORK_ID_MASK (uint32_t) 0xFE000000

/**
* Option Flags for send(), receive() APIs
*
Expand Down