cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone managed to make a working LoRaWAN multicast with STM32WL? If so, how?

Ogui
Associate II

I am a bit confused with the multicast on STM32WL. I want to send downlink messages from an Application Server to 1 (or 2) STM32WL by using multicast. To do so, I tried to use the project (LoRaWAN_End_Node or LoRaWAN_AT_Slave) proposed in the STM32WL package from ST. However, I can't figure out how to configure the STM32WL to enable the multicast. Is there any configuration I am forgetting to do in the files of the project ?

Really appreciate your attention, thank you !

10 REPLIES 10
Louis AUDOLY
ST Employee

There are differents things you need to do or check to use multicast :

First, you must know the multicast is not implemented in class B on our devices, it’s supported only in class C.

On the device side, you must use the Remote Multicast package that is use when you want to enable a FUOTA session (LmhpRemoteMcastSetup.c).

You have to enable this package by calling the function LmHandlerPackageRegister (PACKAGE_ID_REMOTE_MCAST_SETUP, NULL) define in LmhpPackagesRegistration.c.

This will allow the device to support LoRa MAC commands related to multicast.

On the server side, you must ensure the Application Server you are working with use the same protocol as the one implemented in the device.

When we develop our code, we use the technical specification TS005 1.0.0 as reference, so if the server Loriot, or TTN, or Actility… do not use the same protocol with the same commands you could not establish a multicast session (check the spec of each server to know which one is supported).

Also, you can create your server and if you follow the TS005, create the MAC commands the server need to send to the devices to match with the ones describes in TS005, and enable a multicast session.

For more information, you can refer to this Application Note : AN5554 LoRaWAN® firmware update over the air with STM32CubeWL: https://www.st.com/resource/en/application_note/an5554-lorawan-firmware-update-over-the-air-with-stm32cubewl-stmicroelectronics.pdf

Section 2.4.4 

0693W00000JPucRQAT.pngSection 2.5.2

0693W00000JPucqQAD.png And section 5.1, concerning the package :

0693W00000JPufzQAD.png 

Regards

Ogui
Associate II

Hi @Louis AUDOLY​ ,

Thank you for all this information. I will check this out soon !

Regards

Ogui
Associate II

Hi @LAUDO

I have followed your advice, thanks again by the way.

I have added needed packages (especially LmhpRemoteMcastSetup) to enable a successful multicast session in the LoRaWAN_End_Node project. Now, my STM32WL seems to be ready for multicast.

Indeed, according to the instructions given into the LoRaWAN Remote Multicast Setup Specification v1.0.0 (https://lora-alliance.org/wp-content/uploads/2020/11/remote_multicast_setup_v1.0.0.pdf), I have successfully sent Multicast commands on port 200 to the device and it has responded with the expected answers. I have tested McGroupSetupReq/Ans, McGroupStatusReq/Ans and McClassCSessionReq/Ans.

To be noted, I have also tested time synchronization commands on port 202 (such as PackageVersionReq, DeviceAppTimePeriodicityReq, ForceDeviceResyncReq) thanks to LoRaWAN Application Layer Clock Synchronization Specification v1.0.0 (https://lora-alliance.org/wp-content/uploads/2020/11/application_layer_clock_synchronization_v1.0.0.pdf). It also worked well.

However, I did not achieve my goal: make multicast session work. As a first step, I would like to toggle a LED on 2 STM32WL simultaneously.

Here are the issues I meet:

When I have done my multicast command test, I have scheduled downlinks on a TTN application. And one of the fields of the McGroupSetupReq is the McKey_encrypted. Since I have neither the McKey nor the tool to encrypt it (to have the McKey_encrypted), I have randomly generated a McKey_encrypted.

0693W00000KbxMAQAZ.jpgWhen the McKey_encrypted is received by the device, this one should be decrypted by the device to have the McKey from which McAppsSkKey and McNetSKey are then derived. But to decrypt the McKey_encrypted, a McKEKey is used. It is derived from a McRootKey, itself derived from a GenAppKey.

The questions are:

1)   Where, in the LoRaWAN_End_Node project, should I set the GenAppKey?

2)   On the server side, I need the McAddr, the McAppsSkKey and the McNetSKey to create a Multicast profile. I can randomly generate the McAddr and then set it in the device thanks to McGroupSetupReq command. However, it remains McAppsSkKey and the McNetSKey. How should I proceed to have these elements? Of course, I need the same values both on the server side and on the device side.

Really appreciate your attention, thank you!

Regards,

To be noted: I would also precise the devices I work with:

- a STM32WL55 as device

- P-NUCLEO-LRWAN2 Gateway

- Actility or TTN as NS

Louis AUDOLY
ST Employee

Hello Ogui (Community Member),

Happy to know I could help you !

You are not so far from the end.

First, the GenAppKey is the AppKey defined in se-identity.h of  LoRaWAN_End_Node project.

With this key you should be able to get the other keys you need to create a multicast session.

As you described :

McAppSKey = f ( McKey )

McNwkSKey = f ( McKey )

McKey = f ( McKEKey, McKey_encrypted )

McKEKey = f ( GenAppKey )

McKey_encrypted, you generated it and set it via McGroupSetupReq command.

Let me know if you acheive to create a multicast session !

Hope it helps you

Regards

Ogui
Associate II

Hi @LAUDO

Thanks again for the information!

On the device side, I successfully have setup a Multicast group in the STM32WL thanks to the McGroupSetupReq command.

On the server side, I have setup a Multicast group on the Actility NS (with McAddr, McAppsSkKey and McNetSKey). To do so, I have done a JS script able to derive keys from the GenAppKey. I then obtained McAppsSkKey and the McNetSKey. I have checked if they were identical on both STM32WL side (by displaying keys in the device logs) and JS Script side. As a result, everything was OK: keys were the same. Moreover, the Multicast group configuration on Actility was also right: indeed, the logs of the Actility Wireless logger have shown me that multicast downlink worked properly.

As a conclusion, all the necessary multicast configurations seem to have been done correctly.

HOWEVER, when I send Multicast downlink to the device: noting happens. I do not see any logs on the STM32WL side as if it never receives multicast frames.

I am close to my goal, but something still goes wrong. Is there something I should additionally setup on the device side?

Really appreciate your attention,

Regards,

Louis AUDOLY
ST Employee

Hi Ogui,

I think you have well set up your environment, seems to be good.

I think you work in class C but can you confirm it to me ?

Have you checked if you register the same radio configuration between the network and the device ? The same data rate for exemple. We already encounter this issue in the past.

Regards

Ogui
Associate II

Hi @LAUDO

I re-post a message to announce good news!

I have managed to make a successful multicast session!

I have done two experimentations:

-         A multicast session with the STM32WL in class C mode. So, I can send multicast downlink whenever I want.

-         A programmed multicast session with the STM32WL in class A. I send “McClassCSessionReq�? to the device. It then toggles to class C to be able to receive multicast frames.

These two tests were successful.

And you were right, the problem was linked with the radio configuration. Multicast downlinks from Actility NS were not in DR3. After a correction, everything went well.

Thanks again for your advice and explanations. It helped my project going ahead!

Regards,

Ogui
Associate II

Hi everyone,

I am just updating this post to share free LoRaWAN contents my team work on. We’ve worked on LoRaWAN multicast but not just that. There were also Clock Synchronization, Data Fragmentation and FUOTA.

If anyone wants to learn more about these features, feel free to check:

-       Our free e-book about advanced features [https://www.univ-smb.fr/lorawan/en/free-book/]

-       Our demonstration videos [https://www.youtube.com/playlist?list=PLZQkMBvJm9EIDVI_VpMRksb1GjXc08aiB]

For all intents and purposes, I am posting the link of our website where you’ll find more information about LoRaWAN: [https://www.univ-smb.fr/lorawan/en/]

Hope this will help,

Regards,

Hello @Ogui​ 

I too am struggle a little with the understanding of the keys. Perhaps you can help me with some direction... These are my device Keys after OTAA join

###### MCRootKey:  7D:F7:6B:0C:1A:XX:XX:XX:XX:XX:F0:47:B9:1B:54:6F

###### MCKEKey:   8C:B8:66:5E:0C:XX:XX:XX:XX:XX:D9:E4:8A:19:27:7C

###### AppSKey:   1D:EB:AB:17:XX:XX:XX:XX:XX:07:4B:E7:7C:E8:46:E9

###### NwkSKey:   07:6B:65:E1:XX:XX:XX:XX:XX:90:C2:BD:E8:AC:CB:0C

###### DBIntKey:  7A:C4:7C:65:XX:XX:XX:XX:XX:BD:26:35:19:F8:9C:8E

###### DevEUI:   00:80:E1:15:05:00:5D:C7

###### AppEUI:   01:01:01:01:01:01:01:01

###### DevAddr:   26:0C:63:38

AT+APPKEY=?

2B:7E:15:16:28:XX:XX:XX:XX:XX:15:88:09:CF:4F:3C

After sending 0200A7A20C262B7E151628XXXXXXXXXXXX8809CF4F3C000000000A000000 On Fport 200

The device outputs the following

ID     : 0

McAddr   : 260CA2A7

McKey    : 2B-7E-15-16-28-XX-XX-XX-XX-XX-15-88-09-CF-4F-3C

McFCountMin : 0

McFCountMax : 10

SessionTime : 315964800

SessionTimeT: 32768 s

Rx Freq   : 869525000

Rx DR    : DR_3

Question is how and where will I find McAppSKey and McNwkSKey ?

Or what method can be used to generate them?