Giter Club home page Giter Club logo

beelan-lorawan's Introduction

LibraryBuild

Arduino LoRaWAN library

This repository contains the simple LoRaWAN library encapsulated to run in the generic platform, allowing using the SX1272, SX1276 transceivers and compatible modules (such as some HopeRF RFM9x modules).

This repository is all based on the library originally created by Ideetron B.V. This library is slightly modified and this repo, with the principal purpose to have an LoRaWAN MAC layer for arduino with an easy API.

Features

The Arduino LoRaWAN library supports LoRaWAN Class A and Class C implementations operating in EU-868, AS-923, US-915 and AU-915 bands. Note that this library is fairly simple with the aim of demonstrating the LoRaWAN capabilities.

What certainly works:

  • Sending packets uplink, taking into account duty cycling.
  • Custom frequencies and datarate settings.
  • Receiving downlink packets in the RX1 window (EU-868, AS-923,US-915,AU-915).
  • Over-the-air activation (OTAA / joining) (EU-868, AS-923).
  • Class C operation.
  • Receiving downlink packets in the RX1 window (US-915).
  • Receiving downlink packets in the RX2 window.
  • Over-the-air activation (OTAA / joining) (US-915).

What has not been tested:

  • Receiving and processing MAC commands.

If you try one of these untested features and it works, be sure to let us know (creating a Github issue is probably the best way for that, also so you can submit a pull request to improve this repository).

Installing the library

Please refer to the wiki's first steps section for instructions on installing the library.

Configuration

A number of features can be configured or disabled by editing the config.h file in the library folder. Unfortunately the Arduino environment does not offer any way to do this (compile-time) configuration from the sketch, so be careful to recheck your configuration when you switch between sketches or update the library.

At the very least, you should set the right type of board in config.h, most other values should be fine at their defaults.

When using the US_915 you need to select which sub-band you will use, by default it is sub-band 6.

We have to manually set the frequency plan (EU_868, US_915, AS_923, AS_923_2...) in the Config.h of the library.

Supported hardware

This library is intended to be used with plain LoRa transceivers, connecting to them using SPI. In particular, the SX1272 and SX1276 families are supported (which should include SX1273, SX1277, SX1278 and SX1279 which only differ in the available frequencies, bandwidths and spreading factors). It has been tested with both SX1272 and SX1276 chips, using the Semtech SX1272 evaluation board and the HopeRF RFM92 and RFM95 boards (which supposedly contain an SX1272 and SX1276 chip respectively).

Some of the supported pre-built board currently available in the market are:

This library has been tested using:

  • Arduino Uno
  • WeMos D1 R2 (ESP8266 family board)
  • ESP32
  • Electronic Cats CatWAN USB-Stick
  • Electronic Cats Bast-WAN (Based on SAMR34)
  • NINA B302 is NRF52840 core
  • STMDuino
  • RENESAS compatible boards

Connections

To make this library work, your Arduino (or whatever Arduino-compatible board you are using) should be connected to the transceiver. The exact connections are a bit dependent on the transceiver board and Arduino used, so this section tries to explain what each connection is for and in what cases it is (not) required.

Pin mapping

As described above, most connections can use arbitrary I/O pins on the Arduino side. To tell the arduino LoRaWAN library about these, a pin mapping struct is used in the sketch file.

For example, this could look like this:

sRFM_pins RFM_pins = {
  	.CS = SS,
  	.RST = RFM_RST,
  	.DIO0 = RFM_DIO0,
  	.DIO1 = RFM_DIO1,
  	.DIO2 = RFM_DIO2,
  	.DIO5 = RFM_DIO5
}; 

API

Tests

How to contribute

Contributions are welcome!

Please read the document Contribution Manual which will show you how to contribute your changes to the project.

✨ Thanks to all our contributors! ✨

See Electronic Cats CLA for more information.

See the community code of conduct for a vision of the community we want to build and what we expect from it.

Maintainer

Electronic Cats invests time and resources providing this open source design, please support Electronic Cats and open-source hardware by purchasing products from Electronic Cats! Thanks Beelan

License

Most source files in this repository are made available under the MIT License. The examples which use a more liberal license. Some of the AES code is available under the LGPL. Refer to each individual source file for more details.

beelan-lorawan's People

Contributors

aryansinghdhiman2 avatar bitconnector avatar daeynasvistas avatar damattl avatar davidrodrii avatar eric286 avatar iotthinks avatar ivanmorenoj avatar jazhe avatar jjuliano77 avatar kadirozdinc avatar mateuszkowalke avatar mmobarak avatar mr3188 avatar per1234 avatar regioiger avatar sabas1080 avatar sacua avatar tomasroj avatar wero1414 avatar wolftrax5 avatar xpeqex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beelan-lorawan's Issues

TTN Port Number

Thank you for the great library.
I would like to be able to specify the port for the next version.
Is there any way I can do this now.

OTAA mode

Hello,
You say that OTAA mode is supported, but in looking in the functions, I can't see anywhere to enter APP EUI and app key and device EUI

Works with Heltec Wireless Stick Lite and Feature Request

Just leaving a note that this library works well with the Heltec Wireless Stick Lite in conjuction with a Helium Hotspot, using this pin config:

const sRFM_pins RFM_pins = {
  .CS = 18,
  .RST = 14,
  .DIO0 = 26,
  .DIO1 = 35,
  .DIO2 = 34,
  .DIO5 = 0xff,
};

And for a feature request, saving the OTAA join information to avoid the need to join each time would be good. For my particular use, my board goes to deep sleep, and wakes up by timer which resets the board. It then does the full join procedure, getting a new device address and resetting the frame count each time. I'll see if I can figure it out myself, but I'm not all that familiar with the inner workings.

Thanks for the library.

ESP-12F (esp8266) Soft WDT after Joined to network and Sending: Counter-x

OK, so my gateway are back .. and now i have similar yield() problem after joining.

Problem:
Joining...
Joining...
NwkSKey: 1D44CE4BDF7626A7F1B4E469D7EXXXXXX
AppSKey: B4F11F8372451ACB874CEB98XXXXXX
Joined to network
Sending: Counter-0

in the gateway i did get UPLINK DOWNLINK from node

after some seconds.. ESP8266 reset

ESP reset and try to join again..
then DevNonce are invalid .. its probably try to use the same nonce after another join OTAA

type:"OTAA"
error:"validate dev-nonce error"

myconfig (ESP-12F)

const sRFM_pins RFM_pins = {
  .CS = 15,
  .RST = -1,
  .DIO0 = 5,
  .DIO1 = 4,
  .DIO2 = -1,
  .DIO5 = -1,
};

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

stack>>>

ctx: cont
sp: 3ffffd00 end: 3fffffc0 offset: 01a0
3ffffea0: 3ffee6f0 3ffee69c 3ffee740 402022e1
3ffffeb0: 3ffee6f0 3ffee69c 3ffee6a4 4020196c
3ffffec0: e6b38240 00010001 9c2d2901 65b75c5e
3ffffed0: 00000000 4bc6a7f0 010624dd 00000000
3ffffee0: 00000000 00000000 4bc6a7f0 00000000
3ffffef0: 277d6ebc 182ee9b7 40100200 000232bd
3fffff00: 3ffffec0 00000000 00000001 3ffefb01
3fffff10: 028aaa89 00000000 1a28000a f9e3f1f1
3fffff20: 3ffe8800 3ffffec0 00000016 000007cf
3fffff30: 3ffee69c 3ffee6f0 3ffee770 40201b7c
3fffff40: 00022aed 3ffee728 3ffee6a4 00000005
3fffff50: 40202e64 3ffee7a4 3ffee614 3ffee7a4
3fffff60: 00000001 3ffee714 3ffee614 4020280c
3fffff70: 3ffee740 3ffee614 3ffee7a4 3ffee7a4
3fffff80: 3ffee60c 3ffee614 3ffee4d9 402011a6
3fffff90: 3fffdad0 00000000 3ffee7d0 3ffee810
3fffffa0: 3fffdad0 00000000 3ffee7d0 402037d4
3fffffb0: feefeffe feefeffe 3ffe84ec 40100c29
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------



i use example scketch
  • Test in all frequencies of US_915 band
  •  Using SUB BAND 1 [ 903.9 - 905.3 Mhz] see config.h
    
  •  channel [0 - 7]
    
  •  data rate [0 - 3]
    
  • Class A and C devices with OTAA activation

Testing ESP32, questions

Hello, I am testing your library with an ESP32, I am loading the OTAA example and I manage to link it with my loraserver, however, the data is not always received, I am sending data every 10 seconds but sometimes minutes pass without the data arriving, additionally; When I turn the ESP32 off and on again, it can take up to 30 minutes without joining, why can that be? One last query, the channels used are from 0 to 7, however my gw is 16, how can I modify your library to access more channels? thank you

RX and TX buffer fixed size to 64 bytes

Now the payload buffer is fixed to 64 bits, as it depends on Datarate instead of allocating always the biggest posible buffer (around 242 bytes) it would be a good idea to define a constant in Config.h to define the maximum payload size the node will use.

Payload size should also be checked before copying data to the buffer.

Arduino Uno + RFM95W configured for the IN865_867 band getting stuck on 'Joining...'

Hi,
I have an Arduino Uno and RFM95W (868 MHz) version and I've tried to configure the code for the Indian band (865-857 MHz), but the code appears to be stuck on 'Joining...'.

I've made a few changes to the code as some had suggested on another thread.

Firstly in config.h, I have added the support for the IN865_867 band as below:

#define IN_865_867

#ifdef IN_865_867
    //Select the subband youre working on
    // make sure your gateway is working in one of these bands
    //#define SUBND_0    
    #define SUBND_1     
    //#define SUBND_2  
    //#define SUBND_3  
    //#define SUBND_4  
    //#define SUBND_5  
    //#define SUBND_6  
    //#define SUBND_7  
#endif

Then, I changed the enumeration in Struct.h to have the parameters for the IN865_867 band:

#elif defined(IN_865_867)
    SF12BW125   = 0x00,
    SF11BW125   = 0x01,
    SF10BW125   = 0x02,
    SF9BW125    = 0x03,
    SF8BW125    = 0x04,
    SF7BW125    = 0x05

In the file RFM95.cpp, I have added this code to the LoRa Frequencies section, while keeping the RFM_Change_Datarate function as it is.

#elif defined(IN_865_867)
  static const PROGMEM unsigned char LoRa_Frequency[4][3] = {//[865.1 - 866.9] MHz
    { 0xD8, 0x44, 0x24 }, //Channel [0], 865.0625 MHz / 61.035 Hz = 14173220 = 0xD84424
    { 0xD8, 0x57, 0x8F }, //Channel [1], 865.4025 MHz / 61.035 Hz = 14178191 = 0xD8578F
    { 0xD8, 0x7F, 0x2F }, //Channel [2], 865.9850 MHz / 61.035 Hz = 14188335 = 0xD87F2F
    { 0xD8, 0xA3, 0x58 }, // RX2 Receive channel 866.550 MHz / 61.035 Hz = 14197592 = 0xD8A358
  };

Furthermore, I have kept the RFM_Change_Channel code for IN band similar to the EU band as below

#elif defined(IN_865_867)
  if (Channel <= 0x08)
    for(unsigned char i = 0 ; i < 3 ; ++i)
      RFM_Write(RFM_REG_FR_MSB + i, pgm_read_byte(&(LoRa_Frequency[Channel][i])));

Finally, I am using the pin map as shown below:

const sRFM_pins RFM_pins = {
   .CS = 10,
  .RST = 5,
  .DIO0 = 7,
  .DIO1 = 6,
  .DIO2 = 2,
  .DIO5 = 3,
};

I have a Pycom gateway configured to be listening on the Indian LoRa band. I can see the join request messages on the TTN console, however, I don't see any messages from the node after the join request and the Serial Monitor shows that the Node is stuck on 'Joining...'.

Can someone tell me what else needs to be done to get this to work?

ask

code is working?
Where do I set the radio pinning?

ESP-12F (esp8266) Soft WDT crash and reset with DR0

Problem: It seems that yield problem are back when using DR0 and ESP8266
im try to do some alternative to ADR and im testing DR0

when using DR0 with OTAA and didnt autenticate first time your get

_>>>stack>>>

ctx: cont
sp: 3ffffcf0 end: 3fffffc0 offset: 01a0
3ffffe90: 3ffef764 3ffef6d8 3ffef77c 4020b659
3ffffea0: 3ffef764 3ffef6d8 3ffef72c 4020b08b
3ffffeb0: 3ffef77c 3ffef75c 3ffef764 4020b048
3ffffec0: 00000000 4bc6a7f0 ef5c28f5 00000000
3ffffed0: 00000000 00000000 4bc6a7f0 00000000
<<<stack<<<_

ESP8266 dont like while() very much...

so to fix problem:

add yield() in LORA_Cycle() function in RFM95.cpp

before:
while(digitalRead(RFM_pins.DIO0) == LOW);

after:

while(digitalRead(RFM_pins.DIO0) == LOW)  {
	yield();	
    };

before:
while((digitalRead(RFM_pins.DIO0) == LOW) && (digitalRead(RFM_pins.DIO1) == LOW)) ;
after:

while((digitalRead(RFM_pins.DIO0) == LOW) && (digitalRead(RFM_pins.DIO1) == LOW))  {
	yield();	
    };

API.md

Add API.md for the explain functions

Using -1 for unused pins halts the program

I am testing the code on a Feather M0 where I am only using DIO0 and DIO1, therefore my definition is as follows:

const sRFM_pins RFM_pins = {
  .CS = 8,
  .RST = 4,
  .DIO0 = 3,
  .DIO1 = 6,
  .DIO2 = -1,
  .DIO5 = -1,
};

The example codes were not working and I figured out that the following line stops the execution when DIOx is -1. Commenting out the line allows the code to continue:

https://github.com/BeelanMX/Beelan-LoRaWAN/blob/51084646d9361215526ccc9613c5d31c83888f44/src/arduino-rfm/lorawan-arduino-rfm.cpp#L128

It would be good to check if the pints are set to -1 and skip the pinMode configuration.

ACK reception

What is the way to check if an uplink has been acknowledged?

Thanks!!

Pregunta??

Con que tarjetas de desarrollo se pude utilizar o con que arquitecturas?... Actualmente cuento con una nodemcu, una stm32 bluepill y un arduino pro mini

Se podra utilizar en todas con el ide de arduino?

Espero su respuesta, Saludos
Excelente Aportación

How does beelan control duty cycle

Hi friends,
How does the project control regional duty cycle?
I have tested class A uplinking for interval 5 sec. But after a few uplinks, i have got mic error on the server
In other tests, i have seen the class mode is changed after first uplink, it seems an overflow is occured.
I became confused.
So I should know how the library manages duty cycle?

arduino SX1276

HI,
Where can i find setup for SX1276 chip example because we have only for RFM95W chip ?

Thank
Eric

how to see class c downlink messages

hello,
i a m using esp32 with sx1276 and using class c apb example i am sending the downlink messages in my application but could not see any thing on the console i have changed my code according to in 865 to 867 i can see uplink messages every 10 seconds what are the changes i should do for get my downlink messages
in console
recvStatus = lora.readData(outStr);
if(recvStatus) {
Serial.println(outStr);
this is where i get the downlink messges right?
thanks and regards
manikandan v

stm32

plans to STM32 L0 + SX1276 ?

If yes, i would like to test here!

Support AU_915

Hello, I am working on a project with the frequency AU_915. I would like to contribute the necessary changes for it, but I confess that I'm a little lost. Can you help me with just these defines? the rest I think I can do to support the use in AU_915?

typedef enum {
#if defined(US_915)
    SF10BW125   = 0x00,
    SF9BW125    = 0x01,
    SF8BW125    = 0x02,
    SF7BW125    = 0x03,
    SF8BW500    = 0x04,
    SF12BW500   = 0x08,
    SF11BW500   = 0x09,
    SF10BW500   = 0x0A,
    SF9BW500    = 0x0B,
    SF7BW500    = 0x0D
#elif #if defined(AU_915)
  //
#elif defined(EU_868)
    SF12BW125   = 0x00,
    SF11BW125   = 0x01,
    SF10BW125   = 0x02,
    SF9BW125    = 0x03,
    SF8BW125    = 0x04,
    SF7BW125    = 0x05,
    SF7BW250    = 0x06
#endif
} dataRates_t;

I'm working with this for changes.
AU915-928
Uplink:

916.8 - SF7BW125 to SF10BW125
917.0 - SF7BW125 to SF10BW125
917.2 - SF7BW125 to SF10BW125
917.4 - SF7BW125 to SF10BW125
917.6 - SF7BW125 to SF10BW125
917.8 - SF7BW125 to SF10BW125
918.0 - SF7BW125 to SF10BW125
918.2 - SF7BW125 to SF10BW125
917.5 SF8BW500

Downlink:
923.3 - SF7BW500 to SF12BW500
923.9 - SF7BW500 to SF12BW500
924.5 - SF7BW500 to SF12BW500
925.1 - SF7BW500 to SF12BW500
925.7 - SF7BW500 to SF12BW500
926.3 - SF7BW500 to SF12BW500
926.9 - SF7BW500 to SF12BW500
927.5 - SF7BW500 to SF12BW500

Can you please help me on this most basic point?

Dragino Shield + TTI v3 + Class C Downlink

Hi,
I am currently working on Dragino LoRa Shield with TTI v3 in Class C in which we need to implement a simple uplink & downlink in our existing project in Indian frequency band (IN865).
Since we are using Indian frequency to communicate, we included Indian frequency settings in the library and the below is observed in THE THINGS INDUSTRIES v3 (TTI v3 – Network Server),

  1. After included the Indian frequency (IN865), we are able to send the uplink messages for ABP (CLASS A & CLASS C) & OTAA (CLASS A) only 7 frequencies out of 8 frequencies.
    a. Frequencies mentioned below in terms of Hz,
    i. 865062500
    ii. 865402500
    iii. 865602500
    iv. 865985000
    v. 866185000
    vi. 866385000
    vii. 866585000
    viii. 866785000
  2. We are not receiving the downlink messages for ABP (CLASS A & CLASS C) and while giving confirmed downlink for OTAA (CLASS A), we couldn’t see the acknowledgment from the node so it is keep on confirming the downlink for every uplink in the network server.
  3. We saw the updated library last week and we tested the same, but we are facing same issues as above.
  4. We need to understand the LoRaWAN version used in this library. Because sometimes MAC & PHY version could mismatch & lead these kind of issues.
  5. Also we need to know the below queries,
    a. Have you tested the above scenarios at your end? If so, what network server you people used for your testing?
    b. While testing, did you people receive the downlinks in both RX1 & RX2 receiver windows?
    c. Is there any development going for OTAA - CLASS C? & for other functionalities or improvisation is going?
    d. Did we missed any configurations/settings? We have attached the modified library for your reference. Kindly give us your support/inputs for our further development.

Expecting your support for our development and thanks in advance!

Multiple uplink messages

Hi

I'm using your ABP example to connect a SX1276+arduino to TTN.
I changed the code just to send one request, so i see at terminal "Sending: Counter-0"

At TTN console i see on that node thousands of uplink messages, all with payload "Counter-0", so i'm receiving lots of duplicated messages. It seems your library is flooding the gateway with messages.

Why is this happening?

light sleep mode issue

Hi
I got an new issue (I also have minor issues but I will talk about these in another thread)

The lorawan library didn't work when ESP wakes up after a light sleep (esp_light_sleep_start())
In fact, after a light sleep, the lora seems to stops working, so I have to reinit it with :

      esp_sleep_enable_timer_wakeup(esp_sleep);
      esp_light_sleep_start();

      SPI.begin(5,19,27,18);
      if(!lora.init()){
        Serial.println("LORA: lora module not detected");
        delay(5000);
        return;
      }

      lora.setDeviceClass(CLASS_A);
      lora.setDataRate(LORA_DATARATE);
      lora.setChannel(LORA_CHANNEL);

In that case, the lora succeed to send datas and receive acks, but my LoRaWAN receiver keeps telling me I got nothing...
I think it's because during lora.init(), all lora parameters (including actual session) are reset.

But all works again if I edit your library (lorawan-arduino-rfm.cpp > LoRaWANClass::init()) this way (value = 1 for full reset, value = 0 for half reset) :

bool LoRaWANClass::init(bool value)
{
	if(value)
	{
    // Lora Setting Class
    dev_class = CLASS_A;
    // Random seed
    randomSeed(analogRead(0));

    // Status
    RFM_Command_Status = NO_RFM_COMMAND;
    Rx_Status = NO_RX;
    Ack_Status = NO_ACK;

    // current channel
    currentChannel = MULTI;

    // Initialise session data struct (Semtech default key)
    memset(Address_Tx, 0x00, 4);
    memset(NwkSKey, 0x00, 16);
    memset(AppSKey, 0x00, 16);
    
    Frame_Counter_Tx = 0x0000;

    Session_Data.NwkSKey = NwkSKey;
    Session_Data.AppSKey = AppSKey;
    Session_Data.DevAddr = Address_Tx;
    Session_Data.Frame_Counter = &Frame_Counter_Tx;

    //Initialize OTAA data struct
    memset(DevEUI, 0x00, 8);
    memset(AppEUI, 0x00, 8);

    memset(AppKey, 0x00, 16);
    memset(DevNonce, 0x00, 2);
    memset(AppNonce, 0x00, 3);
    memset(NetID, 0x00, 3);
    OTAA_Data.DevEUI = DevEUI;
    OTAA_Data.AppEUI = AppEUI;
    OTAA_Data.AppKey = AppKey;
    OTAA_Data.DevNonce = DevNonce;
    OTAA_Data.AppNonce = AppNonce;
    OTAA_Data.NetID = NetID;
    
    // Device Class
    LoRa_Settings.Mote_Class = 0x00; //0x00 is type A, 0x01 is type C
    
    // Rx
#if defined(AS_923)
    LoRa_Settings.Datarate_Rx = 0x02;   //set to SF10 BW 125 kHz
#elif defined(EU_868)
    LoRa_Settings.Datarate_Rx = 0x03;   //set to SF9 BW 125 kHz
#else //US_915 or AU_915
    LoRa_Settings.Datarate_Rx = 0x0C;   //set to SF8 BW 500 kHz
#endif
    LoRa_Settings.Channel_Rx = 0x0A;    // set to recv channel

    // Tx
#if defined(US_915)
    LoRa_Settings.Datarate_Tx = drate_common = 0x02;   //set to SF7 BW 125 kHz
#elif defined(AU_915)
    LoRa_Settings.Datarate_Tx = drate_common = 0x02;   //set to SF7 BW 125 kHz
#else
    LoRa_Settings.Datarate_Tx = drate_common = 0x00;   //set to SF12 BW 125 kHz
#endif
    LoRa_Settings.Channel_Tx = 0x00;    // set to channel 0

    LoRa_Settings.Confirm = 0x00; //0x00 unconfirmed, 0x01 confirmed
    LoRa_Settings.Channel_Hopping = 0x00; //0x00 no channel hopping, 0x01 channel hopping

    // Initialise buffer for data to transmit
    memset(Data_Tx, 0x00, sizeof(Data_Tx));
    Buffer_Tx.Data = Data_Tx;
    Buffer_Tx.Counter = 0x00;
    // Initialise buffer for data to receive
    memset(Data_Rx, 0x00, sizeof(Data_Rx));
    Buffer_Rx.Data = Data_Rx;
    Buffer_Rx.Counter = 0x00;
    Message_Rx.Direction = 0x01; //Set down direction for Rx message
	}
    //Initialize I/O pins
    pinMode(RFM_pins.DIO0,INPUT);
    pinMode(RFM_pins.DIO1,INPUT);
    #ifdef BOARD_DRAGINO_SHIELD
    pinMode(RFM_pins.DIO5,INPUT);
    #endif
    pinMode(RFM_pins.DIO2,INPUT);
    pinMode(RFM_pins.CS,OUTPUT);
    pinMode(RFM_pins.RST,OUTPUT);
    
    digitalWrite(RFM_pins.CS,HIGH);
    
    // Reset
    digitalWrite(RFM_pins.RST,HIGH);
    delay(10);
    digitalWrite(RFM_pins.RST,LOW);
    delay(10);
    digitalWrite(RFM_pins.RST,HIGH);

    //Initialise the SPI port
    SPI.begin();
    
    /*** This prevents the use of other SPI devices with different settings ***/
    //SPI.beginTransaction(SPISettings(4000000,MSBFIRST,SPI_MODE0)); 


    //Wait until RFM module is started
    delay(50);
    
    //Initialize RFM module
    if(!RFM_Init()){
    return 0;
    }
    return 1;
}

Of course, in that case, I also have to change the header file and my own program with

lora.init(false) \\for half reset, or after a light sleep
lora.init(true) \\for full reset

Could you make your library works with light sleep (and maybe deep sleep) ?
Anyways, thanks for your great work

My configuration : Heltec Lora32 v2 (ESP32 + sx1276)

Problem sending messages

Hello!

I have an Atmega328 with RF96. I am using the internal clock with 1 MHz.
I made the configuration with the following pins:

const sRFM_pins RFM_pins = {
.CS = 10,
.RST = 6,
.DIO0 = 9,
.DIO1 = 7,
.DIO2 = 8,
.DIO5 = 0xff,
};

I used a fixed channel, I believe it is as follows:

// Set Data Rate
lora.setDataRate(SF7BW125);

// set channel to random
lora.setChannel(1);

My gateway is configured with SF7 and frequency 903.9.

I'm trying to check the serial output and it doesn't show anything, I don't know why that happens. I'm using an Arduino Uno without the microcontroller to analyze the output.

Thank you very much in advance!

How long is RFM_pins.DIO0 active upon receive?

With out using interrupts the Class C node knows if a downlink is received checking if RFM_pins.DIO0 i high. ¿how long does this pin remain active? I haven't found clear explanation in rfm95 datasheet.

Enabling ADR ( LoRaWAN Adaptive Data Rate)

Hello all, i would like to thank the author of this library it’s supper easy to use without any complexity, so now i have two questions one is instead of setting a specific DataRate like lora.setDataRate(SF8BW125) is there a way we can let a node decided which DataRate is best for it according to the distance between node and Gateway.

My second question is i was checking in the library function but i haven’t seen any way we can put a node into sleep mode without putting the whole microcontroller into sleep mode. Thanks

error:"validate dev-nonce error" have multiple nonce error .. then the device authenticates OK

i have multiple errors if i reset the device and OTAA start again.

error

type:"OTAA"
error:"validate dev-nonce error"
fCnt:0

error

type:"OTAA"
error:"validate dev-nonce error"
fCnt:0

error

type:"OTAA"
error:"validate dev-nonce error"
fCnt:0

after some try/error the device are able to join and get new KEYS.
join
uplink

but..? why the random nonce didnt get randomize everytime, in the LoRa_Send_JoinReq()

**LoRa_Send_JoinReq(sLoRa_OTAA OTAA_Data, sSettings LoRa_Settings)

    //Generate DevNonce
    Generate_DevNonce(OTAA_Data->DevNonce);

why are my new OTAA JoinRequest sending the old nonce? . or do the random generate a value that was already been used?

RFO_PIN and the PA_BOOST_PIN useage reversed ?

I've been working with a RAKwireless RAK4260-Dev board and was not getting the RSSI values at my gateway that I was expecting to see. Finally tried adding this to my sketch:
lora.setTxPower(14,RFO_PIN);
And RSSI value more or less doubles.
I conclusion is RFO_PIN and the PA_BOOST_PIN are configured backward in the BeeLAN_LoRaWAN library.
Other possibility is they are reversed in the RAK4260-Dev board.

MKRWAN 1300

Hello,
This library looks great (and better documented than the MKRWAN library). But do you know what the pin settings are for the MKRWAN 1300 board? This board contains the SX1276 transmitter, but it is build in, and I can't get the library to work on that board

How to check for uplink confirmation?

I am trying to receive an uplink confirmation by setting the confirm flag while running sendUplink. My network server (Chirpstack) acknowledges that it is a confirmed uplink). How do I check in my device code whether the packet has been received? I found the undocumented readAck method but it always returns true, even if I unplug my gateway and I am sure that there is no other gateway around.

I am using the send-class-A-OTAA example modified like this:

void loop() {
  // Check interval overflow
  if(millis() - previousMillis > interval) {
    previousMillis = millis(); 

    sprintf(myStr, "Counter-%d", counter); 

    Serial.print("Sending: ");
    Serial.println(myStr);
    
    // change 1: requesting acknowledgement
    lora.sendUplink(myStr, strlen(myStr), 1, 1);
    counter++;
  }
  
  // change 2: try to get confirmation, always True even if gateway turned off and no messages in the network server
  ackStatus = lora.readAck();
  if (ackStatus) {
    Serial.println("Acknowledged");
  }
  recvStatus = lora.readData(outStr);
  if(recvStatus) {
    Serial.println(outStr);
  }
  
  // Check Lora RX
  lora.update();
}

lora.update(); FSM crash esp8266

The FSM crash my ESP8266

ESP8266 Watchdogs don't like the lora.update();

lora.update();_ <- if active gets:

Sending: Counter-0

Soft WDT reset

>>>stack>>>

ctx: cont
sp: 3ffffd00 end: 3fffffc0 offset: 01b0
3ffffeb0:  3ffee584 3ffee620 3ffee670 40202d1a  
3ffffec0:  00000040 00000000 87179601 fef07463  
3ffffed0:  90716041 3ffe98f3 3ffee508 40206b28  
3ffffee0:  0000038c 4c957f2d 3ffee644 00000000  
3ffffef0:  0000038c 00000000 4c957f2d 5851f42d  
3fffff00:  00000040 00000000 00000000 3ffef401  
3fffff10:  00000001 0000000f 3ffee6b4 98f39071  
3fffff20:  00000000 3ffffec0 00000016 40204240  
3fffff30:  3ffee5cc 3ffee620 3ffee6a0 40202f10  
3fffff40:  00000000 3ffee658 3ffee5d4 402038d4  
3fffff50:  3ffe86d4 00000001 3ffee544 3ffee704  
3fffff60:  00000001 3ffee644 3ffee544 402038a8  
3fffff70:  3ffee670 00000009 3ffee704 3ffee704  
3fffff80:  3ffee53c 3ffee544 3ffee409 402025da  
3fffff90:  3fffdad0 3ffee704 3ffee544 3ffee778  
3fffffa0:  3fffdad0 00000000 3ffee748 40204570  
3fffffb0:  feefeffe feefeffe 3ffe8500 401002a5  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(1,6)


 ets Jan  8 2013,rst cause:4, boot mode:(1,6)

wdt reset

does class a supports otaa

hello,
i am using your example with esp32 and sx1276 i want to know your library supports class c with otaa
thanks and regards
manikandan v

Class C examples

Hi and thanks for the library, I really like the APIs and I'm going to try it for my project.

I'm wondering, is there some specific example for working with Class C devices (EU frequency)?

Confirmed downlink?

Hello,

Using chirpstack, I am unable to get acknowledgement for confirmed downlink requests for Class-C devices. Is this not supported or am I doing something wrong?

Thanks,

Edit: It seems confirmed downlinks are not working for Class-A devices also.

OTAA not working

Hi

I'm using your OTTA example to connect a SX1276+arduino to TTN.
When running the sketch, it loops forever on "Joining..."

At TTN console i see thousands of join requests, it seems the node is flooding the gateway.
Does your library works on OTAA mode?

Encode/Decode

Hi, thanks for your contribution,
Can you tell what encoding are you using? i get unreadable chars on chirpstack! i want to add a chirpstack repo when I finalize this.
If you are around in Copenhagen, lets get that beer 👍

ESP-12F (esp8266) Soft WDT reset try Join

Well it seems that i still have problem when join with OTAA:
ESP-12F with SX1276

const sRFM_pins RFM_pins = {
  .CS = 15,
  .RST = -1,
  .DIO0 = 5,
  .DIO1 = 4,
  .DIO2 = -1,
  .DIO5 = -1,
};

Serial.print() give:

load 0x4010f000, len 3584, room 16 
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld
Joining...

ESP reset and try to join again

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

>>>stack>>>

ctx: cont
sp: 3ffffd20 end: 3fffffc0 offset: 01a0
3ffffec0:  3ffee5ec 3ffee560 3ffee604 402022c9  
3ffffed0:  3ffee5ec 3ffee560 3ffee5b4 40201d50  
3ffffee0:  3fffff3c 00000005 3ffee604 402023e3  
3ffffef0:  00000000 4bc6a7f0 eccccccc 00000000  
3fffff00:  00000000 00000000 4bc6a7f0 00000000  
3fffff10:  3ffe878e 00000000 40100200 00001fc0  
3fffff20:  3ffffee0 00000000 00000000 00000000  
3fffff30:  0024b711 654c8000 3f346068 3fffff24  
3fffff40:  00000017 3ffee668 3ffe878c 00000000  
3fffff50:  3ffee604 3ffee5ec 3ffee4d8 402028aa  
3fffff60:  00001510 3ffee560 3ffee5b4 4020308c  
3fffff70:  3ffee668 3ffee668 3ffee668 3ffe861c  
3fffff80:  3ffee668 3ffee668 3ffee4d8 402010fb  
3fffff90:  feefeffe feefeffe feefeffe 3ffee6d4  
3fffffa0:  3fffdad0 00000000 3ffee694 40203804  
3fffffb0:  feefeffe feefeffe 3ffe84ec 40100c29  
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

i use example scketch

 *  Test in all frequencies of US_915 band
 *      Using SUB BAND 1 [ 903.9 - 905.3 Mhz] see config.h
 *      channel [0 - 7]
 *      data rate [0 - 3]
 *  Class A and C devices with OTAA activation

samR34 xplained pro + IN865 + OTAA + CLASS A

Hi,
I am currently working on samR34 xplained pro LoRa shield . I need to be work in IN865 with OTAA Class A.
I have seen that you have worked on few Bands. Is it possible to have IN865 BAND update. or please guide to do

What are all the changes need to be taken to implement this IN865 band to work with OTAA CLASS A concept

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.