S5P4418 android 5.1 EC20 R2.0 PCIE接口调试记录

 

硬件:三星S5P4418

软件:android 5.1.1

模块:移远EC20 R2.0 PCIE接口

1.USB驱动:Quectel_WCDMA<E_Linux_USB_Driver_User_Guide_V1.6.pdf

2.RIL库使用说明quectel_ril_porting_guide.txt

下面记录自己调试过程:

EC20的PCIE接口本质上也是USB接口,拔插EC20可以看到如下信息:

[  272.964000] usb 1-1.3: New USB device found, idVendor=2c7c, idProduct=0125

现状:
dev下面没有ttyUSB0,ttyUSB1,ttyUSB2,ttyUSB3,

1.驱动配置
[KERNEL]目录下进行配置
make menuconfig 
1.1 USB Driver Configure
Device Drivers  --->
    [*] USB support  --->
            <*> USB Serial Converter support
                  [*] USB Generic Serail Driver
                  [*] USB Driver for GSM and CMDA modems


1.2 USB Driver Configure
Device Drivers  --->
      [*] USB support  --->
            <*> USB Modem (CDC ACM) suppor

参考文章里的PPP设置我的已经配置过了

 

PPP Configure(我是把与PPP相关的全部选上了)
    Device Drivers  --->
      [*] Network device support  --->
        <*> PPP (point-to-point protocol) support
        <*> PPP support for async serial ports
        <*> PPP support for sync tty ports
        <*> PPP Deflate compression


编译现象依旧,dev下面没有ttyUSB0,ttyUSB1,ttyUSB2,ttyUSB3,
1.3
[KERNEL]/drivers/usb/serial/option.c 新增
static const struct usb_device_id option_ids[] = {
#if 1 //Added by Quectel
{ USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */
{ USB_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */
{ USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */
{ USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC25/EC20 R2.0 */
{ USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */
#endif


[KERNEL]/drivers/usb/serial/qcserial.c 新增
 static const struct usb_device_id id_table[] = {
#if 1 //Added by Quectel
{ USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */
{ USB_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */
{ USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */
{ USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC25/EC20 R2.0 */
{ USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */
#endif


[KERNEL]/drivers/net/usb/qmi_wwan.c 新增
 #if 1 //Added by Quectel
{QMI_GOBI_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */
{QMI_GOBI_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */
{QMI_GOBI_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */
{QMI_GOBI_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC25/EC20 R2.0 */
{QMI_GOBI_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */
#endif


[KERNEL]/drivers/usb/serial/usb_wwan.c 新增
 static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint,
int dir, void *ctx, char *buf, int len,void (*callback) (struct urb *))


#if 1  //Added by Quectel for Zero Packet
if (dir == USB_DIR_OUT) {
struct usb_device_descriptor *desc = &serial->dev->descriptor;
if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9090))
urb->transfer_flags |= URB_ZERO_PACKET;
if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9003))
urb->transfer_flags |= URB_ZERO_PACKET;
if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9215))
urb->transfer_flags |= URB_ZERO_PACKET;
if (desc->idVendor == cpu_to_le16(0x2C7C))
urb->transfer_flags |= URB_ZERO_PACKET;
}
#endif
return urb;

 


配置启动,我的源码已经配置,此处做记录
/system/core/rootdir/init.rc
service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so
class main
socket rild stream 660 root radio 
socket rild-debug stream 666 radio system 
user root 
group radio cache inet misc audio sdcard_rw log

并且在init.rc文件中加入quectel-pppd服务
service quectel-pppd /etc/ppp/init.quectel-pppd
class main
user root
group radio cache inet misc log
disabled
oneshot

修改服务权限

我的源码已经配置,此处做记录

 

modifying the Right of service ril-daemon
    serivce ril-daemon require root privilege. 
    comment out the function switchUser() in the file hardware/ril/rild/rild.c. as below:
    OpenLib:
    #endif
      //switchUser();


编译后可以看到ttyUSB0,ttyUSB1,ttyUSB2,ttyUSB3
AT测试命令
cat /dev/ttyUSB2 &
echo -e "AT\r\n" >/dev/ttyUSB2
echo -e "AT+CSQ\r\n" >/dev/ttyUSB2
echo -e "AT+CGDCONT=1,"IP","3gnet",,0,0\r\n" >/dev/ttyUSB2


echo -e "AT+QCCID\r\n" >/dev/ttyUSB2
echo -e "AT+CREG?\r\n" >/dev/ttyUSB2


echo -e "AT+QICSGP=1,"CHINA MOBILE"" >/dev/ttyUSB2
echo -e "AT+QICSGP=1,"UNINET"" >/dev/ttyUSB2


1.4
[KERNEL]/drivers/usb/serial/option.c 新增 编译通过后好像没什么变化 
 static int option_probe(struct usb_serial *serial, const struct usb_device_id *id) {
struct usb_wwan_intf_private *data;
……
#if 1   //Added by Quectel
//Quectel UC20's interface 4 can be used as USB Network device
if  (serial->dev->descriptor.idVendor  ==  cpu_to_le16(0x05C6)  && 
serial->dev->descriptor.idProduct == cpu_to_le16(0x9003)
&& serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
return -ENODEV;
//Quectel EC20's interface 4 can be used as USB Network device
if  (serial->dev->descriptor.idVendor  ==  cpu_to_le16(0x05C6)  && 
serial->dev->descriptor.idProduct == cpu_to_le16(0x9215)
&& serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
return -ENODEV;
//Quectel EC21&EC25&EC20 R2.0's interface 4 can be used as USB Network device
if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)
&& serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
return -ENODEV;
#endif
        data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
        if (!data)
                return -ENOMEM;
        data->send_setup = option_send_setup;
        spin_lock_init(&data->susp_lock);
        data->private = (void *)id->driver_info;
        return 0;
}
编译后可以看到ttyUSB0,ttyUSB1,ttyUSB2,ttyUSB3

1.5
extract Quectel's reference-ril.zip to hardware/ril/reference-ril/ 删除原来的hardware/ril/reference-ril文件夹,再把移远提供的reference-ril文件夹复制过去

编译后可以看到有SIM卡信号,可以查到SIM卡状态,基带版本为:EC20CFDR02A09M4G,并且可以打开移动数据网络,但盒子不能上网,接入点APN为空,并且不能添加APN


我们用的移动的物联网卡的AT+CIMI为460040624301049
IMSI共有15位,其结构如下:MCC+MNC+MSIN ,(MNC+MSIN=NMSI)
MCC:Mobile Country Code,移动国家码,MCC的资源由国际电联(ITU)统一分配和管理,唯一识别移动用户所属的国家,共3位,中国为460;  
MNC:Mobile Network Code,移动网络码,共2位,中国移动TD系统使用00,中国联通GSM系统使用01,中国移动GSM系统使用02,中国电信CDMA系统使用03,
一个典型的IMSI号码为460030912121001
MSIN:Mobile Subscriber Identification Number共有10位,其结构如下:09+M0M1M2M3+ABCD 
其中的M0M1M2M3和MDN号码中的H0H1H2H3可存在对应关系,ABCD四位为自由分配。可以看出IMSI在MSIN号码前加了MCC即NMSI,
可以区别出每个用户的来自的国家,因此可以实现国际漫游。在同一个国家内,如果有多个移动网络运营商,可以通过MNC来进行区别。
修改APN文件 ,device/nexell/g4418/lte/vim apns-conf.xml 
增加460,04,具体内容参照原有设置,或者如下:
          mcc="460"
      mnc="04"
      apn="cmnet"
      type="default,supl"
  />
编译后可以上网,测试
shell@g4418:/ # netcfg
eth0     UP                                     0.0.0.0/0   0x00001003 f6:85:6b:df:f5:60
ppp0     UP                               10.117.22.153/32  0x000010d1 00:00:00:00:00:00
sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00
ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00



[KERNEL]/drivers/usb/serial/option.c 新增  编译失败unknown field 'reset_resume' specified in initializer
static struct usb_serial_driver option_1port_device = {
……
#ifdef CONFIG_PM
.suspend            = usb_wwan_suspend,
.resume             = usb_wwan_resume,
#if 1   //Added by Quectel
.reset_resume    = usb_wwan_resume,
#endif
#endif
};

 

以下两篇文章是主要的参考,还有移远的自己的资料:

 

 

转自:http://blog.csdn.net/dddxxxx/article/details/64437901

1.实验目的:实现4G模块EC20在Android4.4系统下的拨号上网

2.实验平台:迅为4412开发板,创思通信的EC20。

3.实验流程: (1)驱动实现EC20的USB接口与开发板相连,向Linux内核添加4G模块的驱动和PPP协议的支持(这部分和Linux下的一样,只是把在Android下运行的内核用脚本覆盖就可以,迅为Android4.4的是:config_for_android_scp_wifi&Bluetooth);然后编译内核并下载到开发板。内核具体配置:

Linux Kernel Configure by "make menuconfig"
  1.1 USB Driver Configure for EC20
    Device Drivers  --->
      [*] USB support  --->
        <*> USB Serial Converter support
          [*] USB Generic Serail Driver
          [*] USB Driver for GSM and CMDA modems

EC20 's Vendor ID and Product ID in option_ids[] of drivers/usb/serial/option.c
	static const struct usb_device_id option_ids[] = {
		{ USB_DEVICE(0x05C6, 0x9215) },  //for EC20

PPP Configure(我是把与PPP相关的全部选上了)
    Device Drivers  --->
      [*] Network device support  --->
        <*> PPP (point-to-point protocol) support
        <*> PPP support for async serial ports
        <*> PPP support for sync tty ports
        <*> PPP Deflate compression

注:EC20手册上说的零包机制的添加,我按照手册添加到我的内核中,但是编译一直出错,我最后没加进去,不影响实现的!

(2)Android下RIL层实现这一部分对应的是Android源码下/hardware/ril/文件夹

这里写图片描述

与厂商对应(不同模块)对应的是/hardware/ril/reference-ril/文件夹

这里写图片描述

Android4.4源码中的reference-ril/文件:

这里写图片描述

EC20提供的reference-ril/文件:

S5P4418 android 5.1 EC20 R2.0 PCIE接口调试记录_第1张图片

我是直接先删除原来的reference-ril文件夹,再把创思提供的reference-ril文件夹复制过去,直接拷贝过去就行,不用修改!

(3)启动文件init.rc 配置目录:

这里写图片描述

将原Android下的service ril-daemon服务注释或者删掉,换成对应的service ril-daemon 原:

S5P4418 android 5.1 EC20 R2.0 PCIE接口调试记录_第2张图片

修改为:

service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so

class main

socket rild stream 660 root radio 

socket rild-debug stream 666 radio system 

user root 

group radio cache inet misc audio sdcard_rw log



并且在init.rc文件中加入quectel-pppd服务
	service quectel-pppd /etc/ppp/init.quectel-pppd
class main
user root
group radio cache inet misc log
disabled
oneshot

(4)编译Android4.4系统

这里写图片描述

只要第一次编译成功后(第一次时间很长,和电脑的配置都有关系),后面的时间会相对短一些.

编译成功后,我们们得到这样一些文件:

S5P4418 android 5.1 EC20 R2.0 PCIE接口调试记录_第3张图片

绿色标记的两个即为要烧写到Android系统的镜像

(5)烧写到开发板后查看驱动:

S5P4418 android 5.1 EC20 R2.0 PCIE接口调试记录_第4张图片

这时会有一些提示信息。
打开/system/build.prop 文件,将原有的rild.libpath和rild.libargs注释,修改成如下:
rild.libpath=/system/lib/libreference-ril.so
rild.libargs=-d /dev/ttyUSB2

(说明:ttyUSB2为基带模块的AT指令口)

过一会就可以看到如下信息:

S5P4418 android 5.1 EC20 R2.0 PCIE接口调试记录_第5张图片

我们可以查看一下和拨号上网相关的文件:全部都生成了

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述


这时可以看到平板上已有信号,4G网络也有了,打开浏览器,载入网页,可知已经成功实现上网了。
查看网络:ppp0已经存在

S5P4418 android 5.1 EC20 R2.0 PCIE接口调试记录_第6张图片

S5P4418 android 5.1 EC20 R2.0 PCIE接口调试记录_第7张图片

 

转自:http://blog.csdn.net/u014770862/article/details/52641744

 

RK3288平台支持的3G modem还是蛮多的,移植所需要做的工作也不是特别多。本文只是粗略介绍4G模块的移植,涉及的东西也不深。如有错误,敬请谅解!

SoC:RK3288 
4G chip:EC20 
Platform:Android 5.1

厂家已经提供了相应的文档,这里也只是记录下流程.4G模块调试基本上分为三部分:驱动、RIL、android配置文件。

一、驱动配置

1.1 USB Driver Configure

Device Drivers  --->
    [*] USB support  --->
            <*> USB Serial Converter support
                  [*] USB Generic Serail Driver
                  [*] USB Driver for GSM and CMDA modems

1.2 add EC20 ‘s Vendor ID and Product ID in option_ids[] of drivers/usb/serial/option.c

USB_DEVICE(0x05c6, 0x9215);
  • 1
  • 1

1.3 USB Driver Configure

Device Drivers  --->
      [*] USB support  --->
            <*> USB Modem (CDC ACM) suppor

1.4 PPP Configure

Device Drivers  --->
      [*] Network device support  --->
            <*> PPP (point-to-point protocol) support
            <*> PPP support for async serial ports
            <*> PPP support for sync tty ports
            <*> PPP Deflate compression

二、RIL库

RIL库由厂家提供,将该拨号库拷贝到/system/lib/目录下,若厂家提供了ril源码,可将其拷贝到hardware/ril/reference-ril下。

注:需要使用RIL库来配置build.prop

三、配置

修改init.rc的内容,添加以下:

service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so
    class main
    socket rild stream 660 root radio 
    socket rild-debug stream 666 radio system 
    user root 
    group radio cache inet misc audio sdcard_rw log
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
修改hardware/ril/rild/rild.c中:
OpenLib:
    #endif
      //switchUser();
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

然后重新编译android。(init.rc的修改需要在device/rockchip/rk3288/init.rc中修改,否则重新编译可能又被rockchip的配置所覆盖)。

按照文档做完上述工作后,发现4G依然不能用,通过adb shell中输入以下命令:

logcat -b radio
//出现以下错误提示
D/RIL_RK_DATA_V3.5(  169): Found a device, get id
D/use-Rlog/RLOG-RIL_RK_DATA_V3.5(  169): device path: /sys/devices/ff540000.usb/usb3/3-1/3-1.4/3-1.4:1.0/ttyUSB0/tty/ttyUSB0
D/RIL_RK_DATA_V3.5(  169): USB device path: /sys/devices/ff540000.usb/usb3/3-1/3-1.4
D/RIL_RK_DATA_V3.5(  169): TTY Device Vendor path: /sys/devices/ff540000.usb/usb3/3-1/3-1.4/idVendor
D/RIL_RK_DATA_V3.5(  169): TTY Device Product path: /sys/devices/ff540000.usb/usb3/3-1/3-1.4/idProduct
D/RIL_RK_DATA_V3.5(  169): tty Device id is: 05C6/9215
D/RIL_RK_DATA_V3.5(  169): Searching modem table...
D/use-Rlog/RLOG-RIL_RK_DATA_V3.5(  169): [matchModem]: match model count=0
E/use-Rlog/RLOG-RIL_RK_DATA_V3.5(  169): E: Not support modem!!!!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

这是因为RK3288的Android 5.1 SDK提供了ril相关配置,各个厂家的不同,还需要更改其适配自己的4G模块。例如厂家提供了rild库是libreference-ril.so,4G模块生成了/dev/ttyUSB0~4共5个串口,AT指令端口为/dev/ttyUSB0;而RK3288默认的配置为:

rild.libpath=/system/lib/libril-rk29-dataonly.so
rild.libargs=-d /dev/ttyACM0
  • 1
  • 2
  • 1
  • 2

因此将其修改为:

rild.libpath=/system/lib/libreference-ril.so
rild.libargs=-d /dev/ttyUSB0
  • 1
  • 2
  • 1
  • 2

源码中可在/device/rockchip/rk3288/rk3288_box/system.prop中修改,以后每次编译就能正常使用了。

最后需要在init.rc中添加:

chmod 777 /dev/ttyUSB0  
chmod 777 /dev/ttyUSB1  
chmod 777 /dev/ttyUSB2  
chmod 777 /dev/ttyUSB3
chmod 777 /dev/ttyUSB4 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5

重新编译源码后烧录固件,亲测中国联通4G LTE能正常上网。

 

你可能感兴趣的:(操作系统)