Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to communicate with USB 3G modem?

I have a D-Link DWM-156 3G USB modem that I want to send AT-commands to from my application (C# .NET 4.0 running on Windows XP SP3).

After plug-in and installation of drivers the modem shows up like this:

In Device Manager, two serial ports are added:

  • D-Link HSPADataCard Diagnostics Interface (COM4)
  • D-Link HSPADataCard NMEA Device (COM5)

In Control Panel, Phone and Modem Options, a new modem is added:

  • D-Link HSPADataCard Proprietary USB Modem (attached to COM19)

QUESTION: Which com port should I use to send AT-commands, and at which speed?


I have tried all three ports at different speeds, but with no luck whatsoever.

In order to learn, I then installed the "Free Serial Port Monitor" sniffer app, hoping to be able to monitor the communication with the D-Link ustility as it opens and closes the internet connection (which works OK).

On start, the sniffer app asks me which port to monitor and offers me the following port names to choose from:

  • "Agere Systems HDA Modem",
  • "D-Link HSPADataCard Proprietary USB Modem",
  • "COM3",
  • "COM4",
  • "COM5"
  • ...and several more, including "COM19".

Choosing the "D-Link..." name works OK, now I can watch all the AT commands being used as they happen, but I cannot determine at which baud rate the port is used. Further, neither COM4, COM5 or COM19 works for sniffing this way (nothing seems to happen on those ports).

Now I would like to use the SerialPort class in .NET to open the "D-Link..." port and talk with the USB modem, but the SerialPort class requires the port name to start with "COM", otherwise an exception is thrown. But none of the ordinary COM-ports work. And I still don't know which baud rate to use. I'm pretty much confused and locked up here - what could I do to get to the bottom of this?

like image 626
Martin Christiansen Avatar asked Jun 22 '12 13:06

Martin Christiansen


People also ask

How does a USB modem works?

Mobile Broadband works by using any of the following hardware: A portable USB modem (known as a dongle) that plugs directly into a USB port and uses a SIM-card to connect to the mobile network. A data card or built-in device, this is available on some laptops.

What is 3G 4G USB?

3G/4G USB cellular modems can be used to provide Internet access to HMP200, HMP130, and HMP100 devices via a mobile broadband connection. Also called standalone mobile broadband modems, these USB devices are designed to be connected directly to one device via an USB port.


1 Answers

Ok folks, thank you for all your thoughts and your input. I have done some more research, and finally i realized, that in order to do what i wanted i did not have to bother with serial ports and AT-commands at all. All that was needed was to do a few Windows RAS calls.

If I had just been a bit more specific in my question about what I wanted to do with my AT-commands, you would surely have told me about RAS long time ago!

I found a nice .Net DLL (DotRas) that wraps native Windows RAS for use from managed code, and it seems to do just what I need (dial a 3G modem connection from code, with any type of 3G modem I attach).

Thank you again for your time.

like image 99
Martin Christiansen Avatar answered Sep 27 '22 21:09

Martin Christiansen