邵阳网站开发比百度好用的搜索软件手机版
适配前理清楚一下调试的流程:
1.该模块为LGA封装,需要控制上电时序模块才能正常上电工作:
2.模块供电正常后,读取模组的PID 和VID 并将其ID添加到内核里面,确保USB转Serial端口能够正常生成:
3.生成ttyUSB0~ttyUSB2端口后,确保rild进程正常启动,能够正常加载ril库;
4.查看一下AT命令集,善于捕捉ril log,熟练使用 logcat -b radio,移远方案,可以通过创建文件
/data/quectel_debug_log 来存储RIL 加载信息,同时瑞芯微对应4G模块这方面的资料也是比较完善的,可以阅读一下
RKDocs/common/mobile-net/Rockchip_Introduction_4G_Module_Configuration_CN\&EN.pdf。流程理清楚了,我们就可以在我们的硬件平台上来移植4G模组了。
//偷个懒,将EC200A的module PWR RK0_PB4和reset脚RK0_PB1 控制添加到LED灯的控制驱动里面,
//将 module PWR RK0_PB4 置高,将reset脚RK0_PB1置低#include "rk3566-box.dtsi"/ {model = "Rockchip RK3566 BOX DM35 Project";compatible = "rockchip,rk3568-box-demo-v10", "rockchip,rk3566";gpio-leds {compatible = "gpio-leds";// ir-led {
// gpios = <&gpio4 RK_PC5 GPIO_ACTIVE_HIGH>;
// default-state = "off";
// };//MODULE_PWR GPIO0_B4+ modem-resetled {
+ gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_LOW>;
+ default-state = "on";
+ };+ modem-led {
+ gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };work-led { /*led GPIO0_C3_d*/gpios = <&gpio0 RK_PC3 GPIO_ACTIVE_HIGH>;//linux,default-trigger = "timer";default-state = "on";};};-------------------------------------------------------------wireless_bluetooth: wireless-bluetooth {compatible = "bluetooth-platdata";clocks = <&pmucru CLK_RTC_32K>;clock-names = "ext_clock";//wifi-bt-power-toggle;uart_rts_gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>;pinctrl-names = "default", "rts_gpio";pinctrl-0 = <&uart1m0_rtsn>;pinctrl-1 = <&uart1_gpios>;BT,reset_gpio = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;BT,wake_gpio = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>;BT,wake_host_irq = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>;status = "okay";};
+//添加4G模块的上电初始化时序,以确保模块能够正常上电工作+rk_modem: rk-modem {+ compatible="4g-modem-platdata";+ pinctrl-names = "default";+ pinctrl-0 = <<e_vbat <e_power_en /*<e_reset*/>;+ 4G,vbat-gpio = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; //VBUS_CTRL+ 4G,power-gpio = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; //MODULE_PWRKEY+ //4G,reset-gpio = <&gpio0 RK_PB1 GPIO_ACTIVE_LOW>; //MODULE_RESET_N+ //MODULE_PWR GPIO0_B4+ status = "okay";+};wireless-wlan {wifi_host_wake_irq: wifi-host-wake-irq {rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>;};};wireless-bluetooth {uart1_gpios: uart1-gpios {rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;};};+ rk-modem {
+ lte_vbat: lte-vbat {
+ rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ lte_power_en: lte-power-en {
+ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+// lte_reset: lte-reset {
+// rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
+// };};修改完这些之后,使用lsusb命令查看模块的PID和VID
Bus 005 Device 001: ID 1d6b:0002
Bus 003 Device 001: ID 1d6b:0001
Bus 001 Device 001: ID 1d6b:0002
Bus 008 Device 001: ID 1d6b:0003
Bus 006 Device 001: ID 1d6b:0003
Bus 001 Device 004: ID 2c7c:6005
Bus 004 Device 001: ID 1d6b:0001
Bus 002 Device 001: ID 1d6b:0002
Bus 007 Device 001: ID 1d6b:0002上面显示的2c7c:6005就是我们4G模块的VID和PID,这说明我们的上电时序已经修改成了,接下来修改内核,添加模块的VID和PIDgit diff arch/arm64/configs/rockchip_defconfig
diff --git a/kernel/arch/arm64/configs/rockchip_defconfig b/kernel/arch/arm64/configs/rockchip_defconfig
index 3c1008aab5..66a6cc02a9 100644
--- a/kernel/arch/arm64/configs/rockchip_defconfig
+++ b/kernel/arch/arm64/configs/rockchip_defconfig
@@ -776,6 +776,7 @@ CONFIG_USB_UAS=yCONFIG_USB_DWC3=yCONFIG_USB_DWC2=yCONFIG_USB_SERIAL=y
+CONFIG_USB_SERIAL_WWAN=yCONFIG_USB_SERIAL_GENERIC=yCONFIG_USB_SERIAL_OPTION=yCONFIG_USB_SERIAL_CH341=ykernel$ git diff drivers/usb/serial/option.c
diff --git a/kernel/drivers/usb/serial/option.c b/kernel/drivers/usb/serial/option.c
index ff67562572..497ca259de 100644
--- a/kernel/drivers/usb/serial/option.c
+++ b/kernel/drivers/usb/serial/option.c
@@ -2126,6 +2126,23 @@ static const struct usb_device_id option_ids[] = {{ USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */{ USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */{ USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */
+#if 1 //Added by Quectel
+#if 1 //Added by Quectel
diff --git a/kernel/drivers/usb/serial/option.c b/kernel/drivers/usb/serial/option.c
index ff67562572..497ca259de 100644
--- a/kernel/drivers/usb/serial/option.c
+++ b/kernel/drivers/usb/serial/option.c
@@ -2126,6 +2126,23 @@ static const struct usb_device_id option_ids[] = {{ USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */{ USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */{ USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */
+#if 1