Product do you wish to discuss?
RAK3372, RAK2287
What firmware are you using?
RUI3
What firmware version?
AT+VER=RUI_4.2.0_RAK3172-E
Computer OS?
Linux
How often does the problem happen?
Always
Hello,
I can’t establish a multicast connection between my RAK3372 and ChirpStack. Each time I try to connect using Lorawan_Multicast sample code, I get the following messages:
RAKwireless LoRaWan Multicast Example
------------------------------------------------------
Waiting for Lorawan join...+EVT:JOINED
Add Multicast Fail
Current Work Mode: LoRaWAN.
Node:
Lorawan_Multicast sample code :
/***
* This example shows LoRaWan protocol joining the network in OTAA mode, class C, region EU868 and set multicast group.
***/
bool ret;
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, 0x0E };
// 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 = 869525000,
.McDatarate = 0,
.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(4))) {
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);
}
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() {
}
Gateway:
The RAK2287 gateway is connected to the linux computer using the “mPCIe to USB Board” interface. I’m running the packet_forwarder utility from the sx1302_hal project version 2.1.0 (sx1302_hal/packet_forwarder at master · Lora-net/sx1302_hal · GitHub) with the config file “configuration/chirpstack/chirpstack.toml” copied from “region_eu868.toml” and only the “eu868” region active.
Network server:
ChirpStack is running in a docker (chirpstack-docker v4.9.0). The server configuration is described below:
The gateway is online and configured for the eu868 region.
https://ibb.co/b1fHwnk
The “My_application2” application contains a “My_Device2” node with the “My_device” profile. The device is seen by my server (Last seen …)
https://ibb.co/djwWyqm
Node “My_Device2” is configured with Device EUI “0102030405060788” (node_device_eui from the Lorawan_Multicast example) with profile “My_device”.
https://ibb.co/h807mtQ
The OTAA key is “2b7e151628aed2a6abf7158809cf4f3e” (node_app_key from the Lorawan_Multicast example).
https://ibb.co/S7XP0sg
The “My_device” profile is set to EU868 (api.lorawan.band.set(4) from the Lorawan_Multicast example).
https://ibb.co/2tjttDJ
The application contains a Multicast group “My_Multicast_group2” for region EU868 and of type “CLASS_C” (api.lorawan.deviceClass.set(RAK_LORA_CLASS_C) from the Lorawan_Multicast example).
https://ibb.co/fSPVj2z
This Multicast group contains “My_Device2” with the DevEUI (0102030405060788).
https://ibb.co/NVg8C0P
This Multicast group is configured with the Multicast address: 01020304, Multicast network session key and Multicast application session key: 01020304050607080102030405060708 (node_mc_address, node_mc_AppSKey and node_mc_NwkSKey from the Lorawan_Multicast example). The region is set to EU868 with a frequency of 869525000Hz (.McFrequency = 869525000 from the Lorawan_Multicast example).
https://ibb.co/8j7WStG
I can’t figure out where my mistake is. Does anyone have any idea why I can’t connect in multicast mode?
PS: PS: Sorry for the image links, I’m not allowed to put more than two links or multiple images in the post.