RAK11720 Multicast Fail

Please include the following information, in order for us to help you as effectively as possible.

  • What product do you wish to discuss? RAK4631, RAK3372, RAK11200, RAK11310, RAK11722?
    RAK11720

  • What firmware are you using? (RUI3 or Arduino BSP or other IDE (e.g. STM32CubeIDE)?
    RUI3

  • What firmware version? Can it be obtained with AT+VER=?
    rak_rui:apollo3 4.1.1

  • Computer OS? (MacOS, Linux, Windows)
    Windows

  • What Computer OS version?
    Windows 10 pro

  • How often does the problem happen?
    Registering Multicast session

  • How can we replicate the problem?
    running code sample in RUI3 documentation #addmulc

  • Provide source code if custom firmware is used or link to example if
    LoRaWAN | RAKwireless Documentation Center
    RAKwireless example code is used.

void setup()
{
  Serial.begin(115200);

#define OTAA_BAND (RAK_REGION_US915)
// OTAA Device EUI MSB
uint8_t node_device_eui[8] = {0x50, 0x59, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x01};
// OTAA Application EUI MSB
uint8_t node_app_eui[8] = {0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x0E};
// OTAA Application Key MSB
uint8_t node_app_key[16] = {0x45,0x53,0x43,0x2d,0x67,0x72,0x6f,0x75,0x70,0x20,0x4e,0x61,0x69,0x61,0x14,0x17};



//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 = 923300000,
    .McDatarate = 0,
    .McPeriodicity = 0,
    .McGroupID = 2,
    .entry = 0,
};
  memcpy(session.McAppSKey, node_mc_AppSKey, 16);
  memcpy(session.McNwkSKey, node_mc_NwkSKey, 16);

  api.lorawan.appeui.set(node_app_eui, 8);
  api.lorawan.appkey.set(node_app_key, 16);
  api.lorawan.deui.set(node_device_eui, 8);

  api.lorawan.band.set(OTAA_BAND);
  api.lorawan.njm.set(1);
  api.lorawan.deviceClass.set(RAK_LORA_CLASS_C);
  api.lorawan.join();

  //Wait for Join success
  while (api.lorawan.njs.get() == 0)
  {
    Serial.print("Waiting for Lorawan join...");
    api.lorawan.join();
    delay(10000);
  }

  api.lorawan.adr.set(true);
  api.lorawan.rety.set(1);
  api.lorawan.cfm.set(1);

  //LoRaWAN Multicast Setting
  if(api.lorawan.addmulc(session) == true) {
    Serial.println("Add Multicast Success");
  } else {
    Serial.println("Add Multicast Fail");
  }

}

void loop()
{

}

Output:
Waiting for Lorawan join…+EVT:JOINED
Add Multicast Fail
Current Work Mode: LoRaWAN.

@wilgaced

There is something missing in the example codes.

For the multicast session, the McAddress must be set to the device address that the device gets after it has joined the network.

Try to add

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

After the loop waiting for successful join and before you set the multicast.
Like this:

	// 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 session
	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);

	// LoRaWAN Multicast Setting
	if (api.lorawan.addmulc(session) == true)
	{
		Serial.println("Add Multicast Success");
	}
	else
	{
		Serial.println("Add Multicast Fail");
	}

Hi Beegee
I added the lines but the problem persist
Sample code:

void setup()
{
Serial.begin(115200);

#define OTAA_BAND (RAK_REGION_US915)
// OTAA Device EUI MSB
uint8_t node_device_eui[8] = {0x50, 0x59, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x01};
// OTAA Application EUI MSB
uint8_t node_app_eui[8] = {0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x0E};
// OTAA Application Key MSB
uint8_t node_app_key[16] = {0x45,0x53,0x43,0x2d,0x67,0x72,0x6f,0x75,0x70,0x20,0x4e,0x61,0x69,0x61,0x14,0x17};

//LoRaWan Multicast Session

uint8_t node_mc_address[4] = {0x01, 0x02, 0x03, 0x04};
uint8_t node_mc_AppSKey[16] = {0x45,0x53,0x43,0x2d,0x67,0x72,0x6f,0x75,0x70,0x20,0x4e,0x61,0x69,0x61,0x14,0x17};
uint8_t node_mc_NwkSKey[16] = {0x45,0x53,0x43,0x2d,0x67,0x72,0x6f,0x75,0x70,0x20,0x4e,0x61,0x69,0x61,0x14,0x17};

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 = 923300000,
.McDatarate = 0,
.McPeriodicity = 0,
.McGroupID = 2,
.entry = 0,
};
memcpy(session.McAppSKey, node_mc_AppSKey, 16);
memcpy(session.McNwkSKey, node_mc_NwkSKey, 16);

api.lorawan.appeui.set(node_app_eui, 8);
api.lorawan.appkey.set(node_app_key, 16);
api.lorawan.deui.set(node_device_eui, 8);

api.lorawan.band.set(OTAA_BAND);
api.lorawan.njm.set(1);
api.lorawan.deviceClass.set(RAK_LORA_CLASS_C);
api.lorawan.join();

//Wait for Join success
while (api.lorawan.njs.get() == 0)
{
Serial.print(“Waiting for Lorawan join…\r\n”);
api.lorawan.join();
delay(10000);
}

// Get device address
api.lorawan.daddr.get(node_mc_address, 4);
Serial.printf(“Device Address is %02X%02X%02X%02X\r\n”, node_mc_address[0], node_mc_address[1], node_mc_address[2], node_mc_address[3]); // Check Device Address
// Add address to MC session
session.McAddress = node_mc_address[0] << 24 | node_mc_address[1] << 16 | node_mc_address[2] << 8 | node_mc_address[3];
Serial.printf(“Session McAddress is %X\r\n”, session.McAddress); // Check Device Address

api.lorawan.adr.set(true);
api.lorawan.rety.set(1);
api.lorawan.cfm.set(1);

//LoRaWAN Multicast Setting
if(api.lorawan.addmulc(session) == true) {
Serial.println(“Add Multicast Success”);
} else {
Serial.println(“Add Multicast Fail”);
}

}

void loop()
{

}

Output:
Waiting for Lorawan join…
+EVT:JOINED
Device Address is 015F45DD
Session McAddress is 15F45DD
Add Multicast Fail
Current Work Mode: LoRaWAN.

Set your DR to 8
MC is using RX window 2 which has a fixed DR which is depending on the LoRaWAN region.
For US915 it is DR8:

Thanks Beegee It works!

Waiting for Lorawan join…
+EVT:JOIN_FAILED_RX_TIMEOUT
Waiting for Lorawan join…
+EVT:JOINED
Device Address is 00CCCB93
Session McAddress is CCCB93
Add Multicast Success
Current Work Mode: LoRaWAN.

@beegee I think this is not correct.
Device address and Multicast address are different address.
If you put it the same, it is a trick to fool the node to think the multicast address its own address and receive the packets.

I managed to keep Device address and Multicast address different and still receive Unicast downlink and Multicast downlink.

One LoRaWAN node can have up to 4 multicast groups (with 4 different multicast addresses).
So how you set the dev address in this case?