本系列记载作者来到一个新的车载后装市场小公司,负责从新开始维护一套代码的心路过程。系统使用瑞芯微的rk3368芯片,版本是PX5_Android_8.0_release_20180726,从无到有的每个patch修改以及思考。其中着重点是驱动和系统相关,由于涉及到公司保密,所以APP部分暂时不贴过多的代码,只是针对系统bug进行记录。
2020_02_13 ---- 2020_02_14
GPS芯片为外来芯片,非瑞芯微SDK原生支持,所以需要经过仔细的调试和检查。
原理图:
需要注意控制的地方也就是i2c,reset对应gpio,一个LDO,一个LDO对应的gpio开关,还有一个主要注意的就是Safeboot引脚(此处datasheet有写,需要配置成固定电平而不是悬空,以增加GPS的稳定性。)
dts中有两部分代码,分别是rfkill和uart0的使能和配置。
diff --git a/arch/arm64/boot/dts/rockchip/rk3368-px5-evb-android.dts b/arch/arm64/boot/dts/rockchip/rk3368-px5-evb-android.dts
index 1a618d3..f139462 100644
--- a/arch/arm64/boot/dts/rockchip/rk3368-px5-evb-android.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3368-px5-evb-android.dts
@@ -249,7 +249,17 @@
status = "okay";
};
+ wireless-gps {
+ compatible = "gps-platdata";
+ keep_bt_power_on;
+ GPS,power_gpio = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
+ GPS,rst = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>;
+ GPS,safeboot = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>;
+
+ status = "okay";
+ };
+
gpio_det: gpio-det {
compatible = "gpio-detection";
status = "okay";
@@ -1212,6 +1222,12 @@
status = "okay";
};
+&uart0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart0_xfer>;
+ status = "okay";
+};
+
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_xfer &uart1_cts>;
还有就是自己编写的rfkill文件,对应于设备的电源管理,reset管理等等。
/*
* Copyright (C) 2016 ROCKCHIP, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU