DM368开发 -- 华为3G/4G模块移植

一、模块介绍

用的是华为 ME909s-821 Mini PCIe。 

模块介绍,参看: ME909s-821 Mini PCIe 规格参数

其他模块,参看:华为全系列模块 产品介绍

  • ME909s-821 Mini PCIe是ME909s-821的变形版本,标准Mini PCIe封装;支持下行150Mbps,上行50Mbps的传输速率;提供高质量的语音、短信功能;丰富的扩展功能:FOTA、USSD、IPV6/IPV4…;内置TCP/IP协议栈;华为扩展AT指令集… 是车载、跟踪、工业路由器、安防监控、工业平板等行业应用的理想产品。

    30.4mm

    51mm

    3.57mm

    重量

    <12g

    Mini-PCIe

    ME909s-821 Mini PCIe:

    LTE (FDD): B1,B3,B8

    LTE (TDD): B38, B39,B40,B41

    DC-HSPA+/HSPA+/HSPA/UMTS : B1, B5, B8,B9

    TD-SCDMA: B34, B39

    EDGE/GPRS/GSM : 900/1800 MHz

    DC-HSPA+ : 下行:42 Mbps, 上行: 5.76 Mbps

    LTE TDD : 下行: 112Mbps , 上行: 10Mbps (CAT4)

    LTE FDD: 下行:150 Mbps, 上行: 50 Mbps @Bandwidth 20M (CAT4)

    Mini PCIe interface

    Antenna interface

    USB 2.0 High speed

    PCM Voice

    SIM Card

    LED

    Power supply

    Reset

    3.2 V to 4.2V (typical: 3.8V)

    PCM语音

    DTMF

    -40℃ to 85℃

    CDC-ECM

    FOTA

    Firmware Update via USB

    Embedded UDP/TCP/FTP(s)/HTTP(s) stack

    High-speed UART

    CMUX

    Sleep mode

    Linux, Android, WinCE, Windows 8/10

    CCC

    NAL

    SRRC


    其中选择模块的时候一定要注意是否支持中国市场:

    ME909s-120, 支持欧洲, 亚太, 拉美等海外市场.
    ME909s-821, 支持中国市场
    ME909u-521(B1/B2/B3/B5/B7/B8/B20),欧洲市场
    ME909u-523(B2/B4/B5/B13/B17/B25/B26),北美市场
    ME909u-XXX(TBD),日本市场

    再有查看支持的频段,选择相应的联通或移动3G/4G上网卡。

    中国移动  
    GSM900   
    上行/下行:890-909MHz/935-954MHz 
    EGSM900  
    上行/下行:885-890MHz/930-935MHz (中国铁通GSM-R:885-889/930-934) 
    GSM1800M 上行/下行:1710-1720MHz/1805-1815MHz 
    3G TDD   1880-1900MHz 、2010-2025MHz 
    4G TD-LTE 1880 -1900 MHz、2320-2370 MHz、2575-2635 MHz
    中国联通 
    GSM900   
    上行/下行:909-915MHz/954-960MHz
    GSM1800  上行/下行:1740-1755MHz/1835-1850MHz 
    3G FDD   上行/下行:1940-1955MHz/2130-2145MHz 
    TD-LTE  2300-2320 MHz、2555-2575 MHz
    FDD-LTE 1755-1765MHz   1850-1860MHz
    FDD-LTE实际使用 1745-1765MHz   1840-1860MHz
    中国电信 
    CDMA800 上行/下行:825-835MHz/870-880MHz
    3G FDD  上行/下行:1920-1935MHz/2110-2125MHz 
    TD-LTE  2370-2390 MHz、2635-2655 MHz
    FDD-LTE 1765-1780MHz    1860-1875MHz

    二、相关文档

    下载:3G/4D 相关文档


    三、华为模块Linux 内核驱动集成指导

    上述的文档,根据名称都可以自行百度出来。根据指导手册一步一步的来配置内核驱动。

    这里只是说的是一些出现的问题:

    (1)首先要注意,它所支持的范围:

    我们用的是 linux-2.6.32 因为内核版本不同,没有usb_wwan.c usb_wwan.h usb_wwan_write 。所以将添加到上述文件里的内容,合并到option.c中去。

    (2)无法加载cmemk.ko  irqk.ko  edmak.ko等设备模块

    是因为版本不同造成的,需要重新编译


    下面只操作cmemk.ko 同理irqk.ko edmak.ko 
    find . -name cmemk.ko  


    重新编译cmemk.ko

    有下图可知,将新编译好的 cmemk.ko 拷贝到 
    /home/zslf/dm368/rootfs/zslf/rootfs-php/lib/modules/2.6.32.17-davinci1/kernel/drivers/dsp/
    然后重新烧写内核,根文件系统,uboot 


    (3)大小屏不兼容问题


    (4)davinci_interrupt 368: VBUS error workaround (delay coming) 与 只有4个ttyUSB 问题 

    模块使用不当造成的。就是上面所说的使用了欧洲版的模块。

    (5)AT 拨号

    AT 拨号指令可参看相关手册

    先贴出两个OK的3G PPP拨号AT指令

    《1》3G OK版ppp-on脚本

    #!/bin/sh
    
    
    USER="vpdn@chaoyang-uvpdn"
    PASSWORD="vpdn"
    DIAL="wcdma-connect-chat"
    TELEPHONE="*99#"          (为什么可以拨通移动的3G,但是不能拨通联通的3G呢?)
    APN="3gnet"                (而且3gnet,*99#,应该是联通的APN,和拨号号码啊?)
    
    
    i=`cat /proc/bus/usb/devices | grep ProdID=1573`
    
    
    if [ -z $i ];then
    CONTRAL=/dev/ttyUSB0
    else
    CONTRAL=/dev/ttyUSB2
    fi
    
    
    export TELEPHONE APN
    
    
    pppd                    \
            $CONTRAL        \
            115200          \
            nocrtscts       \
            modem           \
            debug           \
            noauth          \
            nodetach        \
            noipdefault     \
            usepeerdns      \
            defaultroute    \
            persist         \
            maxfail 1       \
            holdoff 5       \
            user $USER      \
            password $PASSWORD      \
            0.0.0.0:0.0.0.0 \
            connect "/bin/chat -E -s -v -f /etc/ppp/$DIAL"  \
            #connect "/bin/chat -s -v -f /etc/ppp/wcdma-connect-chat"       \
            #disconnect '/bin/chat -s -v -f /etc/ppp/wcdma-disconnect-chat' \

    《2》wcdma-connect-chat脚本

    #/etc/ppp/wcdma-connect-chat
    
    
    TIMEOUT 5
    ABORT "DELAYED"
    ABORT "BUSY"
    ABORT "ERROR"
    ABORT "NO DIALTONE"
    ABORT "NO CARRIER"
    #"AT
    #'OK-+++\c-OK' ATHO
    TIMEOUT 5
    
    
    ''      AT
    OK      AT+CGDCONT=1,"IP","$APN",,0,0
    OK      ATDT$TELEPHONE
    CONNECT '' 

    《3》大神PPP脚本   移动3G ok 

    #cd /etc/ppp/peers/
    
    /dev/ttyUSB0 
    9600	
    crtscts	
    modem	
    debug		
    nodetach
    defaultroute	
    user "cmnet"	
    usepeerdns	
    connect '/bin/chat -s -v -f /etc/ppp/peers/LTE-connect-chat'	
    disconnect '/bin/chat -s -v -f /etc/ppp/peers/LTE-disconnect-chat'	
    
    TIMEOUT 15	
    ABORT 'ERROR'	             
    ABORT 'NODIALTONE'	       
    ABORT 'BUSY'	     
    ABORT 'NOANSWER'	        
    '' AT	    
    OK AT+CGDCONT=1,\"IP\",\"cmnet\"	
    OK ATDT*99***1#	
    CONNECT	        
    
    ABORT  OK	
    ABORT  BUSY	
    ABORT  DELAYED	
    ABORT  "NOANSWER"
    ABORT  "NOCARRIER"	
    ABORT  "NODIALTONE"	
    ABORT  VOICE	
    ABORT  ERROR	
    ABORT  RINGING	
    TIMEOUT  12	
    ""  \K	
    ""  \K	
    ""  \K	
    ""  +++ATH	               
    ""  +++ATH	
    ""  +++ATH	
    ""  ATZ	               
    SAY "\nGoodbay\n"

    先要明白,4G模块有网卡,我们上面整个内核移植过程,EMC移植的网卡驱动。3G用可PPP拨号,但是4G的话,使用网卡。所以接下来是我们经过好几轮实现得出的OK版AT指令。

    int main(int argc,const char* argv[])
    {
    int ret = 0;
    	printf("### Serial_ttyUSB0_Init ###\n");
    	
    	ret = Serial_ttyUSB0_Init();
    	if(-1 == ret)
    	{
    		printf("### Failed to Serial_ttyUSB0_Init ###\n");
    		return -1;
    	}
    	printf("### Serial_ttyUSB0_Init End ###\n");
    
    	int CFUNFlag = 0;
    
    	while(!CFUNFlag)
    	{
    		printf("###  MU909_SetCFUN ###\n");
    		ret = MU909_SetCFUN(fd_serial,1);
    		if(-1 == ret)
    		{
    			CFUNFlag = 0;
    		}
    		else
    		{
    			CFUNFlag = 1;
    		}
    	}
     //当发生错误时,显示错误信息 
     
    	unsigned char * strCGACTCommand1 = "AT+CMEE=2\r";	
    	int CGACTFlag1 = 0;
    	while(!CGACTFlag1)
    	{
    		ret = ME3760_CGACT(fd_serial,strCGACTCommand1);
    		if(-1 == ret)
    		{
    			CGACTFlag1 = 0;
    		}
    		else
    		{
    			CGACTFlag1 = 1;
    		}
    	}
      //检查SIM是否存在
    	unsigned char * strCGACTCommand2 = "AT+CPIN?\r";	
    	int CGACTFlag2 = 0;
    	while(!CGACTFlag2)
    	{
    		ret = ME3760_CGACT(fd_serial,strCGACTCommand2);
    		if(-1 == ret)
    		{
    			CGACTFlag2 = 0;
    		}
    		else
    		{
    			CGACTFlag2 = 1;
    		}
    	}
      //PS域注册状态
    	unsigned char * strCGACTCommand3 = "AT+CEREG=2\r";	
    	int CGACTFlag3 = 0;
    	while(!CGACTFlag3)
    	{
    		ret = ME3760_CGACT(fd_serial,strCGACTCommand3);
    		if(-1 == ret)
    		{
    			CGACTFlag3 = 0;
    		}
    		else
    		{
    			CGACTFlag3 = 1;
    		}
    	}
      //查询和报告信号强度
    	unsigned char * strCGACTCommand4 = "AT^HCSQ?\r";	
    	int CGACTFlag4 = 0;
    	while(!CGACTFlag4)
    	{
    		ret = ME3760_CGACT(fd_serial,strCGACTCommand4);
    		if(-1 == ret)
    		{
    			CGACTFlag4 = 0;
    		}
    		else
    		{
    			CGACTFlag4 = 1;
    		}
    	}
      //查询当前运营商信息
    	unsigned char * strCGACTCommand5 = "AT+COPS?\r";	
    	int CGACTFlag5 = 0;
    	while(!CGACTFlag5)
    	{
    		ret = ME3760_CGACT(fd_serial,strCGACTCommand5);
    		if(-1 == ret)
    		{
    			CGACTFlag5 = 0;
    		}
    		else
    		{
    			CGACTFlag5 = 1;
    		}
    	}
      //配置扩展系统,选择联通CDMA还是移动LTE,是否支持漫游
    	unsigned char * strSysConfigArguments6 = 
    "AT^SYSCFGEX=\"03\",3fffffff,1,2,7fffffffffffffff,,\r"; 
    	int SysConfigFlag6 = 0;
    	while(!SysConfigFlag6)
    	{
    		ret = MU909_SysConfig(fd_serial,strSysConfigArguments6);
    		if(-1 == ret)
    		{
    			SysConfigFlag6 = 0;
    		}
    		else
    		{
    			SysConfigFlag6 = 1;
    		}
    	}
      //NDIS拨号
    	unsigned char * strCGACTCommand7 = "AT^NDISDUP=1,1,\"cmnet\"\r";	
    	int CGACTFlag7 = 0;
    	while(!CGACTFlag7)
    	{
    		ret = ME3760_CGACT(fd_serial,strCGACTCommand7);
    		if(-1 == ret)
    		{
    			CGACTFlag7 = 0;
    		}
    		else
    		{
    			CGACTFlag7 = 1;
    		}
    	}
    
    system("udhcpc -i usb0");
    	Serial_ttyUSB0_Release();
    return 0;
    }

    四、内核启动信息

    U-Boot 2010.12-rc2 (May 27 2014 - 16:50:48)
    
    Cores: ARM 297 MHz
    DDR:   243 MHz
    DRAM:  128 MiB
    NAND:  512 MiB
    Bad block table found at page 262080, version 0x01
    Bad block table found at page 262016, version 0x01
    Net:   Ethernet PHY: LXT972 @ 0x01
    DaVinci-EMAC
    Hit any key to stop autoboot:  2  1  0 
    
    NAND read: device 0 offset 0x400000, size 0x400000
     4194304 bytes read: OK
    ## Booting kernel from Legacy Image at 80700000 ...
       Image Name:   Linux-2.6.32.17-davinci1
       Created:      2015-11-23   9:14:53 UTC
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    2243956 Bytes = 2.1 MiB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Uncompressing Linux.................................................................................................................................................. done, booting the kernel.
    Linux version 2.6.32.17-davinci1 (root@zslf-desktop) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #117 PREEMPT Mon Nov 23 17:14:48 CST 2015
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DM36x EVM
    Memory policy: ECC disabled, Data cache writeback
    DaVinci dm36x_rev1.2 variant 0x8
    Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 12192
    Kernel command line: dm365_imp.oper_mode=0 mem=48M console=ttyS0,115200n8 noinitrd rw ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs video=davincifb:osd0=720x480x16,4050K
    PID hash table entries: 256 (order: -2, 1024 bytes)
    Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
    Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
    Memory: 48MB = 48MB total
    Memory: 43900KB available (4216K code, 393K data, 148K init, 0K highmem)
    SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Hierarchical RCU implementation.
    NR_IRQS:245
    Calibrating delay loop... 147.86 BogoMIPS (lpj=739328)
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 8 gpio irqs
    NET: Registered protocol family 16
    davinci_serial_init:97: failed to get UART2 clock
    EVM: HD imager video input
    bio: create slab <bio-0> at 0
    DM365 IPIPE initialized in Continuous mode
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    pca9543a_probe
    vpss vpss: dm365_vpss vpss probed
    vpss vpss: dm365_vpss vpss probe success
    dm365_afew_hw_init
    lconfig->line_length is 0.
    ch0 default output "COMPOSITE", mode "NTSC"
    ###### vpbe_encoder_init ######
    ###### vid_enc_register_encoder ######
    ###### mgr->num_encoders is 0 ######
    ###### **ch_id is 0 ######
    ###### mode_info.name is NTSC ######
    ###### vpbe_encoder_initialize ######
    ###### output is COMPOSITE,outindex is 0 ######
    ###### vpbe_encoder_setoutput ######
    ###### dm365 = 1 ######
    ###### mode_info->std is 1 ######
    ###### mode is NTSC ######
    ###### 22VPBE Encoder initialized ######
    ###### vpbe_encoder_setoutput ######
    ###### dm365 = 1 ######
    ###### mode_info->std is 1 ######
    ###### mode is NTSC ######
    ###### dm365 = 1 ######
    ###### mode_info->std is 1 ######
    ###### mode is NTSC ######
    ###### 33encoder->mode_ops->setmode: error is 0 ######
    ###### davinci_enc_set_mode_platform : next davinci_enc_priv_setmode ######
    VPBE Encoder Initialized
    ###### 11VPBE Encoder Initialized ######
    Switching to clocksource timer0_1
    musb_hdrc: version 6.0, cppi-dma, host, debug=0
    musb_hdrc: USB Host mode controller at fec64000 using DMA, IRQ 12
    musb_hdrc musb_hdrc: MUSB HDRC host driver
    musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 1
    usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb1: Product: MUSB HDRC host driver
    usb usb1: Manufacturer: Linux 2.6.32.17-davinci1 musb-hcd
    usb usb1: SerialNumber: musb_hdrc
    usb usb1: configuration #1 chosen from 1 choice
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 2048 (order: 2, 16384 bytes)
    TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
    TCP: Hash tables configured (established 2048 bind 2048)
    TCP reno registered
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
    msgmni has been set to 85
    alg: No test for stdrng (krng)
    io scheduler noop registered
    io scheduler anticipatory registered (default)
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    davincifb davincifb.0: dm_osd0_fb: 720x480x16@0,0 with framebuffer size 4050KB
    davincifb davincifb.0: dm_vid0_fb: 0x0x16@0,0 with framebuffer size 1020KB
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    davincifb davincifb.0: dm_osd1_fb: 720x480x4@0,0 with framebuffer size 675KB
    davincifb davincifb.0: dm_vid1_fb: 0x0x16@0,0 with framebuffer size 1020KB
    DM365 IPIPEIF probed
    imp serializer initialized
    davinci_previewer initialized
    davinci_resizer initialized
    davinci gpio led module init ....... 
    register davinci gpio module is ok ....... 
    Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A
    console [ttyS0] enabled
    serial8250.0: ttyS1 at MMIO 0x1d06000 (irq = 41) is a 16550A
    brd: module loaded
    NAND device: Manufacturer ID: 0xec, Chip ID: 0xdc (Samsung NAND 512MiB 3,3V 8-bit)
    nand_bbt: ECC error while reading bad block table
    Creating 5 MTD partitions on "davinci_nand.0":
    0x000000000000-0x0000003c0000 : "bootloader"
    0x0000003c0000-0x000000400000 : "params"
    0x000000400000-0x000000820000 : "kernel"
    0x000000820000-0x000008820000 : "filesystem"
    0x000008820000-0x000020000000 : "zslf"
    davinci_nand davinci_nand.0: controller rev. 2.3
    UBI: attaching mtd3 to ubi0
    UBI: physical eraseblock size:   131072 bytes (128 KiB)
    UBI: logical eraseblock size:    126976 bytes
    UBI: smallest flash I/O unit:    2048
    UBI: VID header offset:          2048 (aligned 2048)
    UBI: data offset:                4096
    usb 1-1: new high speed USB device using musb_hdrc and address 2
    usb 1-1: New USB device found, idVendor=12d1, idProduct=15c1
    usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    usb 1-1: Product: HUAWEI Mobile V7R11
    usb 1-1: Manufacturer: Huawei Technologies Co., Ltd.
    usb 1-1: SerialNumber: 0123456789ABCDEF
    usb 1-1: configuration #2 chosen from 3 choices
    UBI: attached mtd3 to ubi0
    UBI: MTD device name:            "filesystem"
    UBI: MTD device size:            128 MiB
    UBI: number of good PEBs:        1024
    UBI: number of bad PEBs:         0
    UBI: max. allowed volumes:       128
    UBI: wear-leveling threshold:    4096
    UBI: number of internal volumes: 1
    UBI: number of user volumes:     1
    UBI: available PEBs:             5
    UBI: total number of reserved PEBs: 1019
    UBI: number of PEBs reserved for bad PEB handling: 10
    UBI: max/mean erase counter: 2/1
    UBI: image sequence number: 0
    UBI: background thread "ubi_bgt0d" started, PID 354
    PPP generic driver version 2.4.2
    PPP Deflate Compression module registered
    PPP BSD Compression module registered
    PPP MPPE Compression module registered
    NET: Registered protocol family 24
    tun: Universal TUN/TAP device driver, 1.6
    tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
    
     cdc_bind,[546]
    usb0: register 'cdc_ether' at usb-musb_hdrc-1, CDC Ethernet Device, 02:1e:10:1f:00:00
    usbcore: registered new interface driver cdc_ether
    console [netcon0] enabled
    netconsole: network logging started
    Initializing USB Mass Storage driver...
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    usbcore: registered new interface driver usbserial
    USB Serial support registered for generic
    usbcore: registered new interface driver usbserial_generic
    usbserial: USB Serial Driver core
    USB Serial support registered for GSM modem (1-port)
    option 1-1:2.2: GSM modem (1-port) converter detected
    usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
    option 1-1:2.3: GSM modem (1-port) converter detected
    usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
    option 1-1:2.4: GSM modem (1-port) converter detected
    usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
    option 1-1:2.5: GSM modem (1-port) converter detected
    usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
    option 1-1:2.6: GSM modem (1-port) converter detected
    usb 1-1: GSM modem (1-port) converter now attached to ttyUSB4
    usbcore: registered new interface driver option
    option: v0.7.2:USB Driver for GSM modems
    usbcore: registered new interface driver usbtest
    rtc-ds1307 1-0068: rtc core: registered ds1339 as rtc0
    i2c /dev entries driver
    Linux video capture interface: v2.00
    ths7303 1-002c: chip found @ 0x58 (DaVinci I2C adapter)
    ths7303 1-002c: ths7303 write failed
    ths7303: probe of 1-002c failed with error -121
    vpfe_init
    vpfe-capture: vpss clock vpss_master enabled
    vpfe-capture vpfe-capture: v4l2 device registered
    vpfe-capture vpfe-capture: video device registered
    EVM: switch to tvp5150 SD video input
    tvp5150 1-005d: chip found @ 0x5d (DaVinci I2C adapter)
    vpfe-capture vpfe-capture: v4l2 sub device tvp5150 registered
    EVM: switch to tvp7002 HD video input
    vpfe-capture vpfe-capture: v4l2 sub device ths7353 register fails
    vpfe_register_ccdc_device: DM365 ISIF
    DM365 ISIF is registered with vpfe.
    af major#: 250, minor# 0
    AF Driver initialized
    aew major#: 249, minor# 0
    AEW Driver initialized
    ###### osd_init ######
    ### VPBE OSD DRIVER INIT ###
    Trying to register davinci display video device.
    layer=c10b1400,layer->video_dev=c10b1570
    Trying to register davinci display video device.
    layer=c10b1800,layer->video_dev=c10b1970
    davinci_init:DaVinci V4L2 Display Driver V1.0 loaded
    watchdog watchdog: heartbeat 60 sec
    davinci_mmc davinci_mmc.0: Using DMA, 4-bit mode
    Advanced Linux Sound Architecture Driver Version 1.0.21.
    No device for DAI tlv320aic3x
    No device for DAI davinci-i2s
    asoc: tlv320aic3x <-> davinci-i2s mapping ok
    ALSA device list:
      #0: DaVinci EVM (tlv320aic3x)
    TCP cubic registered
    NET: Registered protocol family 17
    Clocks: disable unused mmcsd1
    Clocks: disable unused spi0
    Clocks: disable unused spi1
    Clocks: disable unused spi2
    Clocks: disable unused spi3
    Clocks: disable unused spi4
    Clocks: disable unused pwm0
    Clocks: disable unused pwm1
    Clocks: disable unused pwm2
    Clocks: disable unused pwm3
    Clocks: disable unused timer1
    Clocks: disable unused timer3
    Clocks: disable unused emac
    Clocks: disable unused voice_codec
    Clocks: disable unused rto
    Clocks: disable unused mjcp
    davinci_emac_probe: using random MAC addr: b2:55:85:e9:2b:0e
    emac-mii: probed
    mmc0: new high speed SDHC card at address e624
    rtc-ds1307 1-0068: setting system clock to 2015-11-24 11:00:54 UTC (1448362854)
    mmcblk0: mmc0:e624 SU64G 59.4 GiB 
     mmcblk0: p1
    UBIFS: mounted UBI device 0, volume 0, name "rootfs"
    UBIFS: file system size:   126341120 bytes (123380 KiB, 120 MiB, 995 LEBs)
    UBIFS: journal size:       6348800 bytes (6200 KiB, 6 MiB, 50 LEBs)
    UBIFS: media format:       w4/r0 (latest is w4/r0)
    UBIFS: default compressor: lzo
    UBIFS: reserved for root:  4952683 bytes (4836 KiB)
    VFS: Mounted root (ubifs filesystem) on device 0:14.
    Freeing init memory: 148K
    INIT: version 2.86 booting
    Please wait: booting...
    Error Cannot open /dev/tty0: No such device or address
    Starting udev
    udev: starting version 141
    Root filesystem already rw, not remounting
    Caching udev devnodes
    Populating dev cacheFAT: bogus number of reserved sectors
    VFS: Can't find a valid FAT filesystem on dev mmcblk0.
    mv: cannot rename '/tmp/devices': No such file or directory
    EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
    kjournald starting.  Commit interval 5 seconds
    EXT3 FS on mmcblk0p1, internal journal
    EXT3-fs: mounted filesystem with writeback data mode.
    ALSA: Restoring mixer settings...
    Configuring network interfaces... eth0: attached PHY driver [LXT971] (mii_bus:phy_addr=1:01, id=1378e2)
    done.
    Setting up IP spoofing protection: rp_filter.
    INIT: Entering runlevel: 5
    Starting system message bus: dbus.
    Starting telnet daemon.
    Starting syslogd/klogd: done
    CMEMK module: built on Oct 26 2015 at 22:19:29
      Reference Linux version 2.6.32
      File /home/zslf/dm368/dvsdk_dm368_4_02_00_06/linuxutils_2_26_01_02_bak/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c
    allocated heap buffer 0xc7000000 of size 0x4400000
    heap fallback enabled - will try heap if pool buffer is not available
    CMEM Range Overlaps Kernel Physical - allowing overlap
    CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x83000000)
    cmemk initialized
    IRQK module: built on Oct 26 2015 at 22:17:36
      Reference Linux version 2.6.32
      File /home/zslf/dm368/dvsdk_dm368_4_02_00_06/linuxutils_2_26_01_02_bak/packages/ti/sdo/linuxutils/irq/src/module/irqk.c
    irqk initialized
    EDMAK module: built on Oct 26 2015 at 22:16:49
      Reference Linux version 2.6.32
      File /home/zslf/dm368/dvsdk_dm368_4_02_00_06/linuxutils_2_26_01_02_bak/packages/ti/sdo/linuxutils/edma/src/module/edmak.c
    /zslf/appZSLF.sh: line 9: ppp_config_copy: not found
    start copy th config file from zslf/config to /etc/ppp/peers.
    cp: cannot stat '/zslf/config/ppp-off': No such file or directory
    cp: cannot stat '/zslf/config/ppp0_on_state.txt': No such file or directory
    ############## ZSLF  ##################
    start copy the config file from zslf to thttpd/www.
    /zslf/appZSLF.sh: line 17: ppp_config_copy: not found
    Create a shared memory segment 32769.
    24 Nov 11:01:09 ntpdate[993]: no servers can be used, exiting
    mkdir: cannot create directory '/media/mmcblk0p1/bak': File exists
    ## davinci_pio_led:ioctl:out: GPIO-81=1 now.ret= 0 ## 
    setrlimit ok
    FD_SETSIZE= 1024
    ### Serial_ttyUSB0_Init ###
    ### Complete serial_open ###
    ### Complete serial_config ###
    ### Complete fcntl ###
    ### Serial_ttyUSB0_Init End ###
    ###  MU909_SetCFUN ###
    start MU909_SetCFUN 
    ##strATCommand is AT+CFUN=1
    .
    AT+CFUN=1
    
    
    OK
    
    
    ##strATCommand is AT+CMEE=2
    .
    AT+CMEE=2
    
    
    OK
    
    
    ##strATCommand is AT+CPIN?
    .
    AT+CPIN?
    
    
    +CPIN: READY
    
    
    
    OK
    
    
    ##strATCommand is AT+CEREG=2
    .
    AT+CEREG=2
    
    
    OK
    
    
    ##strATCommand is AT^HCSQ?
    .
    AT^HCSQ?
    
    
    ^HCSQ: "LTE",52,49,166,34
    
    
    
    OK
    
    
    ##strATCommand is AT+COPS?
    .
    AT+COPS?
    
    
    +COPS: 0,0,"CMCC",7
    
    
    
    OK
    
    
    ##strATCommand is AT^SYSCFGEX="03",3fffffff,1,2,7fffffffffffffff,,
    .
    AT^SYSCFGEX="03",3fffffff,1,2,7fffffffffffffff,,
    
    
    OK
    
    
    ##strATCommand is AT^NDISDUP=1,1,"cmnet"
    .
    AT^NDISDUP=1,1,"cmnet"
    
    
    OK
    
    
    
    ^NDISSTAT: 1,,,"IPV4"
    
    
    
    ^NDISSTAT: 1,,,"IPV6"
    
    
    udhcpc (v1.13.2) started
    Sending discover...
    Sending select for 10.67.239.228...
    Lease of 10.67.239.228 obtained, lease time 518400
    adding dns 221.130.33.60
    adding dns 221.130.33.52
    ######## encode #########
    ### timenow->tm_year = 115 ###
    
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org dm368-evm ttyS0
    
    Arago 2011.02 dm368-evm ttyS0
    
    dm368-evm login: 24 Nov 11:01:32 ntpdate[1189]: no server suitable for synchronization found
    zslf module ok...
    dlsym load ok!
    ***after***
    #### parseStreamingArgs - streaming to [124.65.158.106:22616] ####
    #### parseStreamingArgs - streaming to [192.168.2.91:22616] ####
    #### parseVideoArgs - (0) 720x480 ####
    #### parseVideoArgs - (1) 720x480 ####
    #### parseAudioArgs - 44100,2,32000,1 ####
    ### parseArgs - config/devInfo.txt, Name:[联通小单?##### output_store ######
    ?56001],ID:[YS-###### davinci_get_cur_encoder ######
    56001] ###
    Encode streaming star###### vpbe_encoder_initialize ######
    ting...
    1
    2
    3
    4
    ###### output is COMPOSITE,outindex is 0 ######
    ###### vpbe_encoder_setoutput ######
    ###### dm365 = 1 ######
    ###### mode_info->std is 1 ######
    ###### mode is NTSC ######
    ###### 22VPBE Encoder initialized ######
    ###### vpbe_encoder_setoutput ######
    ###### dm365 = 1 ######
    ###### mode_info->std is 1 ######
    ###### mode is NTSC ######
    ###### davinci_enc_set_output : next davinci_enc_set_mode_platform ######
    ###### davinci_enc_set_mode_platform : next davinci_enc_priv_setmode ######
    ###### output_show ######
    ###### davinci_enc_get_output ######
    ###### davinci_get_cur_encoder ######
    ###### mode_store ######
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    ###### davinci_enc_set_mode ######
    ###### davinci_get_cur_encoder ######
    ###### dm365 = 1 ######
    ###### mode_info->std is 1 ######
    ###### mode is PAL ######
    ###### davinci_enc_set_mode : next davinci_enc_set_mode ######
    ###### davinci_enc_set_mode_platform : next davinci_enc_priv_setmode ######
    ###### mode_show ######
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    Found width=720 height=480, yres_virtual=480,xres_virtual=720, l###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    ###### davinci_enc_set_mode ######
    ###### davinci_get_cur_encoder ######
    ###### dm365 = 1 ######
    ###### mode_info->std is 1 ######
    ###### mode is PAL ######
    ###### davinci_enc_set_mode : next davinci_enc_set_mode ######
    ###### davinci_enc_set_mode_platform : next davinci_enc_priv_setmode ######
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    ine_length=384
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    ###### davinci_enc_get_mode ######
    ###### davinci_get_cur_encoder ######
    5
    6
    7
    sd write module ok...
    ____Mp4Recover module ok!
    /media/mmcblk0p1/video/temp/YS-56001_11-24_10h59m49s.mp4 Need to recover!
    ~~~~~~~~~~~~~~now! is ready to recover!
    now! is get_data!
    get data all!
    now! is make mp4!
    ### sps.pic_width_in_mbs_minus1 : 0
        sps.pic_height_in_map_units_minus1 : 0
        sps.vui_parameters.time_scale : 139596691
        sps.vui_parameters.num_units_in_tick : 376021250 ###
    now! is follow handle!
    __cgy in main all!
    sd write init ok## davinci_pio_led:ioctl:out: GPIO-47=0 now.ret= 0 ## 
    
    func_sd_input_data ok
    +
    ###READY TO PM###18
    there is a sd need to be mounted 0000
    ### name:[mpeg4enc] ###
    ### name:[h264enc] ###
    #davinci_resizer davinci_resizer.2: RSZ_G_CONFIG:0:1:124
    ## name:[mpeg2enc] ###
    ### name:[jpegenc] ###
    ### name:[g711enc] ###
    ### name:[aacenc] ###
    ###Ready to open encoder###
    davinci_previewer davinci_previewer.2: ipipe_set_preview_config
    ############
    v4l2_device_call_until_err sdinfo->grp_id : 5.
    vpfe-capture vpfe-capture: error in getting g_fmt from sub device
    ############
    v4l2_device_call_until_err sdinfo->grp_id : 5.
    ###succeed to open encoder###
    setrlimit ok
    FD_SETSIZE= 1024
    udp port multiplexing : 1
    #### InitUdpSocket - SO_RCVBUF : 217088, SO_SNDBUF : 217088 ####
    mount: /dev/mmcblk0p1 already mounted or /media/mmcblk0p1/ busy
    ###### len = 26 #########
    mount: according to mtab, /dev/mmcblk0p1 is already mounted on /media/mmcblk0p1
    add sd card
    ############# PUID:83
    bjwLgn.strModel:bjw-2013
    PUID=83
    ### do_login: sockfd = 32 
    Login response status : d
     ACK 
    vpfe-capture vpfe-capture: IPIPE Chained
    vpfe-capture vpfe-capture: Resizer present
    *****input=0****EVM: switch to tvp5150 SD video input
    ***
    ############
    v4l2_device_call_until_err sdinfo->grp_id : 5.
    ###j=1###
    ***  Video ASK Rep  *** 
    startdata ok!
    *****queryInput=0*******
    ############
    v4l2_device_call_until_err sdinfo->grp_id : 5.
    setsockopt ok!
    vpfe-capture vpfe-capture: width = 736, height = 480, bpp = 1
    vpfe-capture vpfe-capture: adjusted width = 736, height = 480, bpp = 1, bytesperline = 736, sizeimage = 529920
    vpfe-capture vpfe-capture: width = 736, height = 480, bpp = 1
    vpfe-capture vpfe-capture: adjusted width = 736, height = 480, bpp = 1, bytesperline = 736, sizeimage = 529920
    ### BJW_DealMsg - VIDEO: FORCE IDR ###
    BJW_DealMsg - CONNECTED 42
    ### videoThrFxn - video0 construct IDR ###
    ***succeed to get capture***
    ### sps.pic_width_in_mbs_minus1 : 0
        sps.pic_height_in_map_units_minus1 : 0
        sps.vui_parameters.time_scale : 139596691
        sps.vui_parameters.num_units_in_tick : 376021250 ###
    .
    dm368-evm login: 
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org dm368-evm ttyS0
    
    Arago 2011.02 dm368-evm ttyS0
    
    dm368-evm login: root
    
    root@dm368-evm:~# 

    五、相关博客

    ARM平台嵌入式Linux下使用3G/4G 模块

    原博客已删除,就怕这种事情发生哦,所以我自己写博客从来不会只给一个链接,必须还有标题。


    简介

    随着工业发展,嵌入式设备接入网络的需求日益增多,在没有有线或者无线以太网的环境下,直接通过3G/4G Modem连接运营商网络来接入互联网不失为一个好方法,本文就着重介绍基于ARM平台的嵌入式设备在Embedded Linux下使用3G/4G Modem的方法。

    目前市面上的3G/4G modem和主机的连接方式主要有串口、USB和mini-PCIE,串口模块比较传统且使用比较简单,而mini-PCIE在工业设备中目前应用还不广泛,因此本文使用USB 3G/4G modem来进行演示。

    硬件准备

    嵌入式平台基于Toradex Colibri i.MX6工业产品级ARM核心板搭配Colibri开发载板,Embedded linux采用Toradex官方发布兼容Yocto Project 的Linux V2.5版本。

    3G Modem使用华为 E303s WCDMA Modem,支持中国联通的3G网络

    Linux Kernel准备

    关于Linux kernel源代码下载及基本编译更新操作请参考这里,本文不再赘述,只简单列出操作如下:

    a). 下载Linux kernel源代码

    b). 下载安装Toolchain,并link到 “ ~/gcc-linaro “ 目录

    $ wget http://releases.linaro.org/14.11/components/toolchain/binaries/arm-linux-gnueabihf/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz

    $ tar xvf gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz

    $ ln -s gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf gcc-linaro

     

    c). 设置环境变量

    $ export ARCH=arm

    $ export PATH=~/gcc-linaro/bin/:$PATH

    $ export CROSS_COMPILE=arm-linux-gnueabihf-

     

    d). 配置

    $ make colibri_imx6_defconfig

    $ make menuconfig      //添加下面列出功能

    --------------------

    [*] Network device support  --->

           <*>   PPP (point-to-point protocol) support

           <*>     PPP BSD-Compress compression

            <*>     PPP Deflate compression

           [*]     PPP filtering

           <*>     PPP MPPE compression (encryption)

           [*]     PPP multilink support

           <*>     PPP over Ethernet

           <*>     PPP support for async serial ports

           <*>     PPP support for sync tty ports

     

    [*] USB support  --->

           <*>     USB Modem (CDC ACM) support

     

    [*] USB support  --->

        <*>   USB Serial Converter support  --->

                  <*>   USB driver for GSM and CDMA modems

    --------------------

     

    e). 重新编译kernel image

    $ make -j3 uImage LOADADDR=10008000 2>&1 | tee build.log

     

    f). 升级目标板

    根据本章节开始提供的参考升级目标板到新的kernel image

    相关软件准备

    1). PPP

    Toradex image默认已经安装,如果其他ARM平台image也是基于Yocto/OpenEmbedded环境编译,可以在local.conf文件中添加如下选项后编译

    -----------------

    IMAGE_INSTALL_append = " ppp"

    -----------------

    2). usb-modesiwtch-2.3.0

    a). 需要libusb-1.0.x,先从这里下载源文件并解压

    b). 使用上一章节配置的ToolChain如下设置交叉编译libusb

    $ sudo CC="/home/xxx/gcc-linaro/bin/arm-linux-gnueabihf-gcc" CXX="/home/xxx/gcc-linaro/bin/arm-linux-gnueabihf-g++" ./configure --host=arm-linux-gnueabihf --prefix=/home/xxx/gcc-linaro --disable-udev

    $ make

    $ make install

    c). 从这里下载usb-modesiwtch并解压

    d). 如下修改usb-modesiwtch 目录下Makefile

    ----------------

    CC          = ~/gcc-linaro/bin/arm-linux-gnueabihf-gcc

    CFLAGS      += -Wall -I/home/xxx/gcc-linaro/include -L/home/xxx/gcc-linaro/lib

    ----------------

    e).交叉编译usb-modesiwtch

    $ make

    f). 从这里下载usb-modeswitch-data,和上面步骤编译出的usb-modesiwtch可执行文件一起上传到目标板

    配置Modem连接网络

    目前比较新的3G/4G都支持Ethernet模式和Fallback模式,而老一些的模块只支持Fallback模式,请根据所需模块情况自行参考下面操作。

    1). Ethernet模式

    a). 将E303s 3G Modem连接目标板,由于Modem上包含为了给Windows系统提供驱动而部署的存储分区,Linux默认将设备识别成USB Mass Storage设备

    root@colibri-imx6:/home# lsusb

    Bus 001 Device 004: ID 12d1:1f01 Huawei Technologies Co., Ltd. E353/E3131 (Mass storage mode)

    ……

    b). 如下修改usb-modeswitch-data-20160112/usb_modeswitch.d目录下的12d1:1f01文件

    -----------------------

    # Huawei E303s Ethernet Mode

    DefaultVendor=0x12d1

    DefaultProduct=0x1f01

    TargetVendor=0x12d1

    TargetProduct=0x14db

    MessageEndPoint = "0x01"

    MessageContent="55534243123456780000000000000a11062000000000000100000000000000"

    ------------------------

    c). 使用usb-modeswitch工具将modem设置为Ethernet mode

    root@colibri-imx6:/home# ./usb_modeswitch -c 12d1:1f01

    ……

    root@colibri-imx6:/home# [  840.027676] usb 1-1.1: USB disconnect, device number 4

    [  840.284299] usb 1-1.1: new high-speed USB device number 6 using ci_hdrc

    [  840.427810] cdc_ether 1-1.1:1.0 eth1: register 'cdc_ether' at usb-ci_hdrc.0-1.1, CDC Ethernet Device, 58:2c:80:13:92:63

     

    lsusb查看

    root@colibri-imx6:/home# lsusb

    Bus 001 Device 005: ID 12d1:14db Huawei Technologies Co., Ltd. E353/E3131

    ……

    d). 查看网络,出现eth1,正确获取ip并连接到网络,下面就可以用使用以太网同样方法使用网络了

    root@colibri-imx6:/home# ifconfig

    ……

    eth1      Link encap:Ethernet  HWaddr 58:2C:80:13:92:63 

              inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0

              inet6 addr: fe80::5a2c:80ff:fe13:9263/64 Scope:Link

              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

              RX packets:37 errors:0 dropped:0 overruns:0 frame:0

              TX packets:69 errors:0 dropped:0 overruns:0 carrier:0

              collisions:0 txqueuelen:1000

              RX bytes:6899 (6.7 KiB)  TX bytes:10381 (10.1 KiB)

    ……

    e). 验证网络连接

    root@colibri-imx6:/home# ping www.baidu.com

    PING www.baidu.com (61.135.169.121): 56 data bytes

    64 bytes from 61.135.169.121: seq=0 ttl=51 time=88.261 ms

    64 bytes from 61.135.169.121: seq=1 ttl=51 time=77.998 ms

    64 bytes from 61.135.169.121: seq=2 ttl=51 time=68.410 ms

    64 bytes from 61.135.169.121: seq=3 ttl=51 time=68.242 ms

    64 bytes from 61.135.169.121: seq=4 ttl=51 time=68.166 ms

    2). Fallback模式

    有一些较老型号的2G/3G Modem只支持这个模式,无需再用usb-modeswitch转换,可以直接参考下面转换后的操作部分。

    a). 如下修改usb-modeswitch-data-20160112/usb_modeswitch.d目录下的12d1:1f01文件

    -----------------------

    # Huawei E303s Fallback Mode

    DefaultVendor=0x12d1

    DefaultProduct=0x1f01

    TargetVendor=0x12d1

    TargetProduct=0x1001

    MessageEndPoint = "0x01"

    MessageContent="55534243123456780000000000000011063000000100010000000000000000"

    NoDriverLoading=0

    ------------------------

    b). 使用usb-modeswitch工具将modem设置为Fallback mode

    root@colibri-imx6:/home# ./usb_modeswitch -c 12d1\:1f01

    ……

    root@colibri-imx6:/home# [ 2090.566190] usb 1-1.1: new high-speed USB device number 8 using ci_hdrc

    [ 2090.701092] option 1-1.1:1.0: GSM modem (1-port) converter detected

    [ 2090.713488] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB0

    [ 2090.723517] option 1-1.1:1.1: GSM modem (1-port) converter detected

    [ 2090.731817] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB1

    [ 2090.740318] option 1-1.1:1.2: GSM modem (1-port) converter detected

    [ 2090.748184] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB

     

    lsusb 查看

    root@colibri-imx6:/home# lsusb

    Bus 001 Device 008: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem

    ……

    c). 测试连接

    root@colibri-imx6:/home# ls -l /dev/ttyUSB*

    crw-rw----    1 root     dialout   188,   0 Apr 11 09:49 /dev/ttyUSB0

    crw-rw----    1 root     dialout   188,   1 Apr 11 09:49 /dev/ttyUSB1

    crw-rw----    1 root     dialout   188,   2 Apr 11 09:49 /dev/ttyUSB2

     

    root@colibri-imx6:/home# minicom -D /dev/ttyUSB0

    ------------------

    Welcome to minicom 2.7

    OPTIONS: I18n

    Compiled on Nov  3 2015, 04:06:26.

    Port /dev/ttyUSB0, 09:53:44

    Press CTRL-A Z for help on special keys

     

    AT

    OK

    --------------------

    d). 编写ppp连接配置文件wcdma, wcdma-chat-connect和wcdma-chat-disconnect

    root@colibri-imx6:/etc/ppp/peers# vi wcdma

    -----------------

    nodetach

    lock

    /dev/ttyUSB0

    115200

    user "card"

    password "card"

    crtscts

    #hide-password

    show-password

    usepeerdns

    noauth

    noipdefault

    novj

    novjccomp

    noccp

    defaultroute

    ipcp-accept-local

    ipcp-accept-remote

    connect '/usr/sbin/chat -s -v -f /etc/ppp/peers/wcdma-chat-connect'

    disconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/wcdma-chat-disconnect'

    ----------------------

     

    root@colibri-imx6:/etc/ppp/peers# vi wcdma-chat-connect

    --------------------

    ABORT "BUSY"

    ABORT "NO CARRIER"

    ABORT "NO DIALTONE"

    ABORT "ERROR"

    ABORT "NO ANSWER"

    TIMEOUT 120

    "" AT

    OK \rATZ

    OK \rAT+CGDCONT=1,"IP","3gnet",,0,0

    OK-AT-OK ATDT*99#

    CONNECT \d\c

    --------------------------

     

    root@colibri-imx6:/etc/ppp/peers# vi wcdma-chat-disconnect

    -----------------------

    ABORT "ERROR"

    ABORT "NO DIALTONE"

    SAY "\NSending break to the modem\n"

    ""\k"

    ""+++ATH"

    SAY "\nGood bay\n"

    ---------------------------

    e). 连接网络

    root@colibri-imx6:/etc/ppp/peers# pppd call wcdma

    ……

    ATDT*99#^M^M

    CONNECT

     -- got it

     

    send (\d)

    Serial connection established.

    Using interface ppp0

    Connect: ppp0 <--> /dev/ttyUSB0

    CHAP authentication succeeded: Welcome!!

    CHAP authentication succeeded

    Could not determine remote IP address: defaulting to 10.64.64.64

    local  IP address 10.91.228.253

    remote IP address 10.64.64.64

    primary   DNS address 221.12.1.227

    secondary DNS address 221.12.33.227

     

    查看网络状态

    root@colibri-imx6:/etc/ppp/peers# ifconfig

    ……

    ppp0      Link encap:Point-to-Point Protocol 

              inet addr:10.23.107.61  P-t-P:10.64.64.64  Mask:255.255.255.255

              UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1

              RX packets:6 errors:0 dropped:0 overruns:0 frame:0

              TX packets:6 errors:0 dropped:0 overruns:0 carrier:0

              collisions:0 txqueuelen:3

              RX bytes:84 (84.0 B)  TX bytes:102 (102.0 B)

    f). 测试网络

    root@colibri-imx6:/etc/ppp/peers# echo nameserver 221.12.1.227 > /etc/resolv.conf                 //设置DNS服务器

    root@colibri-imx6:/etc/ppp/peers# ping www.baidu.com

    PING www.baidu.com (61.135.169.121): 56 data bytes

    64 bytes from 61.135.169.121: seq=0 ttl=52 time=218.477 ms

    64 bytes from 61.135.169.121: seq=1 ttl=52 time=68.066 ms

    64 bytes from 61.135.169.121: seq=2 ttl=52 time=107.773 ms

    64 bytes from 61.135.169.121: seq=3 ttl=52 time=77.604 ms

    64 bytes from 61.135.169.121: seq=4 ttl=52 time=77.339 ms

     

    总结

    根据上述两种模式的测试结果,第一种Ethernet mode相对速度要更稳定一些,因此对于支持两种模式的modem更建议采用Ethernet mode;另外串口modem使用配置也可以参考Fallback mode。本文虽以E303s为例,但其他3G/4G Modem的配置也是类似,只是需要确定对应模式的Vendor ID,Product ID和Message。

    参考文档

    https://www.toradex.cn/zh_cn/computer-on-modules/colibri-arm-family/nxp-freescale-imx6

    https://www.toradex.cn/zh_cn/products/carrier-board/colibri-evaluation-carrier-board

    http://developer.toradex.com/software/linux/linux-software

    http://www.draisberghof.de/usb_modeswitch/

    http://www.cnblogs.com/ziqiuqiandao/archive/2013/06/06/3120972.html


    扩展:


    USB 3G卡热插拔那些事


    http://blog.chinaunix.NET/uid/20786208/cid-155003-abstract-1.html

    六、相关博客




  • 9
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

聚优致成

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值