1. 程式人生 > >DM368開發 -- 華為3G/4G模組移植

DM368開發 -- 華為3G/4G模組移植

一、模組介紹

用的是華為 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

二、相關文件


三、華為模組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="[email protected]"
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 ([email protected]) (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 [email protected]).
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: [email protected],0 with framebuffer size 4050KB
davincifb davincifb.0: dm_vid0_fb: [email protected],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: [email protected],0 with framebuffer size 675KB
davincifb davincifb.0: dm_vid1_fb: [email protected],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 <[email protected]>

 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

[email protected]:~# 

五、相關部落格

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裝置

[email protected]:/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

[email protected]:/home# ./usb_modeswitch -c 12d1:1f01

……

[email protected]:/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檢視

[email protected]:/home# lsusb

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

……

d). 檢視網路,出現eth1,正確獲取ip並連線到網路,下面就可以用使用乙太網同樣方法使用網路了

[email protected]:/home# ifconfig

……

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

          inet addr:192.168.1.100  Bcast:192.168.