I'm using Pocket PC 2003 device emulator v8.0.50727.42 and am trying to use the COM ports by mapping them to COM1 of my PC
I can successfully create a handle for serial port 0 (COM1) or serial port 2 (COM3), but it fails for serial port 1 (COM2 ).
In addition if I try and write to serial port 0 I get the first byte out of my PC COM port but then my application on the emulator appears to block on the call to WriteFile. If I click on the emulator frame a few more bytes get sent and then it blocks again.
If I write to serial port 2 the application appears to successfully send the data i.e. no block this time, but nothing comes out of my PC COM port.
I've run the application on a HP Pocket PC using it's COM1 port and the application works fine so it seems to be some problem with the emulator. I've also tried the CEChat example program from D.Bolings 'WinCE .NET' book and this has the same problems as my application.
Anyone any ideas what's happening

Device Emulator COM port problems
Joshua Nobes
clint 2
I did some investigation and discovered a bug in the way the emulator initializes the PC's COM port. The result is that the character length and number of stop bits may not match the settings your software specified for the port.
The fix is in the DeviceEmulator V3, which doesn't yet have an ETA for when it will be available to the public. In the meantime, if you can modify your software, try setting the character length and number of stop bits to 7 and 2, then set them to whatever your app needs. That'll force the emulator to set the PC's COM port to match.
With the bug fix, I'm able to use ActiveSync-over-serial to sync my emulator and install apps, using the 115200 baud configuration. That was the biggest workload I could come up with for serial emulation.
Barry
.NETPhreak
//////////////////////////////////////////////////
dcb.StopBits = TWOSTOPBITS;
dcb.ByteSize = 7;
if(SetCommState( hComm, &dcb ) == 0)
return FALSE;
//////////////////////////////////////////////////
dcb.StopBits = ONESTOPBIT;
dcb.Parity = NOPARITY;
dcb.ByteSize = 8;
if(SetCommState( hComm, &dcb ) == 0)
return FALSE;
But this doesn't work either.
J_Dude2003
I tried the following (see '//// FIX ///' section) but it didn't make any difference. Is this what you meant
hComm = CreateFile( portIdent,
GENERIC_READ | GENERIC_WRITE,
0, // exclusive access
NULL, // no security attrs
OPEN_EXISTING,
0, // non-overlapped I/O
NULL);
if(hComm == INVALID_HANDLE_VALUE)
return FALSE;
// setup device buffers
SetupComm( hComm, 4096, 4096 );
// purge any information in the buffer
PurgeComm( hComm, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
dcb.DCBlength = sizeof(dcb);
GetCommState(hComm, &dcb);
dcb.BaudRate = baudRate;
dcb.fParity = FALSE;
dcb.fNull = 0;
////////////////// FIX //////////////////////
dcb.StopBits = TWOSTOPBITS;
dcb.ByteSize = 7;
//////////////////////////////////////////////////
dcb.StopBits = ONESTOPBIT;
dcb.Parity = NOPARITY;
dcb.ByteSize = 8;
if(SetCommState( hComm, &dcb ) == 0)
return FALSE;
Mark
R8VI
Yorker
Serial Port 1 is in use by the CE kernel, for debug output. So apps generally cannot use it for themselves.
The emulator has been used to drive serial ports as fast as 460,800 baud, but the emulator isn't fast enough to sustain that rate, so flow control (CTS/DTS or xon/xoff) is usually needed to throttle the data transfers. Serial I/O performance is something we'll be working on in an upcoming emulator release.
I have a copy of Boling's book and will try out the CEChat app. Can you post some specifics of your machine configuration CPU speed, memory size, and serial ports. What kind of serial device are you connecting the emulator to, and what kind of serial hardware is in your PC
Thanks,
Barry
Dan Mikkelsen
Is there a document anywhere detailing what COM settings are useable on the emulator
outcast1881
Manuf: HP
OS: Microsoft Windows XP Professional (SP2)
RAM: 1GB
CPU: Pentium 4, 3.00GHz
RS232: one inbuilt port designated as COM1
I'm connecting to a data logger that we've developed which does not use flow control. Hence I am not using this on the CE app I'm developing. Also I've written a Win32 app that uses the PC's COM1 and this works fine so I'm confident my hardware is OK.
Since the last post I've found that even using 9600 is not guaranteed to work. I think it was just a coincidence that changing the baud rate helped. Doing a hard reset on the emulator doesn't seem to resolve the problem which is intermittent
Karl Hulme
I am having a similar problem, the COM port on my host machine is a USB adapter. It works fine on the PC (with an RS232 GPS connection) using Hyperterminal but does not enumerate in the VS2005 Tools | Options | Device Tools | Devices | Properties | Emulator Options | Peripherals Com drop down boxes. I can see other Coms listed in there that were created when I was playing with Bluetooth connections but not this one (Com3).
I suspect this might be more appropriate in the VS 2005 forum but thought I would try here first
James Reid
Ewild
Thanks for the data about your machine. It's definitely plenty fast. I'll investigate, but it will take me a a week or two.
Barry