This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Openthread Network Time Synchronization

Hello,

I would like to implement the network time synchronization from the Openthread API to the existing simple_coap_client example from the Thread and Zigbee SDK. I'm currently using the SDK with SES. I added the include path, added the preprocessor definition (OPENTHREAD_CONFIG_TIME_SYNC_ENABLE) and tried to use the API functions but I get an error from SES: main.c:226: undefined reference to `otNetworkTimeSyncSetCallback'. 

I am very new to Openthread and the SDK, are there any other settings I have to make? 

#include <openthread/instance.h>
#include <openthread/thread.h>
#include <openthread/platform/time.h>
#include <openthread/network_time.h>

 /**@brief Function for initializing the Thread Time Synchronizationt Package 
 */
static void thread_time_sync_init(void) {
  otNetworkTimeSetSyncPeriod(thread_ot_instance_get(), 60);
  otNetworkTimeSetXtalThreshold(thread_ot_instance_get(), otPlatTimeGetXtalAccuracy());
  otNetworkTimeSyncSetCallback(thread_ot_instance_get(), thread_time_sync_callback, NULL);
}

Thank you very much for your help.

Best regards 

Rouben

Parents
  • Hello Nordic

    I've seen that I have to rebuild the Openthread libraries to get the time_sync functions working. I got the latest Git repo from the Openthread and checked out with the commit mentioned in the SDK. I built the libs with following command:

    $ ./bootstrap
    $ make -f examples/Makefile-nrf52840 BORDER_AGENT=1 BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DISABLE_BUILTIN_MBEDTLS=1 DNS_CLIENT=1 DIAGNOSTIC=1 EXTERNAL_HEAP=1 JOINER=1 LINK_RAW=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 UDP_FORWARD=1 ECDSA=1 SNTP_CLIENT=1 COAPS=1 DHCP6_SERVER=1 DHCP6_CLIENT=1 USB=1 TIME_SYNC=1

    After this I followed exactly the instructions to replace the old libs like described here: 

    https://infocenter.nordicsemi.com/topic/sdk_tz_v4.0.0/thread_ot_libraries_building.html 

    Then I rebuilt the project in SES and got following error messages:

    Am I doing some mistakes while building the libs?

    Thank you for your support,

    Regards 

    Rouben

Reply
  • Hello Nordic

    I've seen that I have to rebuild the Openthread libraries to get the time_sync functions working. I got the latest Git repo from the Openthread and checked out with the commit mentioned in the SDK. I built the libs with following command:

    $ ./bootstrap
    $ make -f examples/Makefile-nrf52840 BORDER_AGENT=1 BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DISABLE_BUILTIN_MBEDTLS=1 DNS_CLIENT=1 DIAGNOSTIC=1 EXTERNAL_HEAP=1 JOINER=1 LINK_RAW=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 UDP_FORWARD=1 ECDSA=1 SNTP_CLIENT=1 COAPS=1 DHCP6_SERVER=1 DHCP6_CLIENT=1 USB=1 TIME_SYNC=1

    After this I followed exactly the instructions to replace the old libs like described here: 

    https://infocenter.nordicsemi.com/topic/sdk_tz_v4.0.0/thread_ot_libraries_building.html 

    Then I rebuilt the project in SES and got following error messages:

    Am I doing some mistakes while building the libs?

    Thank you for your support,

    Regards 

    Rouben

Children
Related