The RAK3172's default DevEUI: can I use it?

As RAK3172 modules come with a DevEUI, I assume RAKwireless must have an Organizationally Unique Identifier (OUI) from the IEEE Registration Authority. Am I right?

Now, my second question is: if I build a LoRaWAN end-device (using a RAK3172) with the RAK3172’s DevEUI as the end-device’s DevEUI, is it correct? Am I allowed to do that?
Or do I have to overwrite the RAK3172’s DevEUI with a new one (by purchasing a block from IEEE Registration Authority)?

Appreciate your attention,
Regards,

Hi @EmSys22 ,

You are correct that RAK secures that block from IEEE.

That EUI in the sticker of RAK3172 is unique to you (the user). So basically, you can use it for your own project with no harm to us or to anybody :+1:

Hi @carlrowan,

Thank you for your quick feedback!
Perfect, I will use the RAK3172’s DevEUI for my end-device.

And, for curiosity’s sake: what would be the consequence if I used a random DevEUI for my end-device (without any subscription to the IEEE Registration Authority)?

Regards,

Does RAK write this EUI to flash during manufacturing so it can be read programmatically by FW?

-AD

Likelihood of DEVEUI reuse is possible. Which means you wont be able to onboard your device to the network server because it is used already. Good news is that this is already handle to you by RAK :+1:

Hi @Autodog ,

It is not embedded. DEVEUI can be changed.

However, there’s an OUI programmed into the STM32WLE5 by ST. See 37.1.4 of the STM32WLxx reference manual (RM0461):

37.1.4 IEEE 64-bit unique device ID register (UID64)
A 64-bit unique device identification (UID64) is stored in the Flash memory and can be
accessed by the CPUs.
Base address: 0x1FFF 7580
Address offset: 0x00
Reset value: 0xXXXX XXXX
Note:X is factory-programmed.

The STM32Cube firmware for LoRaWAN will use this automatically if correctly configured in Cube (uncheck ‘Static EUI’).

Dana

Hi @danak6jq ,

Yes you are correct. Thank you for sharing.

However, on the RAK3172 modules FW, the DEVEUI are set to be configurable by users.

Does this mean there is not a way to retrieve the embedded ID of the STM32WL or is that still possible? Hoping to be able to get a unique ID without having to account for flashing one to the module when producing en masse.

1 Like

On RUI3 access to UID64, I still have check with the software team. I won’t give you so much hope though since our modules are not utilizing the Static EUI

I’m still holding on to some hope from the software team! :wink:

2 Likes

Administering EUIs and AppKeys requires some work either way; for the RAK4630 motes, we read the QR code at firmware programming time and program that into the module along with the AppKey.

For the RAK3172 (and other STM32WL modules) we read the EUI/UID64 at firmware programming time and program the AppKey into the module. I do like the internal EUI even though the QR on the module becomes incorrect :slight_smile:

Hi. I tried to get UID64 using the GetUniqueId Function from STM32WLXX code as mentioned below.

void GetUniqueId(uint8_t *id)
{
  /* USER CODE BEGIN GetUniqueId_1 */

  /* USER CODE END GetUniqueId_1 */
  uint32_t val = 0;
  val = LL_FLASH_GetUDN();
  if (val == 0xFFFFFFFF)  /* Normally this should not happen */
  {
    uint32_t ID_1_3_val = HAL_GetUIDw0() + HAL_GetUIDw2();
    uint32_t ID_2_val = HAL_GetUIDw1();

    id[7] = (ID_1_3_val) >> 24;
    id[6] = (ID_1_3_val) >> 16;
    id[5] = (ID_1_3_val) >> 8;
    id[4] = (ID_1_3_val);
    id[3] = (ID_2_val) >> 24;
    id[2] = (ID_2_val) >> 16;
    id[1] = (ID_2_val) >> 8;
    id[0] = (ID_2_val);
  }
  else  /* Typical use case */
  {
    id[7] = val & 0xFF;
    id[6] = (val >> 8) & 0xFF;
    id[5] = (val >> 16) & 0xFF;
    id[4] = (val >> 24) & 0xFF;
    val = LL_FLASH_GetDeviceID();
    id[3] = val & 0xFF;
    val = LL_FLASH_GetSTCompanyID();
    id[2] = val & 0xFF;
    id[1] = (val >> 8) & 0xFF;
    id[0] = (val >> 16) & 0xFF;
  }
}

But I still get the wrong DEVEUI. It seems, STM32 adds its own device ID and CompanyID to DEVEUI. as they mentioned in STM32WLxx reference manual (RM0461):

I am getting the same 0080E1 and device ID 15 in the DEVEUI as STM generates this code (hardcode). I am not getting what I get in the sticker. So I tried directly getting data without any hardcode of STM32 as below:

void GetUniqueId(uint8_t *id)
{
  uint32_t ID_1_val = READ_REG(*((uint32_t *)UID64_BASE + 4U));
  uint32_t ID_2_val = READ_REG(*((uint32_t *)UID64_BASE));

  id[7] = (ID_1_val) >> 24;
  id[6] = (ID_1_val) >> 16;
  id[5] = (ID_1_val) >> 8;
  id[4] = (ID_1_val);
  id[3] = (ID_2_val) >> 24;
  id[2] = (ID_2_val) >> 16;
  id[1] = (ID_2_val) >> 8;
  id[0] = (ID_2_val);
}

Still not getting it. Any advice? @carlrowan

Welcome to the forum @jagannath_atsuya

The DevEUI on the sticker has no relation to the internal chip ID. The DevEUI on the sticker is used with our RUI3 firmware (saved in flash) and is assigned to us by the LoRa Alliance.

@beegee Thanks for the reply.
Oh. Then is there any documentation on where DevEUI is stored in its flash? or please provide me the details. Thanks again.

We are not publishing the location of the device settings in the flash.
You can use AT commands or API calls to set and retrieve them.

And if you flashed a firmware that was built with STM32CubeIDE, they are overwritten already anyway.

1 Like

Does it mean that is possible to retrieve the devEUI from the flash using this API? LoRaWAN | RAKwireless Documentation Center
Or would it also be overwritten for example using arduino IDE and a RUI3 lora example?
Thanks!

If you are using a custom RUI3 application you can retrieve the LoRaWAN credentials from Flash with the api.system.lorawan commands
api.lorawan.appeui.get(buf, len);
api.lorawan.appkey.get(buf, len);
api.lorawan.deui.get(buf, len);