2025-05-21 12:42 AM
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:
This functionality is crucial to our project .
thank you in advance!
2025-05-21 10:35 AM
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:
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.