Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

UC20

Time Synchronization
Application Note

UMTS/HSPA Module Series

Rev. UC20_Time_Synchronization_Application_Note_V1.0

Date:2019-04-09

Status: Released

www.quectel.com
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

Our aim is to provide customers with timely and comprehensive service. For any
assistance, please contact our company headquarters:

Quectel Wireless Solutions Co., Ltd.


7th Floor, Hongye Building, No.1801 Hongmei Road, Xuhui District, Shanghai 200233, China
Tel: +86 21 5108 6236
Email: info@quectel.com

Or our local office. For more information, please visit:


http://www.quectel.com/support/sales.htm

For technical support, or to report documentation errors, please visit:


http://www.quectel.com/support/technical.htm
Or email to: support@quectel.com

GENERAL NOTES
QUECTEL OFFERS THE INFORMATION AS A SERVICE TO ITS CUSTOMERS. THE INFORMATION
PROVIDED IS BASED UPON CUSTOMERS’ REQUIREMENTS. QUECTEL MAKES EVERY EFFORT
TO ENSURE THE QUALITY OF THE INFORMATION IT MAKES AVAILABLE. QUECTEL DOES NOT
MAKE ANY WARRANTY AS TO THE INFORMATION CONTAINED HEREIN, AND DOES NOT ACCEPT
ANY LIABILITY FOR ANY INJURY, LOSS OR DAMAGE OF ANY KIND INCURRED BY USE OF OR
RELIANCE UPON THE INFORMATION. ALL INFORMATION SUPPLIED HEREIN IS SUBJECT TO
CHANGE WITHOUT PRIOR NOTICE.

COPYRIGHT
THE INFORMATION CONTAINED HERE IS PROPRIETARY TECHNICAL INFORMATION OF QUECTEL
WIRELESS SOLUTIONS CO., LTD. TRANSMITTING, REPRODUCTION, DISSEMINATION AND
EDITING OF THIS DOCUMENT AS WELL AS UTILIZATION OF THE CONTENT ARE FORBIDDEN
WITHOUT PERMISSION. OFFENDERS WILL BE HELD LIABLE FOR PAYMENT OF DAMAGES. ALL
RIGHTS ARE RESERVED IN THE EVENT OF A PATENT GRANT OR REGISTRATION OF A UTILITY
MODEL OR DESIGN.

Copyright © Quectel Wireless Solutions Co., Ltd. 2019. All rights reserved.

UC20_Time_Synchronization_Application_Note 1 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

About the Document

History

Revision Date Author Description

1.0 2019-04-09 Winnie XI Initial

UC20_Time_Synchronization_Application_Note 2 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

Contents

About the Document ................................................................................................................................... 2


Contents ....................................................................................................................................................... 3

1 Introduction .......................................................................................................................................... 4

2 Time Synchronization AT Commands ............................................................................................... 5


2.1. AT+CTZU Automatic Time Zone Update ................................................................................ 5
2.2. AT+CTZR Time Zone Reporting ............................................................................................. 6
2.3. AT+QLTS Obtain the Latest Time Synchronized Through Network ....................................... 8
2.4. AT+CCLK Real Time Clock ..................................................................................................... 8
2.5. AT+QNTP Synchronize Local Time with NTP Server ............................................................. 9

3 Time Synchronization Procedures................................................................................................... 11


3.1. Time Synchronization via NITZ ............................................................................................... 11
3.2. Time Synchronization via NTP Server..................................................................................... 13
3.3. Recommended Time Synchronization Process ...................................................................... 14

UC20_Time_Synchronization_Application_Note 3 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

1 Introduction
This document provides instructions on how to synchronize time of Quectel UC20 module.

UC20_Time_Synchronization_Application_Note 4 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

2 Time Synchronization AT Commands


This chapter describes the AT commands related to the time synchronization features of Quectel UC20
modules.

2.1. AT+CTZU Automatic Time Zone Update

This command is used to enable and disable automatic time zone update via NITZ. The configuration is
stored in NV automatically.

AT+CTZU Automatic Time Zone Update


Test Command Response
AT+CTZU=? +CTZU: (0,1)

OK
Write Command Response
AT+CTZU=<onoff> OK

If there is any error:


ERROR
Read Command Response
AT+CTZU? +CTZU: <onoff>

OK
Maximum Response Time 300ms

Parameter
<onoff> Integer type. The mode of automatic time zone update.
0 Disable automatic time zone update via NITZ
1 Enable automatic time zone update via NITZ

UC20_Time_Synchronization_Application_Note 5 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

Example
AT+CTZU?
+CTZU: 0

OK
AT+CTZU=?
+CTZU: (0,1)

OK
AT+CTZU=1
OK
AT+CTZU?
+CTZU: 1

OK

2.2. AT+CTZR Time Zone Reporting

This command is used to enable and disable the reporting of time zone change event. If the reporting is
enabled, the MT (mobile terminal) returns the unsolicited result code +CTZV: <tz> or +CTZE:
<tz>,<dst>,<time> whenever the time zone is changed. The configuration is stored in NV automatically.

AT+CTZR Time Zone Reporting


Test Command Response
AT+CTZR=? +CTZR: (0-2)

OK
Write Command Response
AT+CTZR=<reporting> OK

If there is any error:


ERROR
Read Command Response
AT+CTZR? +CTZR: <reporting>

OK
Maximum Response Time 300ms

UC20_Time_Synchronization_Application_Note 6 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

Parameter

<reporting> Integer type. The mode of time zone reporting.


0 Disable time zone change event reporting
1 Enable time zone change event reporting with an unsolicited result code
+CTZV: <tz>
2 Enable extended time zone reporting with an unsolicited result code
+CTZE: <tz>,<dst>,<time>
<tz> String type. The sum of the local time zone (difference between the local time and
GMT is expressed in quarters of an hour) plus daylight saving time. The format is
"±zz", expressed as a fixed width, two-digit integer with the range -48 ... +56. To
maintain a fixed width, numbers in the range -9 ... +9 are expressed with a leading
zero, e.g. "-09", "+00" and "+09".
<dst> Integer type. Indicate whether <tz> includes daylight savings adjustment
0 <tz> includes no adjustment for Daylight Saving Time
1 <tz> includes +1 hour (equals 4 quarters in <tz>) adjustment for daylight saving
time
2 <tz> includes +2 hours (equals 8 quarters in <tz>) adjustment for daylight saving
time
<time> String type. The local time. The format is "YYYY/MM/DD,hh:mm:ss", expressed as
integers representing year (YYYY), month (MM), date (DD), hour (hh), minute (mm)
and second (ss). This parameter can be provided by the network when delivering time
zone information and will be presented in the unsolicited result code of extended time
zone reporting if provided by the network.

Example
AT+CTZR=2
OK
AT+CTZR?
+CTZR: 2

OK

+CTZE: “+32”,0,“2013/08/23,06:51:13” //The value of <reporting> is 2

UC20_Time_Synchronization_Application_Note 7 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

2.3. AT+QLTS Obtain the Latest Time Synchronized Through Network

This command is used to obtain the latest time synchronized through network.

AT+QLTS Obtain the Latest Time Synchronized Through Network


Test Command Response
AT+QLTS=? OK
Execution Command Response
AT+QLTS +QLTS: <time>,<ds>

OK
Maximum Response Time 300ms

Parameter

<time> String type. The format is "yy/mm/dd,hh:mm:ss±zz", indicating year (two last digits),
month, day, hour, minutes, seconds and time zone (indicates the difference, expressed in
quarters of an hour, between the local time and GMT; range -48...+56). E.g. 6th of May
2004, 22:10:00 GMT+2 equals to "04/05/06,22:10:00+08.
<ds> Daylight saving time.

2.4. AT+CCLK Real Time Clock

This command is used to manage real time clock (RTC) of the module. The current setting is retained until
the module is totally disconnected from power.

AT+CCLK Real Time Clock


Test Command Response
AT+CCLK=? OK
Read Command Response
AT+CCLK? +CCLK: <time>

OK
Write Command Response
AT+CCLK=<time> OK

If there is error related to ME functionality:


+CME ERROR: <err>

UC20_Time_Synchronization_Application_Note 8 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

If there is any other error:


ERROR
Maximum Response Time 300ms

Parameter

<time> String type. The format is "yy/mm/dd,hh:mm:ss±zz", indicating year (two last digits), month,
day, hour, minutes, seconds and time zone (indicates the difference, expressed in quarters
of an hour, between the local time and GMT; range -48...+56). E.g. May 6th, 1994, 22:10:00
GMT+2 equals to "94/05/06,22:10:00+08".
<err> An error related to mobile equipment or network. For more details, please refer to Chapter
14.5 of Quectel_UC20_AT_Commands_Manual.

Example
AT+CCLK? //Query the local time
+CCLK: "08/01/04,00:19:43+00"

OK

2.5. AT+QNTP Synchronize Local Time with NTP Server

NTP is intended to synchronize the Coordinated Universal Time (UTC) with the time server. Before using
NTP, the host should activate the context corresponding to <contextID> via AT+QIACT first. Depending
on the network, it will take at most 125 seconds to return the result.

AT+QNTP Synchronize Local Time with NTP Server


Test Command Response
AT+QNTP=? +QNTP: (1-16),“SERVER”,(list of supported <port>s),(0,1)

OK
Read Command Response
AT+QNTP? If in the process of synchronizing local time:
+QNTP: <server>,<port>

OK

Or else, response:
ERROR

UC20_Time_Synchronization_Application_Note 9 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

Write Command Response


AT+QNTP=<contextID>,<server>[,<p If synchronized successfully:
ort>][,<autosettime>] OK

+QNTP: <err>,<time>

If there is any error:


ERROR
Maximum Response Time 125s, determined by network.

Parameter

<contextID> Integer type. The context ID. The range is 1-16.


<server> String type. The address of NTP server.
<port> Integer type. The port of NTP server.
<autosettime> Integer type. Indicate whether to automatically set synchronized time to local time.
0 not set
1 set
<err> Integer type. Synchronization result. For possible values of the parameter, please refer
to Chapter 3 of Quectel_UC20_TCPIP_AT_Commands_Manual.
<time> String type. The time synchronized from NTP server.
The format is “YYYY/MM/DD,hh:mm:ss±zz”. The range of zz is -48~56.

UC20_Time_Synchronization_Application_Note 10 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

3 Time Synchronization Procedures


There are two ways to realize time synchronization:

⚫ Synchronizing time with NITZ (Network Identity and Time Zone)


The NITZ is a mechanism for provisioning local time and date, time zone and DST offset, as well as
network provider identity information, to mobile devices via a wireless network.

⚫ Synchronizing time with NTP (Network Time Protocol)


The NTP is a networking protocol for clock synchronization between computer systems over
packet-switched, variable-latency data networks.

The first way is highly recommended, but if the local network does not support NITZ, synchronizing time
with NTP should be taken.

3.1. Time Synchronization via NITZ

To synchronize time via NITZ, customers should set AT+CTZU=1 to enable automatic time zone update.

In addition, customers can check the time zone reporting by setting AT+CTZR=1 or AT+CTZR=2. The
settings of these commands will be saved automatically without using AT&W.

The settings of AT+CTZU=1 and AT+CTZR=1 or AT+CTZR=2 will take effect after rebooting. After
rebooted, the module will report the current GMT time once the network time information is received.

Customers can query GMT time by AT+CCLK?.

Example
//When AT+CTZR=2:
AT+CTZU=1
OK
AT+CTZR=2
OK

RDY //Take effect after rebooting

UC20_Time_Synchronization_Application_Note 11 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

+CFUN: 1

+CPIN: READY

+QUSIM: 1

+CTZE: "+32",0,"2019/04/04,01:03:33" //Report time when receiving network time information


AT+CCLK? //Query current clock
+CCLK: "19/04/04,01:03:35+32"

OK

//When AT+CTZR=1
AT+CTZU=1
OK
AT+CTZR=1
OK

RDY //Take effect after rebooting

+CFUN: 1

+CPIN: READY

+QUSIM: 1

+CTZV: "+32" //Report time zone


AT+CCLK?
+CCLK: "19/04/04,01:17:44+32" //Query current clock

OK

UC20_Time_Synchronization_Application_Note 12 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

3.2. Time Synchronization via NTP Server

Before using NTP server, the host should activate the context corresponding to <contextID> via
AT+QIACT first. And then, Customers should set AT+QNTP to synchronize the local time via NTP.

The recommended optional NTP server addresses are listed below:

⚫ Windows NTP server address: time.windows.com; Port:123


⚫ The official time server of the United States: time.nist.gov; Port:123
⚫ The NTP server address commonly used in China: ntp.neu.edu.cn / cn.ntp.org.cn; Port:123

Besides, customers can select server addresses tested by themselves.

Example

AT+CCLK="80/01/06,00:02:16+32" //Setup time zone


OK
AT+CGREG?
+CGREG: 0,1 //Registered to GPRS network

OK
AT+QIACT=1 //Activate the context
OK
AT+QNTP=1,"time.windows.com",123 //Synchronize the local time via NTP
OK

+QNTP: 0,"2019/04/04,02:13:43+32" //Successfully synchronize the time


AT+CCLK? //Query real time
+CCLK: "19/04/04,02:13:52+32" //GMT time

OK

NOTE

If customers need to setup time zone, the command AT+CCLK=<time> should be used, for the time zone
cannot be synchronized via NTP.

UC20_Time_Synchronization_Application_Note 13 / 14
UMTS/HSPA Module Series
UC20 Time Synchronization Application Note

3.3. Recommended Time Synchronization Process

The recommended time synchronization process is shown below.

Power on

AT+CTZU=1

AT+CTZR=1/2

Restart the module or Switch CFUN

No Synchronize time via NTP server:


AT+CPIN?
AT+CSQ
Does local network
AT+CREG?
operator support
AT+CGREG?
NITZ?
AT+CCLK=<time>
Response: AT+QIACT=<contextID>
Yes +CTZR: AT+QNTP=<contextID>,<server>
<tz> or [,<port>]
+CTZE: AT+QIDEACT= <contextID>
<tz>,<dst>
,<time>

Query current time


AT+CCLK?
Response: +QNTP: <err>,<time>

Figure 1: Recommended Time Synchronization Process

UC20_Time_Synchronization_Application_Note 14 / 14

You might also like