我这里GPS使用的是TTL串口GPS芯片,用的是uart0
1.确认原理图对应的uart节点,将其打开
&uart0 {
status = "okay";
dma-names = "!tx", "!rx";
pinctrl-0 = <&uart0_xfer &uart0_cts>;
};
2.在hal层编译出 gps.default.so 目录在hardware/rockchip/gps/
有的目录下自带ublox 没有的话自己添加一个编译出so库
在gps_zkw_v3.c中 #define GNSS_TTY "/dev/ttyS0" 选择你主板使用的串口号
代码下载:https://pan.baidu.com/s/1nuZqAmWTevsc1VmBg-gAjQ 提取码:s677
3.在device/rockchip目录下面grep 一下与gps相关的东西。
device/rockchip/common/BoardConfig.mk
-BOARD_HAS_GPS ?= false
+BOARD_HAS_GPS ?= true
+BOARD_GPS_TYPE ?= ublox
device/rockchip/rk3288/system.prop
-persist.sys.gpsTTY=/dev/ttyS3
+persist.sys.gpsTTY=/dev/ttyS0
编译烧录后可先查看串口信息:
rk3288:/ $ cat /dev/ttyS0
$GPRMC,033843.00,A,2231.85141,N,11403.89116,E,0.156,,300519,,,D*7D
$GPVTG,,T,,M,0.156,N,0.288,K,D*26
$GPGGA,033843.00,2231.85141,N,11403.89116,E,2,11,2.38,265.5,M,-2.3,M,,0000*4A
$GPGSA,A,3,11,18,23,50,01,42,09,22,08,30,07,,3.48,2.38,2.53*0F
$GPGSV,5,1,17,01,42,170,44,03,00,176,,04,29,264,26,07,56,321,29*7D
$GPGSV,5,2,17,08,56,008,24,09,29,241,30,11,68,196,31,16,18,076,21*75
$GPGSV,5,3,17,18,59,135,44,22,06,157,27,23,21,201,34,26,00,096,34*71
串口获取信息正常,在设置--位置信息--模式--模式选择 高精确度
最后安装gpstest.apk收星测试,