Hi everybody,

I have a C# program can to test serial port communication.
but it working on WM5 very well but on Windows CE 5.0 + NETCFV2Sp1/Sp2
is failed.
it is same hardware device and serial port driver(source code), and
using API is
Never fire "DataReceived" event on WinCE 5.0 platform.
I don't understand why? and what's root cause.

May you can give a hand?

Re: What's SerialPort can not fire DataReceived event. by ctacke/>

ctacke/>
Wed Sep 12 04:54:26 PDT 2007

Without seeing your code it's difficult to say.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com


"Kun-Yi" <kunyi.chen@gmail.com> wrote in message
news:1189595010.905633.189670@50g2000hsm.googlegroups.com...
> Hi everybody,
>
> I have a C# program can to test serial port communication.
> but it working on WM5 very well but on Windows CE 5.0 + NETCFV2Sp1/Sp2
> is failed.
> it is same hardware device and serial port driver(source code), and
> using API is
> Never fire "DataReceived" event on WinCE 5.0 platform.
> I don't understand why? and what's root cause.
>
> May you can give a hand?
>



Re: What's SerialPort can not fire DataReceived event. by Dick

Dick
Wed Sep 12 09:36:01 PDT 2007

Hi,

I have a WinCE 5 Industrial PPC (Psion) that exhibits this problem. Quite a
bit of testing makes me think that it is a driver/OS image issue, related to
power-down. If I do a hard reset, and reload all of my software (usually),
the DataReceived event in generated. However, often when the PPC is
subsequently powered down and then powered back up, data no longer is
receive (polling does not work, either). I "think" that the serial driver,
or something related, enters some (bug) state that causes this.

BTW, the earlier version, WinCE 4.2 did not show this problem. Although the
vendor has tried to help, nothing has been resolved, so far.

The same issue shows itself with my CFSerialIO dll (see my homepage) and
with the Serial class from OpenNETCF -- so, I think it is outside my
control.

BTW, it is possible that there is an issue with your code (as Chris
mentioned). For example, you should make sure that both DTREnable and
RTSEnable = True.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.



Re: What's SerialPort can not fire DataReceived event. by Kun-Yi

Kun-Yi
Wed Sep 12 20:26:45 PDT 2007

Dear Dick,
Thank you for your infomation. but my platform has serial
driver code and using API to operation it is fine.
and Using WM5 OS is OK. and when my device is clean boot still cannot
generation a "DataReceived" event.
I guess the event implement method is to create a thread to monitor RX
buffer and to compare "ReceivedByteThreshold" condition. When I to use
ReadExisting() can get Rx date, so I cannot accept the problem due to
serial driver has bugs.


BTW if your device just after suspend/resume has the issues. I guess
serial drivers reconfiguration UART GPIO when Power_Down but Power_Up
not to correct restore original setting.

BTW again thank you reply the mail.
Best regards,
KunYi

On 9 13 , 12 36 , "Dick Grier" <dick_grierNOSPAM@.msn.com> wrote:
> Hi,
>
> I have a WinCE 5 Industrial PPC (Psion) that exhibits this problem. Quite a
> bit of testing makes me think that it is a driver/OS image issue, related to
> power-down. If I do a hard reset, and reload all of my software (usually),
> the DataReceived event in generated. However, often when the PPC is
> subsequently powered down and then powered back up, data no longer is
> receive (polling does not work, either). I "think" that the serial driver,
> or something related, enters some (bug) state that causes this.
>
> BTW, the earlier version, WinCE 4.2 did not show this problem. Although the
> vendor has tried to help, nothing has been resolved, so far.
>
> The same issue shows itself with my CFSerialIO dll (see my homepage) and
> with the Serial class from OpenNETCF -- so, I think it is outside my
> control.
>
> BTW, it is possible that there is an issue with your code (as Chris
> mentioned). For example, you should make sure that both DTREnable and
> RTSEnable = True.
>
> Dick
>
> --
> Richard Grier, MVP
> Hard & Software
> Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
> Edition,
> ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
> 2006.
> Seewww.hardandsoftware.netfor details and contact information.



Re: What's SerialPort can not fire DataReceived event. by Kun-Yi

Kun-Yi
Wed Sep 12 22:32:45 PDT 2007

Dear All,
I check my code can get a serialport.BytesToRead property.
But it still not fire DataReceived Event

// my initial setting
serialPort.PortName = "COM1";
serialPort.ReceivedBytesThreshold = 1;
serialPort.DtrEnable = true;
serialPort.RtsEnable = true;
serialPort.Handshake = Handshake.None;
serialPort.BaudRate = 115200;
serialPort.DataBits = 8;
serialPort.Parity = Parity.None;
serialPort.StopBits = StopBits.One;
serialPort.DataReceived = new
SerialDataReceivedEventHandler(RxDataEvent);
serialPort.Open();


On 9 13 , 11 26 , Kun-Yi <kunyi.c...@gmail.com> wrote:
> Dear Dick,
> Thank you for your infomation. but my platform has serial
> driver code and using API to operation it is fine.
> and Using WM5 OS is OK. and when my device is clean boot still cannot
> generation a "DataReceived" event.
> I guess the event implement method is to create a thread to monitor RX
> buffer and to compare "ReceivedByteThreshold" condition. When I to use
> ReadExisting() can get Rx date, so I cannot accept the problem due to
> serial driver has bugs.
>
> BTW if your device just after suspend/resume has the issues. I guess
> serial drivers reconfiguration UART GPIO when Power_Down but Power_Up
> not to correct restore original setting.
>
> BTW again thank you reply the mail.
> Best regards,
> KunYi
>
> On 9 13 , 12 36 , "Dick Grier" <dick_grierNOSPAM@.msn.com> wrote:
>
> > Hi,
>
> > I have a WinCE 5 Industrial PPC (Psion) that exhibits this problem. Quite a
> > bit of testing makes me think that it is a driver/OS image issue, related to
> > power-down. If I do a hard reset, and reload all of my software (usually),
> > the DataReceived event in generated. However, often when the PPC is
> > subsequently powered down and then powered back up, data no longer is
> > receive (polling does not work, either). I "think" that the serial driver,
> > or something related, enters some (bug) state that causes this.
>
> > BTW, the earlier version, WinCE 4.2 did not show this problem. Although the
> > vendor has tried to help, nothing has been resolved, so far.
>
> > The same issue shows itself with my CFSerialIO dll (see my homepage) and
> > with the Serial class from OpenNETCF -- so, I think it is outside my
> > control.
>
> > BTW, it is possible that there is an issue with your code (as Chris
> > mentioned). For example, you should make sure that both DTREnable and
> > RTSEnable = True.
>
> > Dick
>
> > --
> > Richard Grier, MVP
> > Hard & Software
> > Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
> > Edition,
> > ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
> > 2006.
> > Seewww.hardandsoftware.netfordetails and contact information.



Re: What's SerialPort can not fire DataReceived event. by Kun-Yi

Kun-Yi
Wed Sep 12 22:57:17 PDT 2007

Dear All,
currently I confuse due to I using a USB to COM dongle(use FDTI
chip & driver) on the platform is OK,
Have anyone know NetCFV2 how to implement the event launch?
may be I can to check serial driver to meet the requirements.

best regards,
KunYI

On 9 13 , 1 32 , Kun-Yi <kunyi.c...@gmail.com> wrote:
> Dear All,
> I check my code can get a serialport.BytesToRead property.
> But it still not fire DataReceived Event
>
> // my initial setting
> serialPort.PortName = "COM1";
> serialPort.ReceivedBytesThreshold = 1;
> serialPort.DtrEnable = true;
> serialPort.RtsEnable = true;
> serialPort.Handshake = Handshake.None;
> serialPort.BaudRate = 115200;
> serialPort.DataBits = 8;
> serialPort.Parity = Parity.None;
> serialPort.StopBits = StopBits.One;
> serialPort.DataReceived = new
> SerialDataReceivedEventHandler(RxDataEvent);
> serialPort.Open();
>
> On 9 13 , 11 26 , Kun-Yi <kunyi.c...@gmail.com> wrote:
>
> > Dear Dick,
> > Thank you for your infomation. but my platform has serial
> > driver code and using API to operation it is fine.
> > and Using WM5 OS is OK. and when my device is clean boot still cannot
> > generation a "DataReceived" event.
> > I guess the event implement method is to create a thread to monitor RX
> > buffer and to compare "ReceivedByteThreshold" condition. When I to use
> > ReadExisting() can get Rx date, so I cannot accept the problem due to
> > serial driver has bugs.
>
> > BTW if your device just after suspend/resume has the issues. I guess
> > serial drivers reconfiguration UART GPIO when Power_Down but Power_Up
> > not to correct restore original setting.
>
> > BTW again thank you reply the mail.
> > Best regards,
> > KunYi
>
> > On 9 13 , 12 36 , "Dick Grier" <dick_grierNOSPAM@.msn.com> wrote:
>
> > > Hi,
>
> > > I have a WinCE 5 Industrial PPC (Psion) that exhibits this problem. Quite a
> > > bit of testing makes me think that it is a driver/OS image issue, related to
> > > power-down. If I do a hard reset, and reload all of my software (usually),
> > > the DataReceived event in generated. However, often when the PPC is
> > > subsequently powered down and then powered back up, data no longer is
> > > receive (polling does not work, either). I "think" that the serial driver,
> > > or something related, enters some (bug) state that causes this.
>
> > > BTW, the earlier version, WinCE 4.2 did not show this problem. Although the
> > > vendor has tried to help, nothing has been resolved, so far.
>
> > > The same issue shows itself with my CFSerialIO dll (see my homepage) and
> > > with the Serial class from OpenNETCF -- so, I think it is outside my
> > > control.
>
> > > BTW, it is possible that there is an issue with your code (as Chris
> > > mentioned). For example, you should make sure that both DTREnable and
> > > RTSEnable = True.
>
> > > Dick
>
> > > --
> > > Richard Grier, MVP
> > > Hard & Software
> > > Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
> > > Edition,
> > > ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
> > > 2006.
> > > Seewww.hardandsoftware.netfordetailsand contact information.



Re: What's SerialPort can not fire DataReceived event. by Kun-Yi

Kun-Yi
Thu Sep 13 03:50:49 PDT 2007

A bad news is CETK/SerialPort test is pass. what's happened?

On 9 13 , 1 57 , Kun-Yi <kunyi.c...@gmail.com> wrote:
> Dear All,
> currently I confuse due to I using a USB to COM dongle(use FDTI
> chip & driver) on the platform is OK,
> Have anyone know NetCFV2 how to implement the event launch?
> may be I can to check serial driver to meet the requirements.
>
> best regards,
> KunYI
>
> On 9 13 , 1 32 , Kun-Yi <kunyi.c...@gmail.com> wrote:
>
> > Dear All,
> > I check my code can get a serialport.BytesToRead property.
> > But it still not fire DataReceived Event
>
> > // my initial setting
> > serialPort.PortName = "COM1";
> > serialPort.ReceivedBytesThreshold = 1;
> > serialPort.DtrEnable = true;
> > serialPort.RtsEnable = true;
> > serialPort.Handshake = Handshake.None;
> > serialPort.BaudRate = 115200;
> > serialPort.DataBits = 8;
> > serialPort.Parity = Parity.None;
> > serialPort.StopBits = StopBits.One;
> > serialPort.DataReceived = new
> > SerialDataReceivedEventHandler(RxDataEvent);
> > serialPort.Open();
>
> > On 9 13 , 11 26 , Kun-Yi <kunyi.c...@gmail.com> wrote:
>
> > > Dear Dick,
> > > Thank you for your infomation. but my platform has serial
> > > driver code and using API to operation it is fine.
> > > and Using WM5 OS is OK. and when my device is clean boot still cannot
> > > generation a "DataReceived" event.
> > > I guess the event implement method is to create a thread to monitor RX
> > > buffer and to compare "ReceivedByteThreshold" condition. When I to use
> > > ReadExisting() can get Rx date, so I cannot accept the problem due to
> > > serial driver has bugs.
>
> > > BTW if your device just after suspend/resume has the issues. I guess
> > > serial drivers reconfiguration UART GPIO when Power_Down but Power_Up
> > > not to correct restore original setting.
>
> > > BTW again thank you reply the mail.
> > > Best regards,
> > > KunYi
>
> > > On 9 13 , 12 36 , "Dick Grier" <dick_grierNOSPAM@.msn.com> wrote:
>
> > > > Hi,
>
> > > > I have a WinCE 5 Industrial PPC (Psion) that exhibits this problem. Quite a
> > > > bit of testing makes me think that it is a driver/OS image issue, related to
> > > > power-down. If I do a hard reset, and reload all of my software (usually),
> > > > the DataReceived event in generated. However, often when the PPC is
> > > > subsequently powered down and then powered back up, data no longer is
> > > > receive (polling does not work, either). I "think" that the serial driver,
> > > > or something related, enters some (bug) state that causes this.
>
> > > > BTW, the earlier version, WinCE 4.2 did not show this problem. Although the
> > > > vendor has tried to help, nothing has been resolved, so far.
>
> > > > The same issue shows itself with my CFSerialIO dll (see my homepage) and
> > > > with the Serial class from OpenNETCF -- so, I think it is outside my
> > > > control.
>
> > > > BTW, it is possible that there is an issue with your code (as Chris
> > > > mentioned). For example, you should make sure that both DTREnable and
> > > > RTSEnable = True.
>
> > > > Dick
>
> > > > --
> > > > Richard Grier, MVP
> > > > Hard & Software
> > > > Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
> > > > Edition,
> > > > ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
> > > > 2006.
> > > > Seewww.hardandsoftware.netfordetailsandcontact information.



Re: What's SerialPort can not fire DataReceived event. by Dick

Dick
Thu Sep 13 08:59:55 PDT 2007

Hi,

If you poll (you can use a Timer, you don't need a thread), and test the
BytesToRead method, is there data available? If so, just read it there.
You actually do not need the DataReceived event if the Timer event (polling)
works.

BTW, you mention a USB adapter... I have absolutely no experience using USB
serial adapters on WinCE devices. I'd suspect a driver problem, but...

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.



Re: What's SerialPort can not fire DataReceived event. by Kun-Yi

Kun-Yi
Thu Sep 13 20:33:11 PDT 2007

Hi Dick,
Thank you, about BytesToRead is OK and can get RX data.
But my customer want use DataReceived Event.
using Native API is OK. I guess NetCFv2 on my platform has a bug about
DataReceiverd Event.
I porting WM5 all serial driver part to WinCE 5 for testing. it's
still failed.

On 9 13 , 11 59 , "Dick Grier" <dick_grierNOSPAM@.msn.com> wrote:
> Hi,
>
> If you poll (you can use a Timer, you don't need a thread), and test the
> BytesToRead method, is there data available? If so, just read it there.
> You actually do not need the DataReceived event if the Timer event (polling)
> works.
>
> BTW, you mention a USB adapter... I have absolutely no experience using USB
> serial adapters on WinCE devices. I'd suspect a driver problem, but...
>
> Dick
>
> --
> Richard Grier, MVP
> Hard & Software
> Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
> Edition,
> ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
> 2006.
> Seewww.hardandsoftware.netfor details and contact information.