Libelium is offering new technical support channels, to contact with de Technical Support team to solve any issue our doubt please contact with your sales agent or visit our contact site



Post a new topicPost a reply Page 2 of 2   [ 17 posts ]
Go to page Previous  1, 2
Author Message
 Post subject: Re: LoraWAN Module Not Saving
PostPosted: Tue Sep 05, 2017 7:46 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi brandon,

We use the last version of the library (v1.3):

http://www.cooking-hacks.com/media/cook ... o_v1_3.zip

An the examples available on this library, we haven't got more codes.

Please, put the DEBUG to 0. We recommend to use this function with other boards but not with this combination of LoraWan + Arduino UNO. That's why we don't mentioned it in the tutorial.

We are using Arduino UNO R3 and Arduino IDE 1.8.3. and the examples with DEBUG=0 are sending the data to the gateway correctly.

Regards


Top
 Profile  
 
 Post subject: Re: LoraWAN Module Not Saving
PostPosted: Tue Sep 05, 2017 12:05 pm 

Joined: Tue Aug 22, 2017 12:59 pm
Posts: 9
Hi there,

I downloaded the code you provided and ran it as is with DEBUG=0. It could not join the network:

http://i.imgur.com/KRZkSo2.png

I confirmed the appeui and appkey have been configured on the gateway.

If I modify the code so it prints the output value of the LoRaWAN.joinOTAA() call, it prints "1":

http://i.imgur.com/eQGYQ5W.png

That equates to "invalid_param" in the library:

http://i.imgur.com/wAHiR1J.png

That shows it's not even starting to attempt to join the network, it's a failure to execute the command on the module. I strongly believe this is due to a lack of memory.

Can you tell me if you get this warning in your Arduino IDE:

http://i.imgur.com/ntJ0F5y.png

I'm happy to demonstrate that modifying the code to reduce the memory requirement allows the commands to complete successfully. When that happens, I no longer get a "invalid_param" error, but a "keys_not_init" error instead. And that leads back to my original problem where it appears the EUI and key values do not seem to save to the module.

I don't know why the code provided works for you, but not for me. But jmueller in his post has the same problem.

Thanks,
Brandon


Top
 Profile  
 
 Post subject: Re: LoraWAN Module Not Saving
PostPosted: Wed Sep 06, 2017 8:40 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi brandon,

I'm trying to reproduce your error, and I can't... :( :( :( :( :(

brandon wrote:
If I modify the code so it prints the output value of the LoRaWAN.joinOTAA() call, it prints "1":

http://i.imgur.com/eQGYQ5W.png

That equates to "invalid_param" in the library:

http://i.imgur.com/wAHiR1J.png


I have tried to do this, I print the "status" of the "joinOTAA()" function:

libelium_files/lorawan_cpp.png

And here you have got the Serial monitor output:

libelium_files/Serial_monitor.png

An here the information that I have received in the gateway:

libelium_files/loriot_gateway.png

brandon wrote:
Can you tell me if you get this warning in your Arduino IDE:

http://i.imgur.com/ntJ0F5y.png


Yes, I have the same warning in my Arduino IDE:
libelium_files/ide_memory.png

brandon wrote:
I'm happy to demonstrate that modifying the code to reduce the memory requirement allows the commands to complete successfully. When that happens, I no longer get a "invalid_param" error, but a "keys_not_init" error instead. And that leads back to my original problem where it appears the EUI and key values do not seem to save to the module.


Yes, it's true that the memory in the Arduino UNO is limited to develop some projects (that's why sometimes we recommend to use Arduino MEGA). But it is very strange that you can't use the examples, because they are developed with Arduino UNO and I am testing them.

I have tried reducing the memory, and It works for me. If you want you can try. In the arduinoLoRaWAN.h I have modified some variables (just to try):

Code:
    // public methods //////////////////////////
    public:
        bool _adr;
        char _eui[8];
        char _devEUI[8];
        char _appEUI[8];
        char _nwkSKey[15];
        char _appSKey[15];
        char _appKey[15];
        char _devAddr[6];
        char _band[4];
        uint8_t _retries;
        uint8_t _margin;
        uint8_t _gwNumber;
        uint32_t _freq[16];
        uint32_t _radioFreq;
        uint32_t _radioFreqDev;
        uint16_t _preambleLength;
        uint16_t _dCycle[16];
        uint8_t _drrMin[72];
        uint8_t _drrMax[72];
        uint8_t _dCyclePS;
        char _radioMode[5];
        bool _crcStatus;
        uint8_t _powerIndex;
        uint8_t _dataRate;
        int8_t _radioPower;
        char _radioSF[5];
        float _radioRxBW;
        uint32_t _radioBitRate;
        char _radioCR[4];
        uint32_t _radioWDT;
        uint16_t _radioBW;
        int8_t _radioSNR;
        bool _status[72];
        uint16_t _supplyPower;
        uint32_t _upCounter;
        uint32_t _downCounter;
        uint8_t _port;
        char _data[101];
        bool _dataReceived;
        uint8_t _rx2DataRate;
        uint32_t _rx2Frequency;
        uint16_t _rx1Delay;
        uint8_t _version;


I have compiled this code:
Code:
/* 
 *  ------ LoRaWAN Code Example --------
 * 
 *  Explanation: This example shows how to configure the module and
 *  send packets to a LoRaWAN gateway without ACK after join a network
 *  using OTAA
 * 
 *  Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
 *  http://www.libelium.com
 * 
 *  This program is free software: you can redistribute it and/or modify 
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or 
 *  (at your option) any later version. 
 *   
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU General Public License for more details. 
 *   
 *  You should have received a copy of the GNU General Public License 
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 * 
 *  Version:           1.3
 *  Design:            David Gascon
 *  Implementation:    Luismi Marti
 *  Ported to Arduino: Ruben Martin
 */

#include <Wire.h>

// Cooking API libraries
#include <arduinoUART.h>
#include <arduinoUtils.h>

// LoRaWAN library
#include <arduinoLoRaWAN.h>

//////////////////////////////////////////////
uint8_t socket = SOCKET1;
//////////////////////////////////////////////

// Device parameters for Back-End registration
////////////////////////////////////////////////////////////
char DEVICE_EUI[]  = "BE7A000000001824";
char APP_EUI[] = "BE7A000000000C57";
char APP_KEY[] = "F9661139A76FFAF8A5CFDD990095F8D2";
////////////////////////////////////////////////////////////

// Define port to use in Back-End: from 1 to 223
uint8_t PORT = 3;

// Define data payload to send (maximum is up to data rate)
char data[] = "0102030405060708090A0B0C0D0E0F";

// variable
uint8_t error;


void setup()
{
  //LoRaWAN example - Send Unconfirmed packets (no ACK)

  //------------------------------------
  //Module configuration
  //------------------------------------

  //////////////////////////////////////////////
  // 1. Switch on
  //////////////////////////////////////////////
  error = LoRaWAN.ON(socket);

  //////////////////////////////////////////////
  // 2. Set Device EUI
  //////////////////////////////////////////////
  error = LoRaWAN.setDeviceEUI(DEVICE_EUI);

  //////////////////////////////////////////////
  // 3. Set Application EUI
  //////////////////////////////////////////////
  error = LoRaWAN.setAppEUI(APP_EUI);

  //////////////////////////////////////////////
  // 4. Set Application Session Key
  //////////////////////////////////////////////
  error = LoRaWAN.setAppKey(APP_KEY);

  //////////////////////////////////////////////
  // 6. Save configuration
  //////////////////////////////////////////////
  error = LoRaWAN.saveConfig();
}


void loop()
{

  //////////////////////////////////////////////
  // 1. Switch on
  //////////////////////////////////////////////
  error = LoRaWAN.ON(socket);

  //////////////////////////////////////////////
  // 2. Join network
  //////////////////////////////////////////////
  error = LoRaWAN.joinOTAA();

  //////////////////////////////////////////////
  // 3. Send unconfirmed packet
  //////////////////////////////////////////////
  error = LoRaWAN.sendUnconfirmed(PORT, data);



  //////////////////////////////////////////////
  // 4. Switch off
  //////////////////////////////////////////////
  error = LoRaWAN.OFF(socket);

  delay(10000);
}


Then, with this, I have not memory problems:
libelium_files/ide_memory_2.png

And it works again for me. What about if you try this? It is not a very "professional" solution but I want to help you...

Thanks.

Regards.


Top
 Profile  
 
 Post subject: Re: LoraWAN Module Not Saving
PostPosted: Fri Sep 08, 2017 2:26 pm 

Joined: Tue Aug 22, 2017 12:59 pm
Posts: 9
Hi there,

I managed to find and fix the problem with help in part by the code you shared in your last post. It turns out I was unintentionally cutting power to the module after every command which meant that anything set in that command was never saved. Your last code helped me to see that.

Many thanks for your help. It is greatly appreciated. :)


Top
 Profile  
 
 Post subject: Re: LoraWAN Module Not Saving
PostPosted: Mon Sep 11, 2017 7:02 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi brandon,

brandon wrote:
I managed to find and fix the problem with help in part by the code you shared in your last post. It turns out I was unintentionally cutting power to the module after every command which meant that anything set in that command was never saved. Your last code helped me to see that.


They are the best news that I can read on a Monday morning :D :D :D

Good luck with your project!

Regards


Top
 Profile  
 
 Post subject: Re: LoraWAN Module Not Saving
PostPosted: Fri Oct 20, 2017 5:06 am 

Joined: Fri Oct 20, 2017 4:56 am
Posts: 1
brandon wrote:
Hi there,

I managed to find and fix the problem with help in part by the code you shared in your last post. It turns out I was unintentionally cutting power to the module after every command which meant that anything set in that command was never saved. Your last code helped me to see that.

Many thanks for your help. It is greatly appreciated. :)


Hi Brandon,

can you explained more about what you do to fix these? I've got the same problem as yours.

Thanks, look forward for your feedback
Angga


Top
 Profile  
 
 Post subject: Re: LoraWAN Module Not Saving
PostPosted: Fri Oct 20, 2017 7:06 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi maglev,

Please open a personal post with more info to give you a better support. Tell us the product that you are using, the code, some photos...

Thanks.

Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 2 of 2   [ 17 posts ]
Go to page Previous  1, 2


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.