Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mluis1 committed Dec 18, 2020
2 parents 52d9298 + da031ab commit 243864e
Show file tree
Hide file tree
Showing 90 changed files with 3,816 additions and 4,628 deletions.
31 changes: 19 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,37 @@ Please refer to [Releases pre-certification-results](https://github.com/Lora-net

## [Unreleased]

## [4.5.0-rc.1] - 2020-11-24
## [4.4.6] - 2020-12-18

### General

- Release based on "LoRaWAN specification 1.0.4" and "LoRaWAN Regional Parameters 2-1.0.1"
- GitHub reported issues corrections. Please refer to [Release Version 4.5.0](https://github.com/Lora-net/LoRaMac-node/milestone/5)

### Added

- Added implementation of LoRaWAN 1.0.4 changes
- Added implementation for new Certification protocol specification
- Added GitHub repository and firmware examples version definitions
- Release based on "LoRaWAN specification 1.0.3" and "LoRaWAN Regional Parameters v1.0.3revA"
- GitHub reported issues corrections. Please refer to [Release Version 4.4.6](https://github.com/Lora-net/LoRaMac-node/milestone/8)
- **Release 4.4.6 is the last one supporting "LoRaWAN specification 1.0.3"**

### Changed

- Changed IMST boards default power source to USB_POWER
- Refactored MAC layer and examples Non Volatile Memory data handling
- Changed `NewChannelReq` amd `DlChannelReq` handling to ignore command for `AU915`, `CN470` and `US915` regions
- Updated behavior of `SX126xSetLoRaSymbNumTimeout` to round up the timeout to the nearest possible number of symbol.
- Changed radio drivers floating point to integer computations
- Improved `GetNextLowerTxDr` function implementation.
- Changed SX1272 and SX1276 FSK FIFO handling by using `FifoLevel` IRQ instead of `FifoEmpty` IRQ
**WARNING** *DIO1 IRQ MCU pin detection has changed from `RISING` to `RISING_FALLING` edge.*
- Changed IMST boards default power source to `USB_POWER`

### Fixed

- Fixed an issue where the Join back off algorithm wasn't being applied when the duty-cycle enforcement was OFF.
- Fixed certification test application handling
- Fixed `ping-pong` and `rx-sensi` examples to use the right `FSK_BANDWIDTH` and `FSK_AFC_BANDWIDTH` parameters
- Fixed one byte transmissions over I2C
- Fixed `RegionIN865RxParamSetupReq` `DrOffset` verification
- Fixed STM platforms IRQ handlers when using a C++ compiler
- Fixed an issue where the Join back off algorithm wasn't being applied when the duty-cycle enforcement was OFF
- Fixed `AU915_MAX_RX1_DR_OFFSET` value to 5 instead of 6

### Removed

- Removed NvmCtxCallback calls as they should only be done when a modification happens.
- Removed ClassA, ClassB and ClassC examples.

## [4.4.5] - 2020-10-14
Expand All @@ -61,6 +67,7 @@ Please refer to [Releases pre-certification-results](https://github.com/Lora-net
- Changed hard coded `JoinAccept` max payload size (33) by `LORAMAC_JOIN_ACCEPT_FRAME_MAX_SIZE` definition.
- Moved radio operating mode management to specific board implementation
- Changed radio `IsChannelFree API` in order to provide reception bandwidth
- AS923 default downlink dwell time setting changed to disabled
- Back port 1.0.4 region implementation improvements
- Changed `RegionCommonComputeSymbolTimeLoRa`, `RegionCommonComputeSymbolTimeFsk` and `RegionCommonComputeRxWindowParameters`
API implementations to use integer divisions instead of double division.
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@

The aim of this project is to show an example of an end-device LoRaWAN stack implementation.

This project has 3 active branches in place.
This project has 2 active branches in place.

| Branch | L2 spec | RP spec | Tag/Milestone | Class | Comments |
| ------------- |:-------------:|:---------:|:---------:|:---------:|:--------------|
| | [1.0.3](https://lora-alliance.org/resource-hub/lorawanr-specification-v103) | [v1.0.3revA](https://www.lora-alliance.org/resource-hub/lorawanr-regional-parameters-v103reva) | [v4.4.5](https://github.com/Lora-net/LoRaMac-node/releases/tag/v4.4.5) | A/B/C | LoRaWAN L2 1.0.3 - **_Released_** |
| [master](https://github.com/Lora-net/LoRaMac-node/tree/master) | [1.0.3](https://lora-alliance.org/resource-hub/lorawanr-specification-v103) | [v1.0.3revA](https://www.lora-alliance.org/resource-hub/lorawanr-regional-parameters-v103reva) | [M 4.4.6](https://github.com/Lora-net/LoRaMac-node/milestone/8) | A/B/C | LoRaWAN L2 1.0.3 |
| [develop](https://github.com/Lora-net/LoRaMac-node/tree/develop) | [1.0.4](https://lora-alliance.org/resource-hub) | [2-1.0.1](https://lora-alliance.org/sites/default/files/2020-02/rp_2-1.0.1.pdf) | [v4.5.0-rc.1](https://github.com/Lora-net/LoRaMac-node/releases/tag/v4.5.0-rc.1)/[M 4.5.0](https://github.com/Lora-net/LoRaMac-node/milestone/5) | A/B/C | LoRaWAN L2 1.0.4 - **_Pre-Released_**|
| [feature/5.0.0](https://github.com/Lora-net/LoRaMac-node/tree/feature/5.0.0) | [1.0.4](https://lora-alliance.org/resource-hub) / [1.1.1](https://lora-alliance.org/resource-hub/lorawanr-specification-v11) | [2-1.0.1](https://lora-alliance.org/sites/default/files/2020-02/rp_2-1.0.1.pdf) | [M 5.0.0](https://github.com/Lora-net/LoRaMac-node/milestone/3) | A/B/C | LoRaWAN L2 1.0.4 / 1.1.1 |
| | [1.0.3](https://lora-alliance.org/resource-hub/lorawanr-specification-v103) | [v1.0.3revA](https://www.lora-alliance.org/resource-hub/lorawanr-regional-parameters-v103reva) | [v4.4.6](https://github.com/Lora-net/LoRaMac-node/releases/tag/v4.4.6) | A/B/C | LoRaWAN L2 1.0.3 - **_Released_ (last release based on 1.0.3)** |
| [master](https://github.com/Lora-net/LoRaMac-node/tree/master) | [1.0.4](https://lora-alliance.org/resource-hub/lorawan-104-specification-package) | [2-1.0.1](https://lora-alliance.org/sites/default/files/2020-02/rp_2-1.0.1.pdf) | [M 4.5.0](https://github.com/Lora-net/LoRaMac-node/milestone/5) | A/B/C | LoRaWAN L2 1.0.4 |
| [develop](https://github.com/Lora-net/LoRaMac-node/tree/develop) | [1.0.4](https://lora-alliance.org/resource-hub/lorawan-104-specification-package) / [1.1.1](https://lora-alliance.org/resource-hub/lorawanr-specification-v11) | [2-1.0.1](https://lora-alliance.org/sites/default/files/2020-02/rp_2-1.0.1.pdf) | [M 4.6.0](https://github.com/Lora-net/LoRaMac-node/milestone/3) | A/B/C | LoRaWAN L2 1.0.4 / 1.1.1 |

This project fully implements ClassA, ClassB and ClassC end-device classes and it also provides SX1272/73, SX1276/77/78/79, SX1261/2 and LR1110 radio drivers.

Expand Down
8 changes: 6 additions & 2 deletions src/apps/LoRaMac/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ if(SUB_PROJECT STREQUAL periodic-uplink-lpp)
#---------------------------------------------------------------------------------------
list(APPEND ${PROJECT_NAME}_COMMON
"${CMAKE_CURRENT_LIST_DIR}/common/CayenneLpp.c"
"${CMAKE_CURRENT_LIST_DIR}/common/cli.c"
"${CMAKE_CURRENT_LIST_DIR}/common/LmHandlerMsgDisplay.c"
"${CMAKE_CURRENT_LIST_DIR}/common/NvmCtxMgmt.c"
"${CMAKE_CURRENT_LIST_DIR}/common/NvmDataMgmt.c"
)

#---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -78,7 +79,7 @@ elseif(SUB_PROJECT STREQUAL fuota-test-01)
#---------------------------------------------------------------------------------------
list(APPEND ${PROJECT_NAME}_COMMON
"${CMAKE_CURRENT_LIST_DIR}/common/LmHandlerMsgDisplay.c"
"${CMAKE_CURRENT_LIST_DIR}/common/NvmCtxMgmt.c"
"${CMAKE_CURRENT_LIST_DIR}/common/NvmDataMgmt.c"
)

#---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -125,6 +126,9 @@ target_compile_definitions(${PROJECT_NAME}-${SUB_PROJECT} PRIVATE ACTIVE_REGION=
if(${SECURE_ELEMENT_PRE_PROVISIONED} MATCHES ON)
target_compile_definitions(${PROJECT_NAME}-${SUB_PROJECT} PRIVATE -DSECURE_ELEMENT_PRE_PROVISIONED)
endif()
if(${SECURE_ELEMENT} MATCHES SOFT_SE)
target_compile_definitions(${PROJECT_NAME}-${SUB_PROJECT} PRIVATE -DSOFT_SE)
endif()
target_compile_definitions(${PROJECT_NAME}-${SUB_PROJECT} PUBLIC
$<BUILD_INTERFACE:$<TARGET_PROPERTY:mac,INTERFACE_COMPILE_DEFINITIONS>>
)
Expand Down
22 changes: 16 additions & 6 deletions src/apps/LoRaMac/common/LmHandler/LmHandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
#include "utilities.h"
#include "timer.h"
#include "Commissioning.h"
#include "NvmCtxMgmt.h"
#include "NvmDataMgmt.h"
#include "radio.h"
#include "LmHandler.h"
#include "LmhPackage.h"
#include "LmhpCompliance.h"
Expand Down Expand Up @@ -222,6 +223,7 @@ LmHandlerErrorStatus_t LmHandlerInit( LmHandlerCallbacks_t *handlerCallbacks,
LmHandlerParams_t *handlerParams )
{
//
uint16_t nbNvmData = 0;
MibRequestConfirm_t mibReq;
LmHandlerParams = handlerParams;
LmHandlerCallbacks = handlerCallbacks;
Expand All @@ -232,7 +234,7 @@ LmHandlerErrorStatus_t LmHandlerInit( LmHandlerCallbacks_t *handlerCallbacks,
LoRaMacPrimitives.MacMlmeIndication = MlmeIndication;
LoRaMacCallbacks.GetBatteryLevel = LmHandlerCallbacks->GetBatteryLevel;
LoRaMacCallbacks.GetTemperatureLevel = LmHandlerCallbacks->GetTemperature;
LoRaMacCallbacks.NvmContextChange = NvmCtxMgmtEvent;
LoRaMacCallbacks.NvmDataChange = NvmDataMgmtEvent;
LoRaMacCallbacks.MacProcessNotify = LmHandlerCallbacks->OnMacProcess;

IsClassBSwitchPending = false;
Expand All @@ -242,10 +244,13 @@ LmHandlerErrorStatus_t LmHandlerInit( LmHandlerCallbacks_t *handlerCallbacks,
return LORAMAC_HANDLER_ERROR;
}

// Restore data if required
nbNvmData = NvmDataMgmtRestore( );

// Try to restore from NVM and query the mac if possible.
if( NvmCtxMgmtRestore( ) == NVMCTXMGMT_STATUS_SUCCESS )
if( nbNvmData > 0 )
{
LmHandlerCallbacks->OnNvmContextChange( LORAMAC_HANDLER_NVM_RESTORE );
LmHandlerCallbacks->OnNvmDataChange( LORAMAC_HANDLER_NVM_RESTORE, nbNvmData );
}
else
{
Expand Down Expand Up @@ -337,6 +342,8 @@ bool LmHandlerIsBusy( void )

void LmHandlerProcess( void )
{
uint16_t size = 0;

// Process Radio IRQ
if( Radio.IrqProcess != NULL )
{
Expand All @@ -346,9 +353,12 @@ void LmHandlerProcess( void )
// Processes the LoRaMac events
LoRaMacProcess( );

if( NvmCtxMgmtStore( ) == NVMCTXMGMT_STATUS_SUCCESS )
// Store to NVM if required
size = NvmDataMgmtStore( );

if( size > 0 )
{
LmHandlerCallbacks->OnNvmContextChange( LORAMAC_HANDLER_NVM_STORE );
LmHandlerCallbacks->OnNvmDataChange( LORAMAC_HANDLER_NVM_STORE, size );
}

// Call all packages process functions
Expand Down
10 changes: 6 additions & 4 deletions src/apps/LoRaMac/common/LmHandler/LmHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,19 @@ typedef struct LmHandlerCallbacks_s
/*!
*\brief Will be called each time a Radio IRQ is handled by the MAC
* layer.
*
*
*\warning Runs in a IRQ context. Should only change variables state.
*/
void ( *OnMacProcess )( void );
/*!
* Notifies the upper layer that the NVM context has changed
*
* \param [IN] stored Indicates if we are storing (true) or
* restoring (false) the NVM context
* \param [IN] state Indicates if we are storing (true) or
* restoring (false) the NVM context
*
* \param [IN] size Number of data bytes which were stored or restored.
*/
void ( *OnNvmContextChange )( LmHandlerNvmContextStates_t state );
void ( *OnNvmDataChange )( LmHandlerNvmContextStates_t state, uint16_t size );
/*!
* Notifies the upper layer that a network parameters have been set
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "board.h"
#include "NvmCtxMgmt.h"
#include "NvmDataMgmt.h"
#include "LoRaMacTest.h"
#include "LmHandler.h"
#include "LmhpCompliance.h"
Expand Down
8 changes: 5 additions & 3 deletions src/apps/LoRaMac/common/LmHandlerMsgDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,18 @@ void PrintHexBuffer( uint8_t *buffer, uint8_t size )
printf( "\n" );
}

void DisplayNvmContextChange( LmHandlerNvmContextStates_t state )
void DisplayNvmDataChange( LmHandlerNvmContextStates_t state, uint16_t size )
{
if( state == LORAMAC_HANDLER_NVM_STORE )
{
printf( "\n###### ============ CTXS STORED ============ ######\n\n" );
printf( "\n###### ============ CTXS STORED ============ ######\n" );

}
else
{
printf( "\n###### =========== CTXS RESTORED =========== ######\n\n" );
printf( "\n###### =========== CTXS RESTORED =========== ######\n" );
}
printf( "Size : %i\n\n", size );
}

void DisplayNetworkParametersUpdate( CommissioningParams_t *commissioningParams )
Expand Down
4 changes: 3 additions & 1 deletion src/apps/LoRaMac/common/LmHandlerMsgDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
*
* \param [IN] state Indicates if we are storing (true) or
* restoring (false) the NVM context
*
* \param [IN] size Number of data bytes which were stored or restored.
*/
void DisplayNvmContextChange( LmHandlerNvmContextStates_t state );
void DisplayNvmDataChange( LmHandlerNvmContextStates_t state, uint16_t size );

/*!
* \brief Displays updated network parameters
Expand Down
Loading

0 comments on commit 243864e

Please sign in to comment.