SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
User avatar
By amnth
#227277
I am trying to run examples provided by RadioLib LoRa library as it has built-in supports the Artemis Arduino Core.
However all the examples are failing to initialize the Radio.

I am using RadioLib at version 4.4.2: https://github.com/jgromes/RadioLib
I've loaded the SX126x_Transmit.ino as an example.
Code: Select all
// SX1262 has the following connections:
// NSS pin:   10
// DIO1 pin:  2
// NRST pin:  3
// BUSY pin:  9
SX1262 radio = new Module(10, 2, 3, 9);
Code: Select all
void setup() {
  Serial.begin(9600);

  // initialize SX1262 with default settings
  Serial.print(F("[SX1262] Initializing ... "));
  int state = radio.begin();
  if (state == ERR_NONE) {
    Serial.println(F("success!"));
  } else {
    Serial.print(F("failed, code "));
    Serial.println(state);
    while (true);
  }

  // some modules have an external RF switch
  // controlled via two pins (RX enable, TX enable)
  // to enable automatic control of the switch,
  // call the following method
  // RX enable:   4
  // TX enable:   5
  /*
    radio.setRfSwitchPins(4, 5);
  */
}
The example is failing when radio.begin() is called.
Code: Select all
08:21:28.477 -> [SX1262] Initializing ... failed, code -2
Code: Select all
/*!
  \brief Radio chip was not found during initialization. This can be caused by specifying wrong chip type in the constructor
  (i.e. calling SX1272 constructor for SX1278 chip) or by a fault in your wiring (incorrect slave select pin).
*/
#define ERR_CHIP_NOT_FOUND                            -2
Has anyone attempted to use LoRa RadioLib to do peer-to-peer LoRa transmission?
User avatar
By Santa_Impersonator
#229622
Previously, users had to download the modified library and use our example code:
  • I just updated the hookup guide to make it more obvious that users needed to use our example code
  • Following the suggestions from the pull request, I have updated the example code and instructions in the hookup guide, so that users can use the default RadioLib library
This should be more straight forward for users, as long as they use our example code.
User avatar
By new_guy
#230008
The example code does not compile on the LoRa Thing Plus with Apollo3 2.1.1 and RadioLib 5.0.0. This is the example file I'm referring to: https://cdn.sparkfun.com/assets/learn_t ... evised.ino

Output:
Code: Select all
Arduino: 1.8.13 (Linux), Board: "LoRa Thing Plus expLoRaBLE, 460800, SparkFun Variable Loader (Recommended)"











WARNING: Category '' in library BurstMode is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library WDT is not valid. Setting to 'Uncategorized'
sketch_dec06c:27:51: error: no matching function for call to 'Module::Module(PinName, PinName, PinName, PinName, arduino::MbedSPI&)'
 SX1262 radio = new Module(D36, D40, D44, D39, SPI1);
                                                   ^
In file included from ../libraries/RadioLib/src/RadioLib.h:38,
                 from /tmp/arduino_modified_sketch_928642/sketch_dec06c.ino:20:
../libraries/RadioLib/src/Module.h:73:5: note: candidate: 'Module::Module(const Module&)'
     Module(const Module& mod);
     ^~~~~~
../libraries/RadioLib/src/Module.h:73:5: note:   candidate expects 1 argument, 5 provided
In file included from ../libraries/RadioLib/src/RadioLib.h:38,
                 from /tmp/arduino_modified_sketch_928642/sketch_dec06c.ino:20:
../libraries/RadioLib/src/Module.h:49:5: note: candidate: 'Module::Module(pin_size_t, pin_size_t, pin_size_t, pin_size_t, arduino::SPIClass&, arduino::SPISettings)'
     Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio, SPIClass& spi, SPISettings spiSettings);
     ^~~~~~
../libraries/RadioLib/src/Module.h:49:5: note:   candidate expects 6 arguments, 5 provided
../libraries/RadioLib/src/Module.h:32:5: note: candidate: 'Module::Module(pin_size_t, pin_size_t, pin_size_t, pin_size_t)'
     Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio = RADIOLIB_NC);
     ^~~~~~
../libraries/RadioLib/src/Module.h:32:5: note:   candidate expects 4 arguments, 5 provided
/tmp/arduino_modified_sketch_928642/sketch_dec06c.ino: In function 'void setup()':
sketch_dec06c:40:16: error: 'ERR_NONE' was not declared in this scope
   if (state == ERR_NONE) {
                ^~~~~~~~
/tmp/arduino_modified_sketch_928642/sketch_dec06c.ino:40:16: note: suggested alternative: 'IRQ_NONE'
   if (state == ERR_NONE) {
                ^~~~~~~~
                IRQ_NONE
/tmp/arduino_modified_sketch_928642/sketch_dec06c.ino: In function 'void loop()':
sketch_dec06c:75:16: error: 'ERR_NONE' was not declared in this scope
   if (state == ERR_NONE) {
                ^~~~~~~~
/tmp/arduino_modified_sketch_928642/sketch_dec06c.ino:75:16: note: suggested alternative: 'IRQ_NONE'
   if (state == ERR_NONE) {
                ^~~~~~~~
                IRQ_NONE
sketch_dec06c:84:23: error: 'ERR_PACKET_TOO_LONG' was not declared in this scope
   } else if (state == ERR_PACKET_TOO_LONG) {
                       ^~~~~~~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_928642/sketch_dec06c.ino:84:23: note: suggested alternative: 'ENAMETOOLONG'
   } else if (state == ERR_PACKET_TOO_LONG) {
                       ^~~~~~~~~~~~~~~~~~~
                       ENAMETOOLONG
sketch_dec06c:88:23: error: 'ERR_TX_TIMEOUT' was not declared in this scope
   } else if (state == ERR_TX_TIMEOUT) {
                       ^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_928642/sketch_dec06c.ino:88:23: note: suggested alternative: 'AP3_TIMEOUT'
   } else if (state == ERR_TX_TIMEOUT) {
                       ^~~~~~~~~~~~~~
                       AP3_TIMEOUT
exit status 1
no matching function for call to 'Module::Module(PinName, PinName, PinName, PinName, arduino::MbedSPI&)'


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
User avatar
By Santa_Impersonator
#230097
Revert to the RadioLib library version 4.6.0

It looks like Jan (who maintains the library) made some significant changes in the latest release (see the release notes of the GitHub repo). Unfortunately, I'm a little too busy too look into the library changes and find a work around. If you really need to use the latest library; it'd probably be best to file an issue in the GitHub repo and work with Jan to debug the issue. However, reverting to version 4.6.0 of the Arduino library is probably the simplest solution.
 Topic permissions

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