1 概述
高新兴(ME3630-W)和SIMcom4G模块(7600CE)均带有GPS定位功能,下面介绍两个模块GPS定位功能的使用。
2 GPS功能使用说明
GPS定位模式分为三种类型,分别是Standalone模式、MS Based模式、MS Assisted模式。
Stand Alone模式是目前比较成熟、通用的GPS定位模式,仅通过卫星信号定位。MS Based模式也称为MSB,先从服务器下载卫星信息,然后通过卫星信号定位,会比StandAlone模式搜星过程快一些。类似于最早期的Stand Alone+快速GPS功能。MSB模式下,每次开启GPS功能,如果发现星历过期,会通过数据连接下载最新的卫星信息。 MS Assisted模式也称为MSA,通过基站辅助定位,直接从移动通讯公司服务器上获取设备的当前位置,因电信服务器限制,只能实现单次定位。
三种定位类型的特点如下:
a) MSA和MSB都是GPSOne功能/标准的一种实现方式;
b) Standalone和MSB适用于卫星信号较好的地方使用;MSA适用于卫星信号较差的地方;
c) (Stand Alone + 快速GPS功能)与MSB模式类似,区别在于前者是手动下载星历,后者是主动下载星历;
d) 快速GPS可以加快Stand Alone的定位速度;
e) 由于MSA的单次定位特性,市场上的GPS软件无法实现移动过程中的连续定位。
需要注意的是,本文档中提到的AGPS模式仅仅指的是MS Based模式,高新兴模块和SIMcom模块全都不支持MS Assisted模式。使用AGPS模式的前提条件是4G模块可以接入互联网,要不然无法连接服务器下载卫星信息。
启动GPS定位有冷启动,热启动和暖启动三种方式(现在的技术基本上已经将该冷启动和暖启动两模式参数做得非常接近,从而就逐步取消了暖启动)。如果4G模块初次通电,或者移动超过500公里后通电时,模块需要重新计算一次星历数据,一般正常情况下需要30多秒钟就能正常定位,这就是冷启动。如果星历数据已经存储在模块内部,当下次模块工作的时候可以很快速的定位,一般只需要几秒就可以实现新的定位,那这种定位就叫做热启动。
2.1 高新兴ME3630-W模块
2.1.1 GPS相关指令介绍
对高新兴模块GPS定位用到的相关指令参数进行详细介绍, 如表2.1所示。
表2.1 高新兴模块GPS定位相关指令
2.1.2 定位方法
(1) Standalone模式
冷启动模式:
该模式会清除之前定位时下载到的卫星信息,在定位时会重新搜星。
按照以下次序依次输入命令:
at+zginit # 初始化 GPS 定位服务
at+zgmode=3 # 1:MS-BASED, 2:MS-ASSISTED, 3: STANDALONE_ONLY
at+zgfixrate=65535,1 # 设置 GPS 重启后的定位模式选择。
at+zgqos=50,255 # 设置定位的 Qos,定位精度
at+zgpsr=1 #主动上报 GPS 定位数据,UTC time, lon, lat 和 speed 等
at+zgrst=0 #用于执行 GPS 重启命令。0 Cold restart,1 Warm restart,2 Hot restart
定位成功后,会输出如下类似位置信息:
+ZGPSR: 060130.400,3954.3328N,11623.4841E,1.9,49.8,2,000.00,0.0,0.0,190214,07
热启动模式:
该模式会使用之前定位时下载到的卫星信息,在定位时省去搜星过程。
按照以下次序依次输入命令:
at+zginit
at+zgmode=3
at+zgfixrate=65535,1
at+zgqos=50,255
at+zgpsr=1
at+zgrst=1
定位成功后,会输出如下类似位置信息:
+ZGPSR: 060130.400,3954.3328N,11623.4841E,1.9,49.8,2,000.00,0.0,0.0,190214,07
连续定位模式:
该模式会连续进行定位。按照以下次序依次输入命令:
at+zginit
at+zgmode=3
at+zgfixrate=65535,1
at+zgqos=50,255
at+zgpsr=1
at+zgrun=2
每次定位成功后,会依次输出如下类似位置信息:
+ZGPSR: 060130.400,3954.3328N,11623.4841E,1.9,49.8,2,000.00,0.0,0.0,190214,07
+ZGPSR: 060115.700,3749.1669N,12228.7109W,1.4,33.8,2,000.00,0.0,0.0,190214,07
………
(2) A-GPS模式
首次使用时,输入at+zgurl=supl.qxwz.com:7275,然后重启模块,模块会记住该服务器地址,用于卫星信息下载。下次使用AGPS模式定位时,不要再设置服务器地址,仅选择定位模式即可。
at+zgurl指令用于设置SUPL服务器(AGPS定位服务器)的URL。at+zgurl ? 可以查看当前设置的服务器地址。
冷启动模式:
按照以下次序依次输入命令:
at+zginit
at+zgmode=1
at+zgfixrate=65535,1
at+zgqos=50,255
at+zgpsr=1
at+zgrst=0
定位成功后,会输出如下类似信息:
+ZGPSR: 060130.400,3954.3328N,11623.4841E,1.9,49.8,2,000.00,0.0,0.0,190214,07
热启动模式:
按照以下次序依次输入命令:
at+zginit
at+zgmode=1
at+zgfixrate=65535,1
at+zgqos=50,255
at+zgpsr=1
at+zgrst=1
定位成功后,会输出如下类似信息:
+ZGPSR: 060130.400,3954.3328N,11623.4841E,1.9,49.8,2,000.00,0.0,0.0,190214,07
连续定位模式:
at+zginit
at+zgmode=1
at+zgfixrate=65535,1
at+zgqos=50,255
at+zgpsr=1
at+zgrun=2
定位成功后,会输出如下类似信息:
+ZGPSR: 060130.400,3954.3328N,11623.4841E,1.9,49.8,2,000.00,0.0,0.0,190214,07
+ZGPSR: 060115.700,3749.1669N,12228.7109W,1.4,33.8,2,000.00,0.0,0.0,190214,07
…….
2.1.3 定位数据信息格式说明
获取的GPS定位信息格式如下:
+ZGPSR:,,,,,,,,,,
定位信息中共包含11个参数,每个参数的意义如下:
UTC time (hhmmss.sss) (referred to GGA sentence)
format is ddmm.mmmm N/S (referred to GGA sentence)
where:
dd - degrees
00…90
mm.mmmm - minutes
00.0000…59.9999
N/S: North / South
format is dddmm.mmmm E/W (referred to GGA sentence)
where:
ddd - degrees
000…180
mm.mmmm - minutes
00.0000…59.9999
E/W: East / West
x.x - Horizontal Diluition of Precision (referred to GGA sentence)
x.x - Altitude-mean-sea-level (geoid) in meters (referred to GGA sentence)
0 - Invalid Fix
2 - 2D fix
3 - 3D fix
ddd.mm - Course over Ground (degrees, True) (referred to VTG sentence)
where:
ddd - degrees
000…360
mm - minutes
00…59
x.x Speed over ground (Km/hr) (referred to VTG sentence)
x.x- Speed over ground (knots) (referred to VTG sentence)
ddmmyy Date of Fix (referred to RMC sentence)
where:
dd - day
01…31
mm - month
01…12
yy - year
00…99 - 2000 to 2099
nn - Total number of satellites in use (referred to GGA sentence)
00…12
高新兴模块的GPS定位信息参考借鉴了NMEA-0183协议定义的
G
P
G
G
A
语
句
格
式
和
GPGGA语句格式和
GPGGA语句格式和GPVTG语句格式,下面简单介绍一下GPS定位信息的几种语句,有必要对NEMA协议进行一定的了解。
NMEA协议是为了在不同的GPS(全球定位系统)导航设备中建立统一的BTCM(海事无线电技术委员会)标准,由美国国家海洋电子协会(NMEA-The National Marine Electronics Associa-tion)制定的一套通讯协议。GPS接收机根据NMEA-0183协议的标准规范,将位置、速度等信息通过串口传送到PC机、PDA等设备。NMEA-0183协议是GPS接收机应当遵守的标准协议,也是目前GPS接收机上使用最广泛的协议,大多数常见的GPS接收机、GPS数据处理软件、导航软件都遵守或者至少兼容这个协议。NMEA-0183协议定义的语句非常多,但是常用的或者说兼容性最广的语句只有
G
P
G
G
A
、
GPGGA、
GPGGA、GPGSA、
G
P
G
S
V
、
GPGSV、
GPGSV、GPRMC、
G
P
V
T
G
、
GPVTG、
GPVTG、GPGLL等。常用NMEA-0183语句的字段定义解释可以参考该帖子(https://blog.csdn.net/jickjiang/article/details/79086202)。
2.1.4 错误信息
在定位过程中当错误发生时,模块会主动上报错误结果码。如果返回ZGPSERROR:18表示定位超时。从定位开始后的255秒内如果没有定位成功,则会返回此错误。此错误原因大多是由于GPS信号弱引起的,出现该错误信息,请确保GPS天线在开阔地并且无遮挡。其他错误信息请抓取LOG后反馈。
其他错误码信息如下:
:
0 ERROR_ACCESS_DENIED
1 ERROR_ BAD_NET_RESP
2 ERROR_ BUSY
3 ERROR_ CANCELLED
4 ERROR_ CONNECTION_ABORTED
5 ERROR_ CONTINUE
6 ERROR_ FATAL_ERROR
7 ERROR_ GEN_FAILURE
8 ERROR_ INCORRECT_ADDRESS
9 GPS_ERR_INSUFFICIENT_SAT_SIGNAL
10 ERROR_ INVALID_CATEGORY
11 ERROR_ INVALID_PARAMETER
12 ERROR_ NETWORK_UNREACHABLE
13 ERROR_ NOT_AUTHENTICATED
14 ERROR_ NOT_CONNECTED
15 ERROR_ REQUEST_ABORTED
16 ERROR_ RETRY
17 ERROR_ OUTOFMEMORY
18 ERROR_ TIMEOUT
19 ERROR_ RADIO_OFF
2.1.5 GPS定位不成功时调试方法
在定位前使用at+zgmeasure=1命令,打开定位过程中的信息输出。开始定位后,观察zgmeasure的输出。
如果连续输出ZGMEASURE: 0,0,0,请确认GPS天线是否连接正常。
如果输出不为0,但还是定位慢,确认GPS天线是否在开阔地,无遮挡物。如果还是不行请抓取LOG后反馈。
2.2 SIMcom 7600CE模块
2.2.1 GPS相关指令介绍
对SIMcom模块GPS定位用到的相关指令参数进行详细介绍,如表2.2所示。
2.2.2 定位方法
(1) Standalone模式
3种方法可以开启Standalone模式定位,但命令必须在GPS引擎关闭后执行:
- AT+CGPS=1,1 (or AT+CGPS=1)
- AT+CGPSCOLD
- AT+CGPSHOT
输入指令AT+CGPSINFO可以返回定位信息,同时也可以使用指令AT+CGPSAUTO进行自动定位。
Standalone模式返回的定位信息格式如下:
+CGPSINFO: 3113.393766,N,12121.176625,E,061108,075358.0,19.5,0
(2) AGPS模式
在进行MS-based模式定位时,当从服务器获取到卫星信息后,模块会自动切换至Standalone模式,MS-based模式是一种连续定位方式。
对于不需要认证的AGPS服务器,定位顺序如下表2.3所示:
表2.3 MS-based模式定位方法(no certificate)
对于需要认证的AGPS服务器,定位顺序如下表2.4所示:
表2.3 MS-based模式定位方法(use certificate)
MS-based模式定位成功的话,其定位信息格式与Standalone模式返回的定位信息格式类似。
2.2.3 定位数据信息格式说明
获取的GPS定位信息格式如下:
+CGPSINFO:[], [<N/S>], [], [<E/W>], [], [], [], [], []
例子:
AT+CGPSINFO
+CGPSINFO:3113.343286,N,12121.234064,E,250311,072809.3,44.1,0.0,0
OK
定位信息中共包含9个参数,每个参数的意义如下:
Latitude of current position. Output format is ddmm.mmmmmm
<N/S>
N/S Indicator, N=north or S=south
Longitude of current position. Output format is dddmm.mmmmmm
<E/W>
E/W Indicator, E=east or W=west
Date. Output format is ddmmyy
UTC Time. Output format is hhmmss.s
MSL Altitude. Unit is meters.
Speed Over Ground. Unit is knots.
Course. Degrees.
2.2.4 错误信息
使用GPS定位功能时,或多或少会遇到一些问题,下面是一些常用问题的解决方式,仅供参考。
Why GPS does not start?
Please execute AT+CGPSCOLD, AT+CGPSHOT or AT+CGPS=1 to start GPS. If customers want to start GPS automatically when powered on the module, they can set AT+CGPSAUTO=1.
Why can we not get NMEA sentence?
1.Make sure GPS is running.
2.Check current opened port is NMEA port.
Why A-GPS does not get the fixed position?
1.Make sure all the setting is correct. Re. A-GPS quick start setting.
2.Make sure AGPS server address is available.
3.Is module camp on WCDMA or GSM network?
Why standalone mode cannot fix?
1.Is GPS antenna connected normally?
2.Is there existing GPS signal? If indoor or no GPS signal, standalone mode cannot fix.
How to get fixed position information?
1.AT+CGPSINFO command should get position information after fixed. It isURC information.
2.Parse NMEA sentence $GPGGA or $GPRMC.
3.If use MS-assisted, fixed position information will report automatically after it is fixed.
Why module cannot download XTRA file by HTTP?
1.Make sure the APN setting correct.
2.Make sure the module camp on the PS, i.e. AT+CGREG? Return 0,1
How to disable or enable the XTRA function?
1.Setting by AT+CGPSXE=<on/off>, the parameter 0 means disable and 1 means enable. Module must
be restarted after setting.
Can XTRA enhance the TFF?
1.Yes, TTF can be reduced by 18 to 30 sec (or more in harsh signal environments) for standalone cold start.
Which setting is necessary for XTRA?
1.Time synchronization.
2.Download XTRA file by HTTP.
If http is used for XTRA download, can it be used for another http connection?
1.No, HTTP is only allowed for one connection.
3. 参考文献
《SIM7X00 Series_GPS_Application Note_V1.00》
《SIM7500_SIM7600 Series_AT Command Manual_V1.07》
《高新兴物联ME3630&ME3630-W模组AT指令手册_V2.8》