Rak11720 Class C Device not Receiving Downlink Messages

I would like to set my device in Class C mode, I’m able to send uplink messages to my WisGate (rak7268v2) device. Here’s the end-device configuration:

I want to first try sending unicast messages to class C devices and then multicast messages, but able to do neither form of downlink, the device is using DR=2:


void recvCallback(SERVICE_LORA_RECEIVE_T * data) {
    if (data->BufferSize > 0) {
        Serial.println("Something received!");
        for (int i = 0; i < data->BufferSize; i++) {
            Serial.printf("%x", data->Buffer[i]);
        }
        Serial.print("\r\n");
    }
}

void setup()
{
    Serial.begin(115200);
    delay(2000);
  
    Serial.println("RAKwireless LoRaWan Multicast Example");
    Serial.println("------------------------------------------------------");

    if(api.lorawan.nwm.get() != 1)
    {
        Serial.printf("Set Node device work mode %s\r\n",
            api.lorawan.nwm.set() ? "Success" : "Fail");
        api.system.reboot();
    }

    // OTAA Device EUI MSB
    uint8_t node_device_eui[8] =
        { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x88 };
    // OTAA Application EUI MSB
    uint8_t node_app_eui[8] =
        { 0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x0F };
    // OTAA Application Key MSB
    uint8_t node_app_key[16] =
        { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15,
        0x88, 0x09, 0xCF, 0x4F, 0x3E };
  
    /**LoRaWan Multicast Session*/
  
    uint8_t node_mc_address[4] = { 0x01, 0x02, 0x03, 0x04 };
    uint8_t node_mc_AppSKey[16] =
        { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03,
        0x04, 0x05, 0x06, 0x07, 0x08 };
    uint8_t node_mc_NwkSKey[16] =
        { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03,
        0x04, 0x05, 0x06, 0x07, 0x08 };
  
    // RAK_LORA_McSession session = {
    //     .McDevclass = 2,
    //     .McAddress =
  	//         node_mc_address[0] << 24 | node_mc_address[1] << 16 |
  	//         node_mc_address[2] << 8 | node_mc_address[3],
    //     .McFrequency = 923000000,
    //     .McDatarate = 2,
    //     .McPeriodicity = 0,
    //     .McGroupID = 2,
    //     .entry = 0,
    // };
    // memcpy(session.McAppSKey, node_mc_AppSKey, 16);
    // memcpy(session.McNwkSKey, node_mc_NwkSKey, 16);
  
    if (!(ret = api.lorawan.appeui.set(node_app_eui, 8))) {
        Serial.printf("LoRaWan Multicast - set device EUI is incorrect! \r\n");
        return;
    }
    if (!(ret = api.lorawan.appkey.set(node_app_key, 16))) {
        Serial.printf("LoRaWan Multicast - set application EUI is incorrect! \r\n");
        return;
    }
    if (!(ret = api.lorawan.deui.set(node_device_eui, 8))) {
        Serial.printf("LoRaWan Multicast - set application key is incorrect! \r\n");
        return;
    }
    /*************************************
     *
     * LoRaWAN band setting:
     *   EU433: 0
     *   CN470: 1
     *   RU864: 2
     *   IN865: 3
     *   EU868: 4
     *   US915: 5
     *   AU915: 6
     *   KR920: 7
     *   AS923: 8
     *
     * ************************************/
  
    if (!(ret = api.lorawan.band.set(8))) {
        Serial.printf("LoRaWan Multicast - set band is incorrect! \r\n");
        return;
    }
    if (!(ret = api.lorawan.njm.set(RAK_LORA_OTAA))) {
        Serial.printf("LoRaWan Multicast - set network join mode is incorrect! \r\n");
        return;
    }
    if (!(ret = api.lorawan.deviceClass.set(RAK_LORA_CLASS_C))) {
        Serial.printf("LoRaWan Multicast - set device class is incorrect! \r\n");
        return;
    }
  
    if (!(ret = api.lorawan.join())) {
        Serial.printf("LoRaWan Multicast - join fail! \r\n");
        return;
    }
  
    /**Wait for Join success */
    while (api.lorawan.njs.get() == 0) {
        Serial.print("Waiting for Lorawan join...");
        api.lorawan.join();
        delay(10000);
    }

  // // Get device address
	// api.lorawan.daddr.get(node_mc_address, 4);
	// // Add address to MC sessionZ
	// session.McAddress = node_mc_address[0] << 24 | node_mc_address[1] << 16 | node_mc_address[2] << 8 | node_mc_address[3];


    api.lorawan.adr.set(true);
    api.lorawan.rety.set(1);
    api.lorawan.cfm.set(1);
  
    api.lorawan.registerRecvCallback(recvCallback);
    /**LoRaWAN Multicast Setting*/
    // if (api.lorawan.addmulc(session) == true) {
    //     Serial.println("Add Multicast Success");
    // } else {
    //     Serial.println("Add Multicast Fail");
    // }
}

void loop()
{
}

The only way I can send downlink messages is by setting the device as a class A device in the gateway, then I see my payloads being sent along with the confirmation.

Even in Class C, the device has to send at least one uplink, before the LNS is starting to send downlinks.
At least it is like this on Chirpstack (and the internal LNS of the WisGate Edge is based on Chirpstack).

Wait, so i thought the RX window is continuously open meaning I could send a downlink at any time without the need for an uplink?

If you mean i have to send one uplink after which i can send any number of down links without an uplink then this doesnt work either

It is not the device that is not listening.
It is the LoRaWAN server not sending the downlink.

when i try to send a message via this interface with the device in the class C configuration, it does not schedule it, does that mean that the message is lost?

It works for me:

Step (1).
Device joined, Class is C, no uplink yet.
On Chirpstack enqueued two downlinks, but Chirpstack is not sending them yet:

Step (2).
Send one uplink packet.
Chirpstack starts sending downlinks and they are received immediately:

Are you sure you have setup your device as Class C?

Yes, it’s class C. Here’s a video i uploaded to imgur: Imgur: The magic of the Internet

  1. first im showing that it’s a class c device
  2. im showing that i can send uplinks
  3. im showing that im trying to schedule multiple downlinks but they’re cleared immediately
  4. finally im showing that even after trying to schedule downlinks i dont receive any messages after an uplink

It seems more a problem in the LoRaWAN server. I can’t help much with that.

Before you queue the downlink in the internal LNS, you need to wait for one uplink. That is different to CS V4.

Other than that I don’t know. I only know it works, it is not a problem on the RAK11720.