I.MX6 Android U-blox miniPCI 4G porting

时间:2023-03-08 15:03:27
I.MX6 Android U-blox miniPCI 4G porting
/**************************************************************************
* I.MX6 Android U-blox miniPCI 4G porting
* 声明:
* 在移植U-blox的4G模块的过程中遇到了不少的问题,有不少是自己的这边疏忽
* 的问题,无论怎么说,问题解决了就行。
*
* 2016-1-11 深圳 南山平山村 曾剑锋
*************************************************************************/ 一、参考文档:
. 飞思卡尔i.MX 6Quad Android 4.0.4的3G驱动移植
http://blog.csdn.net/xnwyd/article/details/9498235
. 关于 android RIL 调试
http://blog.lytsing.org/archives/476.html 二、ublox设备miniPCI识别到的设备节点:
. 只有一个: /dev/ttyACM0.
. 原因如下:
the USB mode of MPCI-L210 module in "RNDIS" mode, so it will only create one and only one ttyACM0 node. If you need to use ttyACM0, ttyACM1 and ttyACM2. please execute following command:
// Set USB configuration to "fairly back-compatible" and disable the audio over USB.
. AT+UUSBCONF=,””,
// It need reboot the module.
. AT+CFUN=
// this command will reboot the module, or you can reboot device instead of.
. AT+UUSBCONF?
For more detail description, please check attach file(AT-CommandExample), chapter USB profile configuration. 三、重新配置ublox:
. 参考《AT Commands Examples Examples for u-blox cellular modules Application Note》;
. chapter USB profile configuration: Fairly back-compatible profile
This is the configuration (<id>=) similar to the one implemented in the u-blox LISA-U series. The interfaces available are:
. CDC-ACM for AT command and data
. CDC-ACM for GNSS tunnelling
. CDC-ACM for SIM Access profile (SAP)
. CDC-ACM for diagnostic
This configuration is identified by:
VID = 0x1546
PID = 0x1141
省略后面的命令说明...
. 使用串口工具,对ublox进行配置,我使用的是自己之前写的命令行的串口工具,参考:《I.MX6 Android Linux UART send receive with multi-thread and multi-mode demo》
root@android:/data/local # ./autorun.sh
serialString : /dev/ttyACM0.
baudRate .
workMode: send and recv.
AT+UUSBCONF=,"", OK . dmesg信息提示如下:
......
usb -1.4: new high speed USB device number using fsl-ehci
imx-ipuv3 imx-ipuv3.: IPU DMFC DP HIGH RESOLUTION: (,), 5B(~), 5F(,)
cdc_acm -1.4:1.0: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.0: ttyACM0: USB ACM device
cdc_acm -1.4:1.2: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.2: ttyACM1: USB ACM device
cdc_acm -1.4:1.4: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.4: ttyACM2: USB ACM device
cdc_acm -1.4:1.6: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.6: ttyACM3: USB ACM device
cdc_acm -1.4:1.8: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.8: ttyACM4: USB ACM device
cdc_acm -1.4:1.10: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.10: ttyACM5: USB ACM device
......
. 厂家的FAE说上面的错误可以不用关心
This device cannot do calls on its own. It is not a modem. 四、配置Android系统:
. 参考文档:《Android RIL Production delivery – Source code Application Note》
. 参考章节:Appendix - D Android 4.1/ 4.2 / 4.3 / 4.4 module configuration
To enable the USB module connection, configure Ueventd.[platform].rc, AndroidProducts.mk and init.rc files as described in sections below. Before changing the files, below are some necessary steps to follow. 五、Error:
. Error1:
. 出错信息:
init: cannot execve('/system/bin/uril-repo.sh'): No such file or directory
. 查看uril-repo.sh文件:busybox vi uril-repo.sh
#!/system/bin/sh^M
^M
URIL_REPO_DST=/data/uril/repository.txt^M
^M
rril_repo_missing=`ls $URIL_REPO_DST`true^M
^M
if (${rril_repo_missing}) ; then^M
mkdir /data/uril^M
chmod /data/uril^M
cat /etc/uril/repository.txt > $URIL_REPO_DST^M
chmod $URIL_REPO_DST^M
sync^M
/system/bin/log -t RIL-repo "created $URIL_REPO_DST"^M
else^M
/system/bin/log -t RIL-repo "$URIL_REPO_DST exists"^M
fi^M
^M
# set this property after checking that repository exists or after it's created^
# This is checked in rildmain mainloop during RIL_Init^M
/system/bin/setprop "net.uril.repository" "ready"^M
^M
# set this property to configure emergency number if required^M
#/system/bin/setprop "ril.ecclist" "111,112,113,115,117,118,119,122,125,127,911,
- uril-repo.sh / %
. 通过查看文件,发现其中的每行最后都多出了^M这个字符,貌似这个文件是在Windows上面编辑的。
. 删除这些^M。
. 但是这个字符在Ubuntu、Vim中都看不到,这貌似有点奇怪。
. 有点忧伤的地方在于U-Blox提供的etc下的配置文件都是这种文件,他们提供错了文档。
. Error2:
. adb logcat -v time -b radio > logcat_info.txt
. 错误信息:
- ::05.570 I/RIL ( ): 3G modem monitor thread is start - ::05.570 E/RILD ( ): dlopen failed: Cannot load library: load_library(linker.cpp:): library "/system/lib/libhuawei-ril.so" not found - ::05.620 I/RIL-repo( ): created /data/uril/repository.txt - ::10.100 E/RILD ( ): dlopen failed: Cannot load library: load_library(linker.cpp:): library "/system/lib/libhuawei-ril.so" not found ......
. cat hardware/ril/rild/rild.c
......
// #define REFERENCE_RIL_DEF_PATH "/system/lib/libhuawei-ril.so"
......
int main(int argc, char **argv)
{
......
switch (modem_type){
case ZTE_MODEM:
rilLibPath = REFERENCE_RIL_ZTE_PATH;
break; case HUAWEI_MODEM:
case AMAZON_MODEM:
default:
rilLibPath = REFERENCE_RIL_DEF_PATH;
break;
}
......
}
. 修改REFERENCE_RIL_DEF_PATH的值为:
"/system/lib/librapid-ril-core.so"
. 根据rild.c中代码的运行流程可知,命令行中的-l参数是无效。
. 能够获取GSM信号,但无法获取网络数据:
. 模块问题检查:
root@android:/data/local # ./autorun.sh
CMD: AT+UUSBCONF?. +UUSBCONF: ,"RNDIS",,"0x1146" OK
CMD: AT+UUSBCONF=,"",. OK
CMD: AT+CFUN=.
usb -1.4: USB disconnect, device number
usb -1.4: new high speed USB device number using fsl-ehci
usb -1.4: USB disconnect, device number
usb -1.4: new high speed USB device number using fsl-ehci
cdc_acm -1.4:1.0: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.0: ttyACM0: USB ACM device
cdc_acm -1.4:1.2: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.2: ttyACM1: USB ACM device
cdc_acm -1.4:1.4: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.4: ttyACM2: USB ACM device
cdc_acm -1.4:1.6: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.6: ttyACM3: USB ACM device
cdc_acm -1.4:1.8: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.8: ttyACM4: USB ACM device
cdc_acm -1.4:1.10: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.10: ttyACM5: USB ACM device
CMD: AT+UUSBCONF?. +UUSBCONF: ,"",,"0x1141" OK
usb -1.4: USB disconnect, device number
usb -1.4: new high speed USB device number using fsl-ehci
usb -1.4: USB disconnect, device number
usb -1.4: new high speed USB device number using fsl-ehci
cdc_acm -1.4:1.2: This device cannot do calls on its own. It is not a modem.
cdc_acm -1.4:1.2: ttyACM0: USB ACM device
CMD: AT+UUSBCONF?.
AT+UUSBCONF?
+UUSBCONF: ,"RNDIS",,"0x1146" OK ATE0V1
OK
. 从1中可以看出:
将模块设置为Fairly back-compatible模式的时候,移植的系统又会自动将模块
重置为High throughput模式,无法稳定工作在Fairly back-compatible模式。
. 原因是 "hardware/ril/ublox_ril/CORE/ND/systemmanager.cpp” 的 1729 行.
. 解决办法:
. 参考《AndroidRIL-SourceCode_AppNote.pdf》中"章节 I, Repository file configuration".
. cat build/target/product/rootdir/etc/uril/repository.txt
......
// Modem settings
Group Modem
SupportedModem UbloxModem
//NetworkInterfaceName USB // 修改为ppp
NetworkInterfaceName ppp
DisableModemReset
......
// USB Profile Configuration
Group USBUBM
// 将RNDIS模式修改为CDC-ACM模式
// USBCONF 3 // 0: CDC-ACM, 2: CDC-ECM, 3: RNDIS
USBCONF // 0: CDC-ACM, 2: CDC-ECM, 3: RNDIS
UBMCONF // 1: Router, 2: Bridge
......