From: Paraschiv Victor on
I intend to build 2 programss 1 for win app and 1 for Pocket PC in order
to connect them via serial port. I'm using .NET framework 20.

In the win app I use:

private void Form1_Load(object sender, EventArgs e)
{
SerialPort sp = new SerialPort("COM2", 19200);
sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);

sp.StopBits = StopBits.One;
sp.ReadTimeout = 500;
sp.WriteTimeout = 500;
sp.Open();
}
for writing :
sp.WriteLine(txtMessage.Text);

and for reading:
txtMessage = sp.ReadLine();

In CF app I use the same parameters for connection and the same
procedures for sending/reading data. The 2 devices are connected with a
cable from HP.

The problem is that neither the win app nor the CF app receives any
string or any message. I get a connection timeout exception. I really
can't figure it out what is the matter.

I also tryed to insert a mother/mother rs232 cable in COM2 and connect
with a wire pins 2 and 3. But I also got nothing.


Thanks a lot,
Victor Paraschiv
From: Doug Forster on
Hi Victor,

You don't say what your device is but presuming from your hints that it is a
HP Pocket PC using the builtin serial port then this devices serial port is
almost certainly COM1. I haven't used the CF classes for this, but at api
level you need to specify the port as COM1: (with the colon)
If none of that helps then you could explore different port speed settings.

Cheers
Doug Forster

"Paraschiv Victor" <dr.vick(a)gmail.com> wrote in message
news:uT6kKSHvFHA.2348(a)TK2MSFTNGP15.phx.gbl...
>I intend to build 2 programss 1 for win app and 1 for Pocket PC in order
> to connect them via serial port. I'm using .NET framework 20.
>
> In the win app I use:
>
> private void Form1_Load(object sender, EventArgs e)
> {
> SerialPort sp = new SerialPort("COM2", 19200);
> sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);
>
> sp.StopBits = StopBits.One;
> sp.ReadTimeout = 500;
> sp.WriteTimeout = 500;
> sp.Open();
> }
> for writing :
> sp.WriteLine(txtMessage.Text);
>
> and for reading:
> txtMessage = sp.ReadLine();
>
> In CF app I use the same parameters for connection and the same procedures
> for sending/reading data. The 2 devices are connected with a
> cable from HP.
>
> The problem is that neither the win app nor the CF app receives any
> string or any message. I get a connection timeout exception. I really
> can't figure it out what is the matter.
>
> I also tryed to insert a mother/mother rs232 cable in COM2 and connect
> with a wire pins 2 and 3. But I also got nothing.
>
>
> Thanks a lot,
> Victor Paraschiv


From: Paraschiv Victor on
Hi Doug.Thank you for advice. The pocket pc uses by default COM1.I don't
receive any error when I try to open or read/write to the port. I assume
that CF successfully opens the port.
I used this material to get myself informed :
http://www.codeproject.com/csharp/SerialCommunication.asp .

When using win app I connect pins 3 and 4 (althogh in Tapans's article
is specified that pins 2and 3 should be connected)and I got a send and a
receive message as expected. In Pocket PC application that uses exactly
the same methods I get an application failure with pins connected and no
error if I have PC and PPC linked directly with the cable.

Victor Paraschiv

Doug Forster wrote:
> Hi Victor,
>
> You don't say what your device is but presuming from your hints that it is a
> HP Pocket PC using the builtin serial port then this devices serial port is
> almost certainly COM1. I haven't used the CF classes for this, but at api
> level you need to specify the port as COM1: (with the colon)
> If none of that helps then you could explore different port speed settings.
>
> Cheers
> Doug Forster
>
> "Paraschiv Victor" <dr.vick(a)gmail.com> wrote in message
> news:uT6kKSHvFHA.2348(a)TK2MSFTNGP15.phx.gbl...
>
>>I intend to build 2 programss 1 for win app and 1 for Pocket PC in order
>>to connect them via serial port. I'm using .NET framework 20.
>>
>>In the win app I use:
>>
>>private void Form1_Load(object sender, EventArgs e)
>>{
>>SerialPort sp = new SerialPort("COM2", 19200);
>>sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);
>>
>>sp.StopBits = StopBits.One;
>>sp.ReadTimeout = 500;
>>sp.WriteTimeout = 500;
>>sp.Open();
>>}
>> for writing :
>>sp.WriteLine(txtMessage.Text);
>>
>>and for reading:
>>txtMessage = sp.ReadLine();
>>
>>In CF app I use the same parameters for connection and the same procedures
>>for sending/reading data. The 2 devices are connected with a
>>cable from HP.
>>
>>The problem is that neither the win app nor the CF app receives any
>>string or any message. I get a connection timeout exception. I really
>>can't figure it out what is the matter.
>>
>>I also tryed to insert a mother/mother rs232 cable in COM2 and connect
>>with a wire pins 2 and 3. But I also got nothing.
>>
>>
>> Thanks a lot,
>>Victor Paraschiv
>
>
>
From: Paraschiv Victor on
I've cheked it out. COM1 is the only port on my PDA and using "COM1" or
"COM1:" get the same null result.
Is there any possibility that the PDA doesn't have enough power to send
directly signals to serial port and I'll have to create a handshake
connection?

Victor

Doug Forster wrote:
> Hi Victor,
>
> You don't say what your device is but presuming from your hints that it is a
> HP Pocket PC using the builtin serial port then this devices serial port is
> almost certainly COM1. I haven't used the CF classes for this, but at api
> level you need to specify the port as COM1: (with the colon)
> If none of that helps then you could explore different port speed settings.
>
> Cheers
> Doug Forster
>
> "Paraschiv Victor" <dr.vick(a)gmail.com> wrote in message
> news:uT6kKSHvFHA.2348(a)TK2MSFTNGP15.phx.gbl...
>
>>I intend to build 2 programss 1 for win app and 1 for Pocket PC in order
>>to connect them via serial port. I'm using .NET framework 20.
>>
>>In the win app I use:
>>
>>private void Form1_Load(object sender, EventArgs e)
>>{
>>SerialPort sp = new SerialPort("COM2", 19200);
>>sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);
>>
>>sp.StopBits = StopBits.One;
>>sp.ReadTimeout = 500;
>>sp.WriteTimeout = 500;
>>sp.Open();
>>}
>> for writing :
>>sp.WriteLine(txtMessage.Text);
>>
>>and for reading:
>>txtMessage = sp.ReadLine();
>>
>>In CF app I use the same parameters for connection and the same procedures
>>for sending/reading data. The 2 devices are connected with a
>>cable from HP.
>>
>>The problem is that neither the win app nor the CF app receives any
>>string or any message. I get a connection timeout exception. I really
>>can't figure it out what is the matter.
>>
>>I also tryed to insert a mother/mother rs232 cable in COM2 and connect
>>with a wire pins 2 and 3. But I also got nothing.
>>
>>
>> Thanks a lot,
>>Victor Paraschiv
>
>
>
From: Doug Forster on
Hi Victor,

> Is there any possibility that the PDA doesn't have enough power to send
> directly signals to serial port and I'll have to create a handshake
> connection?

There are lots of folks on this group that know more about such hardware
issues than me, but I doubt that it is a power problem like that. What PDA
are you testing on ? Have you checked that the ActiveSync serial connection
is disabled ? What about trying different endpoint software to try and
isolate where the problem is ? e.g. HyperTerminal or the like on the
desktop. What about trying your desktop code talking to another desktop
port. Then you might get some idea of whether you have a cable / hardware
problem or a software problem.

Most folks on this group (including me) are using unmanaged code for Pocket
PC programming. If its turns out to be a programming issue you might find
more information if you post on the compactframework NG

Cheers
Doug Forster