Forums - Time Sync from Network.

3 posts / 0 new
Last post
Time Sync from Network.
vaibhav.t
Join Date: 3 Aug 20
Posts: 14
Posted: Mon, 2020-08-24 07:16

 

Hello I am using QCA4020 in my project. 

I need to set RTC on connecting with wifi. in short i want to sync RTC with network time.

How can i get time from network..? are there any api or functions provided for QCA4020.

also I would like to know how to generate 32byte random number or string, which illl be using as referenceID in sending data to AWS.

I have found  similar issue on this forum , there they have following line commented as reply.

Example using QCLI_demo to verify locally:

//----------------------------------------------------------------------
> wlan enable
> wlan setdevice 1
> wlan SetWpaPassphrase password
> wlan SetWpaParameters WPA2 CCMP CCMP
> wlan connect SSID
WLAN: devid - 1 1 CONNECTED MAC addr xx:xx:xx:xx:xx:xx
WLAN: 4 way handshake success for device=1
 
> net dhcpv4c wlan1
Net: DHCPv4c: IP=10.xxx.xxx.x  Subnet Mask=255.255.254.0  Gateway=10.xxx.xxx.x
 
> net dnsc start
> net sntpc start
> net sntpc utc
Net: Jan 16, 2020 Thu 19:23:26 UTC
//----------------------------------------------------------------------
 
 
I dont know how to execute this on QCA4020.
 

 

Thank you.

 

 

//----------------------------------------------------------------------


  • Up0
  • Down0
c_rpedad
Profile picture
Join Date: 18 Jun 18
Location: San Jose
Posts: 317
Posted: Mon, 2020-08-24 09:28

By default system time is set to 2020-1-1 0.0.0.

Kindly modify build.bat file and set "CFG_FEATURE_ENABLE_DEFAULT_RTC_TIME" to false.

This will disable setting system time to reasonable timeslot during bootup.
This function is available under platform_demo.c

#ifdef CONFIG_ENABLE_DEFAULT_RTC_TIME
    /* Set default system time to reasonable timeslot */
    qapi_Time_t test_tm;
    
    memset(&test_tm, 0, sizeof(qapi_Time_t));
    test_tm.year = 2020;
    test_tm.month = 1;
    test_tm.day = 1;
    if(qapi_Core_RTC_Set(&test_tm) != 0)
    {
        QCLI_Printf(qcli_platform_handle, "Platform can't set time\n");
    }
#endif


 

  • Up0
  • Down0
vaibhav.t
Join Date: 3 Aug 20
Posts: 14
Posted: Tue, 2020-08-25 03:32

Hi 

I understand the use of function       "qapi_Core_RTC_Set(&tm)" .

here i dont have current time available with me, thus i want to get the time in current time zone of network to which my QCA4020 is connected. On getting time from network after boot up, ill set RTC with that time. and use the RTC time further.

Do you know how to get time from connected network ( wifi router ) .?

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.