mirror of https://github.com/ARMmbed/mbed-os.git
[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
parent
8292affb53
commit
31aaea6749
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue