Re: OpenNETCF Serial not working in my WinCE 5.0 device



Hyperterminal isn't a very good test. It's *extremely* tolerant of
incorrect settings. I can't think of anything, other than your code just
being wrong, that would explain the error, except for a real mismatch of
parity or character size. I can tell you what I'd do, write the code in C
and verify whether it happens or not there. That would remove any potential
bugs in the OpenNETCF code (you might verify from the vault that you have
the latest source). If it does happen, I believe that it's a real mismatch
in the settings...

Paul T.

"Bryan Gan" <BryanGan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:472DA186-2954-4A1F-B918-55E9A411D14B@xxxxxxxxxxxxxxxx
> Hi,
> can I know how can I get the port settings at the point before sending out
> the data as the port is an IntPtr type? I checked the settings I sent out
> when I open the device:
>
> bool bReturn = CommAPI.SetupComm(hPort, rxBufferSize, txBufferSize);
>
> // transfer the port settings to a DCB structure
> dcb.BaudRate = (uint)portSettings.BasicSettings.BaudRate;
> dcb.ByteSize = portSettings.BasicSettings.ByteSize;
> dcb.EofChar = (sbyte)portSettings.EOFChar;
> dcb.ErrorChar = (sbyte)portSettings.ErrorChar;
> dcb.EvtChar = (sbyte)portSettings.EVTChar;
> dcb.fAbortOnError = portSettings.AbortOnError;
> dcb.fBinary = true;
> dcb.fDsrSensitivity = portSettings.DSRSensitive;
> dcb.fDtrControl = (DCB.DtrControlFlags)portSettings.DTRControl;
> dcb.fErrorChar = portSettings.ReplaceErrorChar;
> dcb.fInX = portSettings.InX;
> dcb.fNull = portSettings.DiscardNulls;
> dcb.fOutX = portSettings.OutX;
> dcb.fOutxCtsFlow = portSettings.OutCTS;
> dcb.fOutxDsrFlow = portSettings.OutDSR;
> dcb.fParity = (portSettings.BasicSettings.Parity == Parity.none) ? false
> : true;
> dcb.fRtsControl = (DCB.RtsControlFlags)portSettings.RTSControl;
> dcb.fTXContinueOnXoff = portSettings.TxContinueOnXOff;
> dcb.Parity = (byte)portSettings.BasicSettings.Parity;
> dcb.StopBits = (byte)portSettings.BasicSettings.StopBits;
> dcb.XoffChar = (sbyte)portSettings.XoffChar;
> dcb.XonChar = (sbyte)portSettings.XonChar;
>
> dcb.XonLim = dcb.XoffLim = (ushort)(rxBufferSize / 10);
>
> CommAPI.SetCommState(hPort, dcb);
>
> and I am sure the settings is correct because when I tested on
> HyperTerminal
> using the same setting, it works.
> Any idea?
>
> "Paul G. Tobey [eMVP]" wrote:
>
>> A framing error indicates that the parity or the byte size is wrong,
>> generally. You might set a breakpoint at the point where you're about to
>> send the data and check the current settings for the port you're sending
>> it
>> on and make sure they match the external device. It sounds to me like
>> you've set the parameters, or one of them, to the wrong instance of the
>> RS232 class or something like that (copy/paste error, maybe).
>>
>> Paul T.
>>
>> "Bryan Gan" <BryanGan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:AC99B87C-B8B4-420A-9790-9647B93CA580@xxxxxxxxxxxxxxxx
>> > Hi all,I am running the OpenNETCF.Serial.IO library under WinCE 5.0
>> > device. I
>> > am able to connect to my embedded modem (COM4) successfully via
>> > Hyperterminal
>> > and successfully issue AT command in hyperterminal.
>> > However, when I try to run on the sample app built by me , which is
>> > using
>> > the mentioned library, whenever I try to issue an AT command, I will
>> > receive
>> > Framing error. Anybody can help me solve this?
>> > Here is the port settings:
>> >
>> > Port Name: COM4:
>> > BaudRate: 115200
>> > Byte Size: 8
>> > Parity: None
>> > StopBits: One
>> >
>> > The application works fine in another WinCE device(WinCE 4.2) which
>> > have
>> > the
>> > following configuration:
>> >
>> > Port Name: COM3:
>> > BaudRate: 9600
>> > Byte Size: 8
>> > Parity: None
>> > StopBits: One
>> >
>> > I also downloaded the sample app from
>> > http://msdn.microsoft.com/mobility/default.aspx?pull=/library/en-us/dnnetcomp/html/PISAPICF.asp
>> > and try to run it on Win5.0 device, also fail (but pass on WinCE 4.2
>> > device).Any Clue?
>>
>>
>>


.



Relevant Pages

  • Re: OpenNETCF Serial not working in my WinCE 5.0 device
    ... can I know how can I get the port settings at the point before sending out ... I checked the settings I sent out ... > A framing error indicates that the parity or the byte size is wrong, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Connecting to VNC or PCAnywhere host via Verizon DSL line
    ... router at home so how exactly could I change my packet forwarding ... >> home has Verizon DSL service with both VNC and PCAnywhere hosts. ... >> told that changing the port settings would work but I haven't figured ... >> out how to change the port settings on my host computer. ...
    (microsoft.public.win2000.networking)
  • Re: Changing default com1 setting in command prompt.
    ... COM port settings used in a command prompt window. ...
    (microsoft.public.windows.mediacenter)
  • Re: Change Ports for E-mail
    ... e-mail settings. ... The instructions indicate that the POP and SMPT server ... I think I could manage to find the port settings on my own OS X ...
    (comp.sys.mac.system)