4G

4G常用AT命令

移远模组

Posted by LXG on November 17, 2023

microcom 命令

microcom 是一个用于与串行调制解调器通信的命令

我们可以把 microcom 理解为是一个在终端命令行运行的串口调试助手,在调试串口时非常有用,例如调试 AT 指令

rk3399 RM500U 模组调试

busybox microcom 或者 直接执行microcom指令


rk3399_Android11:/ # microcom dev/ttyUSB5
at+cops?
+COPS: 0,2,"46001",7

OK

退出microcom指令的命令 CTRL+X 组合按键

常用 AT 命令


#查询卡是否成功识别
AT+CPIN?
+CPIN: READY

OK

#查询APN
AT+CGDCONT?
+CGDCONT: 1,"IPV4V6","3gnet","0.0.0.0",0,0,0,0,,,,,,0,,,0,,0,0,0,0
+CGDCONT: 11,"IPV4V6","ims","0.0.0.0",0,0,0,0,,,,,,0,,,0,,0,0,0,0

OK

#查询运营商
AT+QSPN
+QSPN: "CHN-UNICOM","UNICOM","CHN-UNICOM",0,"46001"

OK

#设置APN
AT+CGDCONT=1,"IP","3gnet"
OK

#查询网络信息:访问计数,运营商,频段
AT+QNWINFO
+QNWINFO: "FDD LTE",46001,"LTE BAND 3",1506
+QNWINFO: "NR5G-NSA",46001,"",0

OK

#查询网络配置优先级
AT+QNWPREFCFG="mode_pref"
+QNWPREFCFG: "mode_pref",AUTO

OK

#设置NSA入网
AT+QNWPREFCFG="mode_pref",NR5G-NSA
OK

#设置SA入网
AT+QNWPREFCFG="mode_pref",NR5G-SA
OK

#设置模组自动选择入网方式及优先级
AT+QNWPREFCFG="mode_pref",AUTO
OK

#拨号
AT+QNETDEVCTL=1,1,0
OK

#查询IP
AT+CGPADDR
+CGPADDR: 1,"10.66.98.208"
+CGPADDR: 11,""

OK

#查询信号强度NSA
AT+QENG="servingcell"
+QENG: "servingcell", "NOCONN"
+QENG: "LTE","FDD",460,01,B61D52,312,350,1,3,3,184B,-88,-9,-62,8,12,0,37
+QENG: "NR5G-NSA",460,01,589,-88,17,-3,627264,78,0,6219,1

OK

#查询信号强度SA
AT+QENG="servingcell"
+QENG: "servingcell","NOCONN","NR5G-SA","TDD",460,11,596961006,341,590E02,627264,78,100,-88,-10,5,20,28,1

OK

#查询运营商
AT+QSPN
+QSPN: "CHN-UNICOM","UNICOM","CHN-UNICOM",0,"46001"

OK

#查询运营商的另一种方法
AT+COPS=3,1
OK
AT+COPS?
+COPS: 0,1,"CUCC",13

OK

#查询当前使用的卡槽
AT+QUIMSLOT?
+QUIMSLOT: 1

OK

#切换为卡槽2
AT+QUIMSLOT=2
OK

#切换为卡槽1
AT+QUIMSLOT=1
OK

#查看模组温度
AT+QTEMP
+QTEMP: "soc-thermal","33"
+QTEMP: "pa-thermal","31"
+QTEMP: "pa5g-thermal","31"
+QTEMP: "board-thermal","32"

OK

RM500U 5G 模组适配

官方资料


Quectel_Android_RIL_Driver_V3.6.14_master_Release_1.5_20231013_10_54$ tree
.
├── doc
│   ├── autoReleaseNote.txt
│   ├── master_20231013_10_54_ReleaseNote.txt
│   ├── Quectel_Android_RIL_Driver_User_Guide_V2.0.pdf
│   └── ReleaseNote.txt
├── GNSS_32bits
│   ├── android.hardware.gnss@1.0.so
│   ├── android.hardware.gnss@1.1.so
│   ├── android.hardware.gnss@2.0-impl.so
│   ├── android.hardware.gnss@2.0.so
│   ├── gps_cfg.inf
│   ├── gps.default.so
│   └── Readme.txt
├── GNSS_64bits
│   ├── android.hardware.gnss@1.0.so
│   ├── android.hardware.gnss@1.1.so
│   ├── android.hardware.gnss@2.0-impl.so
│   ├── android.hardware.gnss@2.0.so
│   ├── android.hardware.gnss@2.1-service
│   ├── android.hardware.gnss@2.1.so
│   ├── gps_cfg.inf
│   ├── gps.default.so
│   └── Readme.txt
├── RIL_32bits
│   ├── chat32
│   ├── ip-down32
│   ├── ip-up32
│   ├── libreference-ril.so
│   ├── libril.so
│   └── ql-ril.conf
├── RIL_64bits
│   ├── chat
│   ├── ip-down
│   ├── ip-up
│   ├── libreference-ril.so
│   ├── libril.so
│   └── ql-ril.conf
└── tools
    ├── arm64-v8a
    │   ├── iperf
    │   ├── mpstat
    │   ├── QAndroidLog
    │   └── QFirehose
    └── armeabi-v7a
        ├── iperf
        ├── mpstat
        ├── QAndroidLog
        └── QFirehose

修改方案

manifest.xml


diff --git a/android/device/rockchip/common/4g_modem/manifest.xml b/android/device/rockchip/common/4g_modem/manifest.xml
index 9a19b3cf4f..71be215377 100644
--- a/android/device/rockchip/common/4g_modem/manifest.xml
+++ b/android/device/rockchip/common/4g_modem/manifest.xml
@@ -2,23 +2,13 @@
     <hal format="hidl">
         <name>android.hardware.radio</name>
         <transport>hwbinder</transport>
-        <fqname>@1.1::IRadio/slot1</fqname>
-        <fqname>@1.1::IRadio/slot2</fqname>
+        <fqname>@1.5::IRadio/slot1</fqname>
         <fqname>@1.2::ISap/slot1</fqname>
     </hal>
-    <hal format="hidl">
-        <name>android.hardware.radio.deprecated</name>
-        <transport>hwbinder</transport>
-        <version>1.0</version>
-        <interface>
-            <name>IOemHook</name>
-            <instance>slot1</instance>
-        </interface>
-    </hal>
     <hal format="hidl">
         <name>android.hardware.radio.config</name>
         <transport>hwbinder</transport>
-        <version>1.0</version>
+        <version>1.1</version>
         <interface>
             <name>IRadioConfig</name>
             <instance>default</instance>

device.mk


diff --git a/android/device/rockchip/common/device.mk b/android/device/rockchip/common/device.mk
index e4666e934a..cf3eb29ef0 100644
--- a/android/device/rockchip/common/device.mk
+++ b/android/device/rockchip/common/device.mk
@@ -258,27 +258,37 @@ ifeq ($(strip $(BOARD_HAS_RK_4G_MODEM)),true)
 PRODUCT_PACKAGES += \
     CarrierDefaultApp \
     CarrierConfig \
-    rild \
+    librilutils \
+    libhwbinder.vendor \
+    libhidltransport.vendor \
+    android.hardware.radio@1.5.vendor  \
+    android.hardware.radio@1.4.vendor  \
+    android.hardware.radio@1.3.vendor  \
+    android.hardware.radio@1.2.vendor  \
+    android.hardware.radio@1.1.vendor  \
+    android.hardware.radio.config@1.2.vendor  \
+    android.hardware.radio.config@1.1.vendor  \
+    android.hardware.radio.config@1.0.vendor  \
+    android.hardware.radio.deprecated@1.0.vendor  \
+    librilutils \
     librk-ril \
     dhcpcd
 
 PRODUCT_COPY_FILES += vendor/rockchip/common/phone/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/apns-conf.xml
 
-PRODUCT_PACKAGES += \
-    android.hardware.radio@1.2-radio-service \
-    android.hardware.radio.config@1.0-service
-
 PRODUCT_PROPERTY_OVERRIDES += \
                ro.boot.noril=false \
-               ro.telephony.default_network=9
+               ro.telephony.default_network=33
 
 ifeq ($(strip $(TARGET_ARCH)), arm64)
-PRODUCT_PROPERTY_OVERRIDES += \
-               vendor.rild.libpath=/vendor/lib64/librk-ril.so
 
 PRODUCT_COPY_FILES += \
                $(LOCAL_PATH)/4g_modem/bin64/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \
-               $(LOCAL_PATH)/4g_modem/lib64/librk-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/librk-ril.so
+               $(LOCAL_PATH)/4g_modem/bin64/rild:$(TARGET_COPY_OUT_VENDOR)/bin/hw/rild \
+               $(LOCAL_PATH)/4g_modem/bin64/rild.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/rild.rc  \
+               $(LOCAL_PATH)/4g_modem/lib64/libril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libril.so \
+               $(LOCAL_PATH)/4g_modem/lib64/libreference-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libreference-ril-quectel.so
+
 else
 PRODUCT_PROPERTY_OVERRIDES += \
                vendor.rild.libpath=/vendor/lib/librk-ril.so


rild.rc


diff --git a/android/hardware/ril/rild/rild.rc b/android/hardware/ril/rild/rild.rc
index f6beb5468f..40ff150b91 100644
--- a/android/hardware/ril/rild/rild.rc
+++ b/android/hardware/ril/rild/rild.rc
@@ -1,4 +1,4 @@
-service vendor.ril-daemon /vendor/bin/hw/rild
+service vendor.ril-daemon /vendor/bin/hw/rild  -l /vendor/lib64/libreference-ril-quectel.so
     class main
     user radio
     group radio cache inet misc audio log readproc wakelock

lib64 bin64 替换为移远提供的资料


device/rockchip/common/4g_modem$ tree
.
├── bin32
│   └── dhcpcd
├── bin64
│   ├── dhcpcd
│   ├── rild
│   └── rild.rc
├── lib32
│   └── librk-ril.so
├── lib64
│   ├── chat
│   ├── ip-down
│   ├── ip-up
│   ├── libreference-ril.so
│   ├── libril.so
│   ├── librk-ril.so
│   └── ql-ril.conf
└── manifest.xml

hardware/ril 编译修改

  1. mv libril/Android.mk libril/Android.mk.txt
  2. mv reference-ril/Android.mk reference-ril/Android.mk.txt
  3. mv rild/Android.mk rild/Android.mk.txt