Programming huawei E220

Josh picture Josh · Mar 4, 2010 · Viewed 9.9k times · Source

I have a 3G Huawei E220 modem. How can I programme or interact with the modem from c# or vb.net. I've tried looking if there's some sort of sdk or api but have not been able to find anything. Can someone tell me how to get started with this. I'd like to able to inisiate a connection and then log tranfer statistics. There's a network connection setup for the modem in "Network and Sharing Center" in windows, so could I somehow use that or do I have to send the commands to the modem?

Thanks

Answer

user322681 picture user322681 · Apr 21, 2010

The modem, once configured, will show up as two USB serial ports. The first port is for initialization, dialing and data communications and the second one is for querying/monitoring. Controlling the modem through the two ports is done via AT commands. You can see how things work by opening the ports with HyperTerminal, issuing commands to them and watching the responses. The commands are mostly generic, but there are some proprietary ones.

AT^SYSCFG=2,1,3FFFFFFF,1,2 for GPRS/EDGE Preferred
AT^SYSCFG=2,2,3FFFFFFF,1,2 for 3G Preferred
AT^SYSCFG=13,1,3FFFFFFF,1,2 for GPRS/EDGE Only
AT^SYSCFG=14,2,3FFFFFFF,1,2 for 3G Only

The third parameter, 0x3FFFFFFF tells the card to use all bands. A value of 0x400380 here means GSM900/1800/WCDMA2100 only and a value of 0x200000 here means GSM1900 only.

I don't know what the final "1,2" parameter is for. But for some it has to be "2,4" instead for some reason.

The status updates from the second port are prefixed with a caret and are of these forms:

^MODE:3,2 indicates GPRS
^MODE:3,3 indicates EDGE
^MODE:5,4 indicates 3G
^MODE:5,5 indicates HSDPA

^DSFLOWRPT:n,n,n,n,n,n,n
n1 is the duration of the connection in seconds
n2 is transmit (upload) speed in bytes per second (n2 *8 / 1000 will give you kbps)
n3 is receive (download) speed in bytes per second (n3 *8 / 1000 will give you kbps)
n4 is the total bytes transmitted during this session
n5 is the total bytes transmitted during this session
n6 no idea, but I always get 0x1F40 (8000) here
n7 no idea, but I always get 0x7530 (30000) here

You can reset the connection statistics by sending AT^DSFLOWCLR.

Information on how to initialize the device can be found here:

More information here and here:

Another thing, the formatting of the responses from the e220 change slightly with the firmware version.