Need help in running gnrc_lorawan with arduino mega2560

Hello Riot Users,

I need small help in running the lorawan example gnrc_lorawan over arduino mega2560. I have connected the arduino with LORA SHIELD FOR ARDUINO SX1276. I tried the example program which is located in RIOT/examples/gnrc_lorawan by setting the location to IN865. The program flashed correctly, but ifconfig command doesn’t show any interface. So, I am not able to get the interface pid and could not join the lorawan network.

What might be the problem?

Thanks in advance

Pavan

Did you enable the driver module?

USEMODULE += sx127x

You will likely also have to specify which Pins to use to connect the module, see sx127x_params.h - those are the defaults that you want to overwrite with that is required for your board.

Hi benpicco, thanks for your reply.

Yes, I have enabled the lora driver module.

USEMODULE += sx127x

Also, I have overwritten the default pins to that of DRAGINO LoRa shield v1.4 pinout.

But still I get the same result. The ifconfig command doesn’t show any interface.

What might be the problem?

Just including “MODULE_SX127X” is not enough, because the driver does not know which variant the device is. You need to include the corresponding device driver. In your case:

USEMODULE += sx1276

Hope this helps.

Yes, I have included the correct module.

USEMODULE += sx1276

But still getting the same output.

Could you please enable DEBUG in the SX127X related files…

diff --git a/drivers/sx127x/sx127x.c b/drivers/sx127x/sx127x.c
index 3d8e5b06e7..4c1d126520 100644
--- a/drivers/sx127x/sx127x.c
+++ b/drivers/sx127x/sx127x.c
@@ -41,7 +41,7 @@
 #include "sx127x_registers.h"
 #include "sx127x_netdev.h"
 
-#define ENABLE_DEBUG 0
+#define ENABLE_DEBUG 1
 #include "debug.h"
 
 /* The reset signal must be applied for at least 100 µs to trigger the manual
diff --git a/drivers/sx127x/sx127x_getset.c b/drivers/sx127x/sx127x_getset.c
index feba720ec0..ad49ee1396 100644
--- a/drivers/sx127x/sx127x_getset.c
+++ b/drivers/sx127x/sx127x_getset.c
@@ -34,7 +34,7 @@
 #include "sx127x_registers.h"
 #include "sx127x_internal.h"
 
-#define ENABLE_DEBUG 0
+#define ENABLE_DEBUG 1
 #include "debug.h"
 
 uint8_t sx127x_get_state(const sx127x_t *dev)
diff --git a/drivers/sx127x/sx127x_internal.c b/drivers/sx127x/sx127x_internal.c
index d3b86b40ae..f64703b120 100644
--- a/drivers/sx127x/sx127x_internal.c
+++ b/drivers/sx127x/sx127x_internal.c
@@ -34,7 +34,7 @@
 #include "sx127x_internal.h"
 #include "sx127x_params.h"
 
-#define ENABLE_DEBUG 0
+#define ENABLE_DEBUG 1
 #include "debug.h"
 
 #define SX127X_SPI_SPEED    (SPI_CLK_1MHZ)
diff --git a/drivers/sx127x/sx127x_netdev.c b/drivers/sx127x/sx127x_netdev.c
index 9114caa0d6..bbce2bfeb5 100644
--- a/drivers/sx127x/sx127x_netdev.c
+++ b/drivers/sx127x/sx127x_netdev.c
@@ -34,7 +34,7 @@
 #include "sx127x_netdev.h"
 #include "sx127x.h"
 
-#define ENABLE_DEBUG 0
+#define ENABLE_DEBUG 1
 #include "debug.h"
 
 /* Internal helper functions */

-… and post the results back? That should indicate what’s going on

This is the output I got after enabling DEBUG:

The initialization fails because the SPI instruction returns zero (when trying to read the version number). This occurs when the SPI connection is not set properly, either because of wrong configuration or wrong connection.

Could you double check that the arduino pins are being resolved to the corresponding CPU pin for your platform?