Skip to content

Commit

Permalink
Tested LoRaWan with a single channel LoRaWan gateway
Browse files Browse the repository at this point in the history
Added support for single channel gateways     
Added support for Insight SIP ISP4520 SoC (nRF52832 + Sx1261/2 in one package)
  • Loading branch information
beegee-tokyo committed Oct 9, 2019
1 parent 9144fc1 commit daaaf07
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SX126x-Arduino",
"version": "1.0.1",
"version": "1.0.2",
"keywords": [
"lora",
"Semtech",
Expand Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Changelog
--------
- 2019-10-09:
- Tested LoRaWan with a single channel LoRaWan gateway.
- Added support for single channel gateways
- Added support for Insight SIP ISP4520 SoC (nRf52832 + SX1261/2 in one package)
- 2019-08-01: Added Espressif ESP8266 support
- 2019-07-31: Added LoRaWan support (only partly tested)
- 2019-07-28: Restructure of folders, added nRF52832 support
Expand All @@ -61,9 +65,9 @@ Changelog
Features
--------
- Support SX1261, SX1262 and SX1268 chips
- Support of LoRa protocol and FSK protocol (theoretically, I did not test FSK at all)
- Support of LoRa protocol and FSK protocol (theoretical, I did not test FSK at all)
- Flexible setup for different modules (antenna control, TXCO control)
- Support LoRaWan node class A, B and C (theoretically, I have no LoRaWan gateway to test it at all)
- Support LoRaWan node class A, B and C tested with single channel LoRaWan gateway

Functions
-----
Expand Down Expand Up @@ -180,6 +184,10 @@ Initialize the LoRa HW
```
lora_hardware_init(hwConfig);
```
Simplified LoRa HW initialization for ISP4520 module
```
lora_isp4520_init(SX1262);
```
Setup the callbacks for LoRa events
```
RadioEvents.TxDone = OnTxDone;
Expand Down Expand Up @@ -260,6 +268,13 @@ You can find a lot of information about LoRaWan on the [LoRa Alliance](https://l
*/
#define REGION_US915
/**@brief Indicate if a single channel gateway is the receiver
* More information https://www.thethingsnetwork.org/forum/t/what-is-the-difference-between-otaa-and-abp-devices/2723
* When set to 1 the application does randomly change channels on each transmission
* When set to 0 the application uses always the base channel
*/
#define DO_CHANNEL_SWITCH 0
/**@brief Define activation procedure here
* More information https://www.thethingsnetwork.org/forum/t/what-is-the-difference-between-otaa-and-abp-devices/2723
* When set to 1 the application uses the Over-the-Air activation procedure
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=SX126x-Arduino
version=1.0.1
version=1.0.2
author=Bernd Giesecke <[email protected]>
maintainer=Bernd Giesecke <[email protected]>
sentence=Arduino library to use Semtech SX126x LoRa chips and modules to communicate
paragraph=This library is for LoRa communication with Semtech SX126x chips. It is based on Semtech`s SX126x libraries and adapted to the Arduino framework for ESP32, ESP8266 and Nordic nRF52832. It will not work with other uC`s like AVR.
category=Communication
url=https://github.com/beegee-tokyo/SX126x-Arduino/
architectures=esp32,nordicnrf52,esp8266
architectures=esp32,nordicnrf52,esp8266,nrf52
7 changes: 7 additions & 0 deletions src/mac/Commissioning.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ extern "C"
*/
#define REGION_US915

/**@brief Indicate if a single channel gateway is the receiver
* More information https://www.thethingsnetwork.org/forum/t/what-is-the-difference-between-otaa-and-abp-devices/2723
* When set to 1 the application does randomly change channels on each transmission
* When set to 0 the application uses always the base channel
*/
#define DO_CHANNEL_SWITCH 0

/**@brief Define activation procedure here
* More information https://www.thethingsnetwork.org/forum/t/what-is-the-difference-between-otaa-and-abp-devices/2723
* When set to 1 the application uses the Over-the-Air activation procedure
Expand Down
4 changes: 3 additions & 1 deletion src/mac/LoRaMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,8 @@ extern "C"
nextChan.Joined = IsLoRaMacNetworkJoined;
nextChan.LastAggrTx = AggregatedLastTxDoneTime;

// If we talk to a single channel gateway we should not switch channels
#if DO_CHANNEL_SWITCH == 1
// Select channel
while (RegionNextChannel(LoRaMacRegion, &nextChan, &Channel, &dutyCycleTimeOff, &AggregatedTimeOff) == false)
{
Expand All @@ -1930,7 +1932,7 @@ extern "C"
// Update datarate in the function parameters
nextChan.Datarate = LoRaMacParams.ChannelsDatarate;
}

#endif
// Compute Rx1 windows parameters
RegionComputeRxWindowParameters(LoRaMacRegion,
RegionApplyDrOffset(LoRaMacRegion, LoRaMacParams.DownlinkDwellTime, LoRaMacParams.ChannelsDatarate, LoRaMacParams.Rx1DrOffset),
Expand Down
2 changes: 2 additions & 0 deletions src/mac/region/Region.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
extern "C"
{

#include "mac/Commissioning.h"

/*!
* Macro to compute bit of a channel index.
*/
Expand Down

0 comments on commit daaaf07

Please sign in to comment.