Win CE 6.0 - Serial port enumeration and ioexception on serialport.open()

I'm developing using VS 2005 and CE 6.0 Platform Builder and C#. My target device is an eBox-2300 CEPC with two physical serial ports.

All of my code thus far works on the development PC, but I have problems when I try to deploy to my device.

I have two immediate issues that I need help with.

First, I have a routine that attempts to enumerate the serial ports on the system. The code is as follows:

********************************************************
public static string SetPortName(string defaultPortName)
{
string portName;

Console.WriteLine("Available Ports:");
foreach (string s in SerialPort.GetPortNames())
{
Console.WriteLine(" {0}", s);
}

Console.Write("COM port({0}): ", defaultPortName);
portName = Console.ReadLine();

if (portName == "")
{
portName = defaultPortName;
}
return portName;
}
**************************************************
The problem here is that I only get COM1 returned by the routine. I need and expect to also see a COM2, which is physically present and enabled in the system's BIOS.
Checking the OS design, the serial ports appear to be included. Is this an issue with the Board Support Package What else should I be looking for

The second error I get is when I try to open the serial port found in the above code, COM1.

I do a

_serialPort.Open();

and I immediately get the following error message:

An unhandled exception of type 'System.IO.IOException' occurred in System.dll

Additional information: IOException

How can I begin track down these errors

Any pointers gratefully received...


Answer this question

Win CE 6.0 - Serial port enumeration and ioexception on serialport.open()

  • e. ogas

    Hi,

    I'm using an x86 compatible processor which boots off of a compact flash card. The CF card first boots DOS. In order to load my CE image, I use an autoexec.bat file which calls the LOADCEPC.EXE application.

    LOADCEPC.EXE is a command line app which has a number of possible parameters. I use the following construct:

    LOADCEPC /C:0 nk.bin

    This tells it not to use the second serial port as a debug port, allowing my applications to use it.

    I hope this helps.


  • AlexBB

    I've figured out why I wasn't seeing the COM port, as you stated Michael, it was a debug port, so I used the command line argument /C:0 with LOADCEPC.EXE and both of my ports became available.

    Thanks for the help.

    Andrew

  • Tej62007

    Could you please explain in a little more detail how you did this Thanks.
  • Luigi Fonti

    I'm not sure if it is the same thing or not. However, when I run the application on the CE device (it's a Vortex86 board), I get more detail in the error trace messages.

    My call to serialport.open() calls, System.IO.Ports.SerialStream.SetBufferSizes(), which calls System.IO.Ports.SerialStream.CheckResult(), which throws System.IO.Ports.SerialStream.WinIOError().

    Is this any help

  • syperk

    I'm really not able to figure out the problem here - is this similar to http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=993999&SiteID=1, since both are trying to open serialport object for COM ports
  • HScottBuck

    Hi

    The reason why you see only one serial port instead of two is most likely because Windows CE uses the physical port COM1 as debug serial port. The port used as (kernel)debug serial port is not available to applications.

    I'd suggest that you write a C++ small test program using all serial communication relared APIs. This should help to isolate the problems.

    Michael



  • dustinto

    Hi,

    Iam trying to send data via serial port of CEPC to another PC's serial port.

    I have WinCE 5.0 installed in my machine .

    As i read this replys in the forum i came to know in CEPC serial port COM1 : is used for debugging , in order to use serial port for my application we need to disable serial for debugging purpose.

    Please tell me where i need to do the changes

    In my machine i have only one serial port COM1 and i want this to be used for my application.

    Please help Smile


  • Win CE 6.0 - Serial port enumeration and ioexception on serialport.open()