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 1 of 1   [ 5 posts ]
Author Message
 Post subject: Can not comunicate between SX1272 LoRa module for Arduino
PostPosted: Wed May 03, 2017 1:22 pm 

Joined: Wed Apr 26, 2017 10:26 am
Posts: 4
Hi,

I'm trying to communicate between the between SX1272 LoRa module for Arduino and the Waspmote Gateway SX1272 LoR.

I'm using the following code
Code:
/* 
 *  LoRa 868 / 915MHz SX1272 LoRa module
 * 
 *  Copyright (C) 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.1
 *  Design:            David Gascón
 *  Implementation:    Covadonga Albiñana & Victor Boria
 */
 
// Include the SX1272 and SPI library:
#include "SX1272.h"
#include <SPI.h>

int e;

char message1 [] = "Packet 1, wanting to see if received packet is the same as sent packet";
char message2 [] = "Packet 2, broadcast test";

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
 
  // Print a start message
  Serial.println(F("SX1272 module and Arduino: send packets with ACK"));
 
  // Power ON the module
  e = sx1272.ON();
  Serial.print(F("Setting power ON: state "));
  Serial.println(e, DEC);
 
  // Set transmission mode and print the result
  e = sx1272.setMode(4);
  Serial.print(F("Setting Mode: state "));
  Serial.println(e, DEC);
 
  // Set header
  e = sx1272.setHeaderON();
  Serial.print(F("Setting Header ON: state "));
  Serial.println(e, DEC);
 
  // Select frequency channel
  e = sx1272.setChannel(CH_13_868);
  Serial.print(F("Setting Channel: state "));
  Serial.println(e, DEC);
 
  // Set CRC
  e = sx1272.setCRC_ON();
  Serial.print(F("Setting CRC ON: state "));
  Serial.println(e, DEC);
 
  // Select output power (Max, High or Low)
  e = sx1272.setPower('H');
  Serial.print(F("Setting Power: state "));
  Serial.println(e, DEC);
 
  // Set the node address and print the result
  e = sx1272.setNodeAddress(3);
  Serial.print(F("Setting node address: state "));
  Serial.println(e, DEC);
 
  // Print a success message
  Serial.println(F("SX1272 successfully configured"));
  Serial.println();
}

void loop(void)
{
  // Send message1 and print the result
  e = sx1272.sendPacketTimeoutACK(8, message1);
  Serial.print(F("Packet sent, state "));
  Serial.println(e, DEC);

  delay(4000); 

  // Send message2 broadcast and print the result
  e = sx1272.sendPacketTimeoutACK(0, message2);
  Serial.print(F("Packet sent, state "));
  Serial.println(e, DEC);

  delay(4000); 
}


but I keep receiving this

SX1272 module and Arduino: send packets with ACK
Setting power ON: state 0
Setting Mode: state 0
Setting Header ON: state 0
Setting Channel: state 0
Setting CRC ON: state 0
Setting Power: state 0
Setting node address: state 0
SX1272 successfully configured

Packet sent, state 3
Packet sent, state 3
Packet sent, state 3
Packet sent, state 3


Top
 Profile  
 
 Post subject: Re: Can not comunicate between SX1272 LoRa module for Arduin
PostPosted: Thu May 04, 2017 7:40 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello filmon,
as you can see in the sendPacketTimeoutACK() method header in the "arduinoLoRa.c" file:
Code:
/*
 Function: Configures the module to transmit information and receive an ACK.
 Returns: Integer that determines if there has been any error
   state = 3  --> Packet has been sent but ACK has not been received
   state = 2  --> The command has not been executed
   state = 1  --> There has been an error while executing the command
   state = 0  --> The command has been executed with no errors
*/
uint8_t SX1272::sendPacketTimeoutACK(uint8_t dest, char *payload)
{[..]}


Your packet has been sent correctly, but not ACK received.
To send packets without ACK use the sendPacketTimeout() method.
You can use the examples provided with the library as reference.

Regards


Top
 Profile  
 
 Post subject: Re: Can not comunicate between SX1272 LoRa module for Arduin
PostPosted: Thu May 04, 2017 8:29 am 

Joined: Wed Apr 26, 2017 10:26 am
Posts: 4
Hi,

Okay thank you.

But I dont really understand how I'm suppose to send something with the Gateway SX1272 to my Arduino, which has a multiprotocol radio shield + lora sx1272 RF.

I put the code "sx_01a_tx_lora"

Regards


Top
 Profile  
 
 Post subject: How can I find the state
PostPosted: Thu May 04, 2017 10:50 am 

Joined: Wed Apr 26, 2017 10:26 am
Posts: 4
Hi,

I'm using the Gateway LoRa SX1272 and I keep receiving the message :

"Error sending the packet.state: 9"

Regards


Top
 Profile  
 
 Post subject: Re: Can not comunicate between SX1272 LoRa module for Arduin
PostPosted: Fri May 05, 2017 7:37 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello filmon,

Take a view to our tutorials; for SX1272 in Arduino:
https://www.cooking-hacks.com/documenta ... el-galileo
download install the library and test the basic examples provided with the library.

And for the gateway:
http://www.libelium.com/development/was ... -tutorial/

Here you have got examples of usage and configuration.

Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


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:


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.