[IOTCELL-1181] Fixing incorrect NetID causing ABP Failures

The issue rose up when using ARMC6. A test case didn't initialize NetID
parameter for ABP while using connect(params) API. NetID is the first 7 bits
of the Device Address. It makes sense to actually remove the net-id parameter
from ABP settings as the stack can deduce it from device address. However, the ABP
structure is exposed in public APIs, so we can't really do that at the moment.
Simpler fix is to move the mask that helps us to extract first 7 bits of the device address
is exposed in lorawan_types.h and the user can use it to deduce correct net-id.
pull/7641/head
Hasnain Virk 2018-07-30 14:18:00 +03:00
parent 8292affb53
commit 31aaea6749
2 changed files with 6 additions and 7 deletions

View File

@ -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),
@ -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));

View File

@ -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
*