SODAQ Autonomy with the Libelium SX1271

Dear SODAQ,

I’m trying to get the SODAQ autonomy working with the libelium lora module sx1272. I’ve been trying for some time to get this working but have not succeeded.

I have tried the follow sketch from libelium (code below). It says ‘unrecognised transceiver’. Have you got any ideas why this is not working? I tried to check if the SPI pinout of the libelium matches with autonomo, and seem fine.

I’m using the 1.6.9 arduino IDE, but I’m sure it makes no difference which version I am using. The libelium module is place with the antenna hanging over the end of the board (rather than the antenna being sitting over the chip).

Thanks so much for your help.

Joel

/*

  • LoRa 868 / 915MHz SX1272 LoRa module
  • Copyright © 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:
#define beePin BEE_VCC
#define debugSerial Serial

#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:
while (!SerialUSB) {
debugSerial.begin(57600);
}
digitalWrite(beePin, HIGH);
delay(2000);

// Print a start message
SerialUSB.println(F(“SX1272 module and Arduino: send packets without ACK”));

// Power ON the module
e = sx1272.ON();
SerialUSB.print(F("Setting power ON: state "));
SerialUSB.println(e, DEC);

// Set transmission mode and print the result
e = sx1272.setMode(4);
SerialUSB.print(F("Setting Mode: state "));
SerialUSB.println(e, DEC);

// Set header
e = sx1272.setHeaderON();
SerialUSB.print(F("Setting Header ON: state "));
SerialUSB.println(e, DEC);

// Select frequency channel
e = sx1272.setChannel(CH_10_868);
SerialUSB.print(F("Setting Channel: state "));
SerialUSB.println(e, DEC);

// Set CRC
e = sx1272.setCRC_ON();
SerialUSB.print(F("Setting CRC ON: state "));
SerialUSB.println(e, DEC);

// Select output power (Max, High or Low)
e = sx1272.setPower(‘H’);
SerialUSB.print(F("Setting Power: state "));
SerialUSB.println(e, DEC);

// Set the node address and print the result
e = sx1272.setNodeAddress(3);
SerialUSB.print(F("Setting node address: state "));
SerialUSB.println(e, DEC);

// Print a success message
SerialUSB.println(F(“SX1272 successfully configured”));
SerialUSB.println();
}

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

delay(4000);

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

delay(4000);
}

Could provide a link to the specific hardware component you are using, and also one to the library.

Hi Gabriel,

The hardware I am using is: http://shop.sodaq.com/en/sodaq-autonomo.html

The library is: https://github.com/CongducPham/LowCostLoRaGw/tree/master/Arduino/libraries/SX1272

Thanks!

Joel

Is this the LoRa module you are trying to use?
https://www.cooking-hacks.com/sx1272-lora-module-for-arduino-raspberry-pi-intel-galileo-868-mhz

yes it is that one. Sorry I should have included that.

It appears that module uses SPI. The BEE socket on the Autonomo only supports Serial/UART.

My confusion. I assumed the SPI pins were broken out, but that would explain it!

Are the SPI broken out to any of the other pins on the Autonomo?

Thanks for your help

Joel

I’m looking at the headers on: http://support.sodaq.com/wp-content/uploads/2016/02/sodaq_autonomo_rev3_sch_v1.png

but cannot see a reference to MOSI etc - are they pins 10,11,12 & 13 as you would expect on the Uno?

SPI isn’t actually available on the headers pins of the Autonomo.

However, there is a sub-variant you can compile for which adds a second SPI bus (see the board list “Autonomo with SPI1”).

The pins are as follows:

  • D5: MISO1
  • D6: CS1 You can use any IO pin for CS
  • D7: MOSI1
  • D8: SCK1

You will need to modify the library as it uses the global instance SPI, you will need to change that to SPI1.

Also, it currently sends any debug output to Serial. You can use that if you like, however, you will need to attach something to D0/D1 to catch the output. Alternatively, you could modify it to use SerialUSB.

Both of these changes could be done with a definition in the header file to allow for ease modification in the future.

e.g.

#define SPI_BUS SPI1
#define DEBUG_SERIAL SerialUSB

Then modify the references with the library to use SPI_BUS and DEBUG_SERIAL.