I.MX6 Android U-blox miniPCI 4G porting
/************************************************************************** * I.MX6 Android U-blox miniPCI 4G porting * 声明: * 在移植U-blox的4G模块的过程中遇到了不少的问题,有不少是自己的这边疏忽 * 的问题,无论怎么说,问题解决了就行。 * * 2016-1-11 深圳 南山平山村 曾剑锋 *************************************************************************/ 一、参考文档: 1. 飞思卡尔i.MX 6Quad Android 4.0.4的3G驱动移植 http://blog.csdn.net/xnwyd/article/details/9498235 2. 关于 android RIL 调试 http://blog.lytsing.org/archives/476.html 二、ublox设备miniPCI识别到的设备节点: 1. 只有一个: /dev/ttyACM0. 2. 原因如下: 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. 1. AT+UUSBCONF=0,””,0 // It need reboot the module. 2. AT+CFUN=16 // this command will reboot the module, or you can reboot device instead of. 3. AT+UUSBCONF? For more detail description, please check attach file(AT-CommandExample), chapter 22 USB profile configuration. 三、重新配置ublox: 1. 参考《AT Commands Examples Examples for u-blox cellular modules Application Note》; 2. chapter 22 USB profile configuration: Fairly back-compatible profile This is the configuration (<id>=0) similar to the one implemented in the u-blox LISA-U series. The interfaces available are: 1. 3 CDC-ACM for AT command and data 2. 1 CDC-ACM for GNSS tunnelling 3. 1 CDC-ACM for SIM Access profile (SAP) 4. 1 CDC-ACM for diagnostic This configuration is identified by: VID = 0x1546 PID = 0x1141 省略后面的命令说明... 3. 使用串口工具,对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 9600. workMode: send and recv. AT+UUSBCONF=0,"",0 OK 4. dmesg信息提示如下: ...... usb 2-1.4: new high speed USB device number 3 using fsl-ehci imx-ipuv3 imx-ipuv3.0: IPU DMFC DP HIGH RESOLUTION: 1(0,1), 5B(2~5), 5F(6,7) cdc_acm 2-1.4:1.0: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.0: ttyACM0: USB ACM device cdc_acm 2-1.4:1.2: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.2: ttyACM1: USB ACM device cdc_acm 2-1.4:1.4: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.4: ttyACM2: USB ACM device cdc_acm 2-1.4:1.6: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.6: ttyACM3: USB ACM device cdc_acm 2-1.4:1.8: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.8: ttyACM4: USB ACM device cdc_acm 2-1.4:1.10: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.10: ttyACM5: USB ACM device ...... 5. 厂家的FAE说上面的错误可以不用关心 This device cannot do calls on its own. It is not a modem. 四、配置Android系统: 1. 参考文档:《Android RIL Production delivery – Source code Application Note》 2. 参考章节: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: 1. Error1: 1. 出错信息: init: cannot execve('/system/bin/uril-repo.sh'): No such file or directory 2. 查看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 0770 /data/uril^M cat /etc/uril/repository.txt > $URIL_REPO_DST^M chmod 0660 $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 1/25 4% 3. 通过查看文件,发现其中的每行最后都多出了^M这个字符,貌似这个文件是在Windows上面编辑的。 4. 删除这些^M。 5. 但是这个字符在Ubuntu、Vim中都看不到,这貌似有点奇怪。 6. 有点忧伤的地方在于U-Blox提供的etc下的配置文件都是这种文件,他们提供错了文档。 2. Error2: 1. adb logcat -v time -b radio > logcat_info.txt 2. 错误信息: 01-01 00:00:05.570 I/RIL ( 2286): 3G modem monitor thread is start 01-01 00:00:05.570 E/RILD ( 2286): dlopen failed: Cannot load library: load_library(linker.cpp:745): library "/system/lib/libhuawei-ril.so" not found 01-01 00:00:05.620 I/RIL-repo( 2348): created /data/uril/repository.txt 01-01 00:00:10.100 E/RILD ( 2604): dlopen failed: Cannot load library: load_library(linker.cpp:745): library "/system/lib/libhuawei-ril.so" not found ...... 3. 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; } ...... } 4. 修改REFERENCE_RIL_DEF_PATH的值为: "/system/lib/librapid-ril-core.so" 5. 根据rild.c中代码的运行流程可知,命令行中的-l参数是无效。 3. 能够获取GSM信号,但无法获取网络数据: 1. 模块问题检查: root@android:/data/local # ./autorun.sh CMD: AT+UUSBCONF?. +UUSBCONF: 3,"RNDIS",,"0x1146" OK CMD: AT+UUSBCONF=0,"",0. OK CMD: AT+CFUN=16. usb 2-1.4: USB disconnect, device number 32 usb 2-1.4: new high speed USB device number 33 using fsl-ehci usb 2-1.4: USB disconnect, device number 33 usb 2-1.4: new high speed USB device number 34 using fsl-ehci cdc_acm 2-1.4:1.0: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.0: ttyACM0: USB ACM device cdc_acm 2-1.4:1.2: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.2: ttyACM1: USB ACM device cdc_acm 2-1.4:1.4: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.4: ttyACM2: USB ACM device cdc_acm 2-1.4:1.6: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.6: ttyACM3: USB ACM device cdc_acm 2-1.4:1.8: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.8: ttyACM4: USB ACM device cdc_acm 2-1.4:1.10: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.10: ttyACM5: USB ACM device CMD: AT+UUSBCONF?. +UUSBCONF: 0,"",,"0x1141" OK usb 2-1.4: USB disconnect, device number 34 usb 2-1.4: new high speed USB device number 35 using fsl-ehci usb 2-1.4: USB disconnect, device number 35 usb 2-1.4: new high speed USB device number 36 using fsl-ehci cdc_acm 2-1.4:1.2: This device cannot do calls on its own. It is not a modem. cdc_acm 2-1.4:1.2: ttyACM0: USB ACM device CMD: AT+UUSBCONF?. AT+UUSBCONF? +UUSBCONF: 3,"RNDIS",,"0x1146" OK ATE0V1 OK 2. 从1中可以看出: 将模块设置为Fairly back-compatible模式的时候,移植的系统又会自动将模块 重置为High throughput模式,无法稳定工作在Fairly back-compatible模式。 3. 原因是 "hardware/ril/ublox_ril/CORE/ND/systemmanager.cpp” 的 1729 行. 4. 解决办法: 1. 参考《AndroidRIL-SourceCode_AppNote.pdf》中"章节 I, Repository file configuration". 2. cat build/target/product/rootdir/etc/uril/repository.txt ...... // Modem settings Group Modem SupportedModem UbloxModem //NetworkInterfaceName USB // 修改为ppp NetworkInterfaceName ppp DisableModemReset 0 ...... // USB Profile Configuration Group USBUBM // 将RNDIS模式修改为CDC-ACM模式 // USBCONF 3 // 0: CDC-ACM, 2: CDC-ECM, 3: RNDIS USBCONF 0 // 0: CDC-ACM, 2: CDC-ECM, 3: RNDIS UBMCONF 1 // 1: Router, 2: Bridge ......