Skip to content

Commit 4e0a076

Browse files
author
Cruz Monrreal
authored
Merge pull request #7641 from hasnainvirk/abp_armc6_fix
LoRaWAN: Fixing incorrect NetID causing ABP Failures
2 parents 4e6942f + 31aaea6 commit 4e0a076

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ using namespace mbed;
6565
*/
6666
#define DOWN_LINK 1
6767

68-
/**
69-
* A mask for the network ID.
70-
*/
71-
#define LORAWAN_NETWORK_ID_MASK ( uint32_t )0xFE000000
72-
73-
7468
LoRaMac::LoRaMac()
7569
: _lora_time(),
7670
_lora_phy(NULL),
@@ -1434,7 +1428,7 @@ lorawan_status_t LoRaMac::prepare_join(const lorawan_connect_t *params, bool is_
14341428
const static uint8_t nwk_skey[] = MBED_CONF_LORA_NWKSKEY;
14351429
const static uint8_t app_skey[] = MBED_CONF_LORA_APPSKEY;
14361430

1437-
_params.net_id = (MBED_CONF_LORA_DEVICE_ADDRESS & LORAWAN_NETWORK_ID_MASK);
1431+
_params.net_id = (MBED_CONF_LORA_DEVICE_ADDRESS & LORAWAN_NETWORK_ID_MASK) >> 25;
14381432
_params.dev_addr = MBED_CONF_LORA_DEVICE_ADDRESS;
14391433

14401434
memcpy(_params.keys.nwk_skey, nwk_skey, sizeof(_params.keys.nwk_skey));

features/lorawan/lorawan_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434

3535
#include "platform/Callback.h"
3636

37+
/**
38+
* A mask for the network ID.
39+
*/
40+
#define LORAWAN_NETWORK_ID_MASK (uint32_t) 0xFE000000
41+
3742
/**
3843
* Option Flags for send(), receive() APIs
3944
*

0 commit comments

Comments
 (0)