cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-WL55JC1 - Lora Network Time Request

HKhan.4
Associate II

Good day 

 

I am currently trying to run the end_node sample located on the STM32Cube_FW_WL_V1.3.1 package.  I would like to know if i can have some guideline on how to use LmHandlerDeviceTimeReq().  

Which class do i need to use?

What lora server allows the time request?

How do i check if the MAC request is even sending?  Should I see this on the Logs under my application located on the server?

The request currently is not updating my system time.  The request is currently being done in a callback after a successful join. 

static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)

{

/* USER CODE BEGIN OnJoinRequest_1 */

if (joinParams->Status == LORAMAC_HANDLER_SUCCESS)

{

APP_LOG(TS_ON, VLEVEL_L, "JOINED\n");

 

// Send time request

if (LmHandlerDeviceTimeReq() == LORAMAC_HANDLER_SUCCESS)

{

APP_LOG(TS_ON, VLEVEL_L, "DeviceTimeReq sent.\n");

}

}

/* USER CODE END OnJoinRequest_1 */

}

After the request is sent successfully, the below lines are never run.

static void OnSysTimeUpdate(void)

{

/* USER CODE BEGIN OnSysTimeUpdate_1 */

SysTime_t time = SysTimeGet();

APP_LOG(TS_ON, VLEVEL_L, "Network Time: %lu (UNIX timestamp)\n", time.Seconds);

 

/* USER CODE END OnSysTimeUpdate_1 */

}

My setup is as follows:

HKhan4_0-1747813166952.pngHKhan4_1-1747813210617.png

 

This functionality is crucial to our project .

thank you in advance!

 

2 REPLIES 2
STTwo-32
ST Employee

Hello @HKhan.4 

End-devices and Network Servers SHALL implement these commands. This MAC command has been introduced in LoRaWAN L2 1.0.3. An end-device MAY use the DeviceTimeReq command to request the current network time from the Network Server. This allows the end-device to synchronize its internal clock to the Network’s clock. This is specifically useful to speed up the acquisition of the Class B beacon. The request has no payload. A Network Server MAY use the DeviceTimeAns command to provide the GPS time to the end-device. The time provided is the GPS time at the end of the uplink transmission. The command has a 5-octet payload defined as follows:

STTwo32_0-1747848896993.png

The time provided by the Network SHALL have a worst-case accuracy of ±100 ms. The DeviceTimeAns command SHALL be sent as a Class A downlink (i.e., over RX1/RX2 of the Class A mode).

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Sivanand
Associate

Hi,

What is the process to do this? I am trying the same method. I need to receive the time from the network server.