diff --git a/.library.json b/.library.json index 19a168a..ac2931f 100644 --- a/.library.json +++ b/.library.json @@ -1,6 +1,6 @@ { "name": "SX126x-Arduino", - "version": "1.0.1", + "version": "1.0.2", "keywords": [ "lora", "Semtech", diff --git a/README.md b/README.md index 8b00293..74da3a4 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 ----- @@ -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; @@ -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 diff --git a/library.properties b/library.properties index ced6aa3..0721925 100644 --- a/library.properties +++ b/library.properties @@ -1,9 +1,9 @@ name=SX126x-Arduino -version=1.0.1 +version=1.0.2 author=Bernd Giesecke maintainer=Bernd Giesecke 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 \ No newline at end of file +architectures=esp32,nordicnrf52,esp8266,nrf52 \ No newline at end of file diff --git a/src/mac/Commissioning.h b/src/mac/Commissioning.h index 99f965f..84f6163 100644 --- a/src/mac/Commissioning.h +++ b/src/mac/Commissioning.h @@ -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 diff --git a/src/mac/LoRaMac.cpp b/src/mac/LoRaMac.cpp index 0bda976..34bd631 100644 --- a/src/mac/LoRaMac.cpp +++ b/src/mac/LoRaMac.cpp @@ -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) { @@ -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), diff --git a/src/mac/region/Region.h b/src/mac/region/Region.h index 7467098..cb21747 100644 --- a/src/mac/region/Region.h +++ b/src/mac/region/Region.h @@ -55,6 +55,8 @@ extern "C" { +#include "mac/Commissioning.h" + /*! * Macro to compute bit of a channel index. */