Skip to content

Does the library supports class C LoRaWAN device?Β #43

@javier-alvarez-ctic

Description

@javier-alvarez-ctic

Question:

We have a question about the functionality of the library: does it support Class C LoRaWAN devices? Specifically, we want to develop an Arduino MKRWAN1310 as a listener device.

When we configure the Arduino as a Class A device, everything works correctly. The device can send a message and successfully receive the response from a ChirpStack Server.

Expected Behavior:

We want to configure the Arduino as a Class C device to operate as a receiver instead of a sender. We attempted this using the following code (based on the LoraSendAndReceive example).

The Arduino was configured as a Class C device in the ChirpStack platform, and the firmware was uploaded using the code below.

#include <MKRWAN_v2.h>

LoRaModem modem;

// . . .

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  while (!Serial);
  // change this to your regional band (eg. US915, AS923, ...)
  if (!modem.begin(EU868)) {
    Serial.println("Failed to start module");
    while (1) {}
  };
  Serial.print("Your module version is: ");
  Serial.println(modem.version());
  Serial.print("Your device EUI is: ");
  Serial.println(modem.deviceEUI());
  
  modem.configureClass(CLASS_C); // We think that this line does nothing
  
  int connected = modem.joinOTAA(appEui, appKey);
  if (!connected) {
    Serial.println("Something went wrong; are you indoor? Move near a window and retry");
    while (1) {}
  }

  // Set poll interval to 60 secs.
  modem.minPollInterval(60);
  // NOTE: independently by this setting the modem will
  // not allow to send more than one message every 2 minutes,
  // this is enforced by firmware and can not be changed.

 }

void loop() {
  if (!modem.available()) {
    // Serial.println("No downlink message received at this time.");
    return;
  }
  char rcv[64];
  int i = 0;
  while (modem.available()) {
    rcv[i++] = (char)modem.read();
  }
  Serial.print("Received: ");
  for (unsigned int j = 0; j < i; j++) {
    Serial.print(rcv[j] >> 4, HEX);
    Serial.print(rcv[j] & 0xF, HEX);
    Serial.print(" ");
  }
  Serial.println();
  delay(10000);
}

However, the device cannot receive messages from ChirpStack.

Returns:

No downlink message received at this time
No downlink message received at this time
...

System

  • Arduino MKRWAN 1310 (OTAA Auth)
  • Library MKRWAN_V2 1.3.2
  • Chirpstack 4.0.2V
  • Arduino IDE 2.3.2V

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: documentationRelated to documentation for the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions