Forums - Real Time Clock qapi returning error

3 posts / 0 new
Last post
Real Time Clock qapi returning error
jagan
Join Date: 2 Jan 20
Posts: 15
Posted: Thu, 2020-01-16 01:24

Hi, 

I am trying to get the system time from RTC APIs

The API "qapi_Core_RTC_GPS_Epoch_Get" is always returning value "294". The API "qapi_Core_RTC_Set" is giving out error "-6", which I guess is "QAPI_ERR_BUSY".  

I am trying to sync up the time from SNTPC to RTC and read the current time in Epoch format. 

Kindly help on this. 

Regards,
Jagan


 

 

  • Up0
  • Down0
c_rpedad
Profile picture
Join Date: 18 Jun 18
Location: San Jose
Posts: 317
Posted: Thu, 2020-01-16 11:32

Kindly confirm if you are using below sequenctial flow to verify the time from SNTP to RTC and read in Epoch format:

> Connect to AP and acquire IP address
> Start DNS and SNTP client services
> Read UTC time from SNTP client. RTC and Epoch time.

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
 
> platform time get
Platform: Julian Time:
Platform: year = 2020
Platform: month = 1
Platform: day = 16
Platform: hour = 19
Platform: minute = 23
Platform: second = 33
Platform: day_Of_Week = 3
 
> platform time_ms get
Platform: epoch_msec = 517433314
 
  • Up0
  • Down0
jagan
Join Date: 2 Jan 20
Posts: 15
Posted: Thu, 2020-01-16 22:13

Thanks Raja. 

There was a missing step/bug in my code, because of which the date & time was shown incorrect.    

I corrected the same.  I am getting correct date & time with the API

"qapi_Core_RTC_Get()".  - "17-1-2020 4 5:50:48"

But with API "qapi_Core_RTC_GPS_Epoch_Get()" I am getting wrong value.  For the same instant the API returns - 1263275448673

This epoch time refers to "Tuesday, 12 January 2010 05:50:48.673".  This is nearly a decode old data & time. 

Also the epoch millisecond time that is printed in your log is looks different. The value refers to "Sunday, 25 May 1986 19:28:34" as per the website  https://www.epochconverter.com/

> platform time_ms get
Platform: epoch_msec = 517433314
 
 Please let me know, if I am missing some thing here.
 
Regards,
Jagan
  • 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.