Ever tried developing Windows Mobile application with Cellular emulator and using Huawei USB UMTS modem? Didn’t? Lucky you…
This year before going to my vacation I decided it is about time I get my self one of those USB UMTS modems so I can be on-line wherever and whenever. Just before going to my vacation I started developing SMSCentar for Windows Mobile and all was going great. I wrote about SMSCentar earlier and to sum it up is it an application working with SMS messages and for debugging it required running Cellular Emulator to emulate GSM/GPRS operator to Windows Mobile Emulator. To work, Cellular Emulator is creating COM port which Windows Mobile emulator is connecting to. The result is one “Fake GSM network” Windows Mobile emulator is connected to.
As Cellular Emulator isn’t one of the most stable applications available I created a small batch file which reinstalled COM port which Cellular emulator is using to connect with Windows Mobile emulator. In it’s essence it is running UnInstall and than Install procedure for InstallXPVCom. Cellular Emulator worked always on the same COM port (port 4) and things were going smoothly.
One day I needed my daily dosage of Internet so Huawei was used for the first time. Installation worked like a charm, a click here and a click there and I was on line. No problems here. Unplugged it from my laptop and shut my laptop down. Next day I opened up my VS solution and ran my batch script for Cellular emulator and was surprised to see that Cellular emulator changed it’s port to COM 6… Hmm, why did it do that? Didn’t care much, it was a small matter of configuring Windows Mobile Emulator to map to COM 6 and I was on my way. About an hour later I was stuck on one problem and I concluded that it is for the best if I ask Goggle to help me out. Plugged in my USB Huawei modem, tried to connect to UMTS network and… BSoD!!! Cold sweat suddenly all over my forehead… What just happened?! Computer rebooted, tried again to connect to the UMTS network and it was all OK. But that BSoD just kept bugging me.
Tried to reproduce the steps to BSoD (after backing up my files :) ) and came to conclusion that when Cellular Emulator is running and Huawei modem is plugged in USB, BSoD comes to visit my laptop. Digging some more found out that like all modems Huawei USB UMTS modem is creating it’s COM port. If Celullar Emulator is not running, modem just grabs the lowest available COM port for him self. If that modem isn’t plugged in InstallXPVCom is also trying to grab the lowest possible COM port and voila, both of them are trying to use the same COM port. Start up Cellular Emulator and it opens COM port, plug in USB modem and he tries to use that same COM port. And until you initiate UMTS connection all is fine, but it seems like some specific AT command isn’t much liked by Cellular Emulator and BSoD is inevitable. Solution to this annoying problem is to run “InstallXPVCom.exe UnInstall” to remove all COM ports used by Cellular Emulator. Next, plug in USB modem and via Device Manager find your USB modem and change it’s COM port to some higher value, preferably above COM10 because modem will work fine with with higher COM ports unlike Cellular Emulator which doesn’t like COM ports higher than 9. Next, run “InstallXPVCom.exe Install” and Cellular emulator is most likely to grab lowest available COM port (most often COM4 because COM1 and COM2 are reserved for physical COM ports and COM3 is almost always used for internal modem) and BSoD should be a matter of something to forget about.