beegee-tokyo / SX126x-Arduino

Arduino library to use Semtech SX126x LoRa chips and modules to communicate
MIT License
233 stars 64 forks source link

MULTICAST - is it possible with your lorawan stack? #70

Closed andrelmbraga closed 2 years ago

andrelmbraga commented 2 years ago

Hello guys,

Is it possible to use multicast with your stack? Is there any example of implementation on the node (firmware) side? thanks a lot!

beegee-tokyo commented 2 years ago

Theoretically it should work, but I never got it to work on the LoRaWAN server side.

I tested with my [WisBlock-Sensor-For-LoRaWAN]() code. What you need is the Multicast credentials:

/** Structure for multicast group entry */
MulticastParams_t test_multicast;
/** Multicast network session key, must be the same as in the Multicast group in the LNS **/
uint8_t _mc_nwskey[] = {0xc2, 0x52, 0x19, 0xc3, 0x69, 0xae, 0x0a, 0xc4, 0xa9, 0x17, 0x61, 0xee, 0x1b, 0x8d, 0xc4, 0xc5};
/** Multicast application session key, must be the same as in the Multicast group in the LNS **/
uint8_t _mc_appskey[] = {0x03, 0x76, 0xc3, 0xe7, 0x99, 0x3c, 0xe1, 0xcd, 0x64, 0xa6, 0x6d, 0xa0, 0x70, 0x88, 0xcc, 0xad};
/** Multicast device address, must be the same as in the Multicast group in the LNS **/
uint32_t _mc_devaddr = 0x7bca00be;

and then after the device has joined the network, you enable the Multicast:

// Add Multicast support
test_multicast.Address = _mc_devaddr;
memcpy(test_multicast.NwkSKey, _mc_nwskey, 16);
memcpy(test_multicast.AppSKey, _mc_appskey, 16);
LoRaMacStatus_t result = LoRaMacMulticastChannelLink(&test_multicast);
Serial.printf("MC setup result = %d\n", result);

But then I got stuck on the LoRaWAN server side (I use Chirpstack) how to actually send a MC packet. Never found out if it works.

beegee-tokyo commented 2 years ago

Giving up on multicast. Cannot setup the server to test anything.