Re: Emulator serial communication problem
- From: "Voidcoder" <voidcoder@xxxxxxxxx>
- Date: Mon, 6 Mar 2006 12:51:21 +0100
I think I know where is your problem. Emulator uses
COM1 as a debug output port. So if you just map
Serial Port 1 to COM1, and then connect your COM1
physicaly (using the null-modem cable) with the COM2,
you should be able to see the debug output at COM2.
Emulator configures port as 38400/8/N/1.
Btw if want to enable Virtual Serial Port then goto the
Start Menu -> Eltima -> VSPD and add Virtual Serial
Port Pair. For example add COM4<->COM5
pair. Then in the emulator settings map Serial Port 1 to
COM4. Next connect your terminal to COM5 and
setup 38400/8/N/1. Next time you run the emulator
you will see debug output comming to the virtual
port COM5. Something like:
------------------------------------------------------------------------
Debug Serial Init
SysInit: GDTBase=8088e0e0 IDTBase=808af7e0 KData=808b5800
Windows CE Kernel for i486 Built on Jun 24 2004 at 18:23:42
g_pPageDir = 808b6000
X86Init done, OEMAddressTable = 80243b18.
Checking if extended keep alive timeouts feature is set...Yes
.....
.....
.....
"Semion" <semionb@xxxxxxxxx> wrote in message news:Oy0dCnQQGHA.5092@xxxxxxxxxxxxxxxxxxxxxxx
I downloaded the application, installed it and created new pair of
virtual COM-ports. It does not help because these ports are not
in platform manager configuration options. I restarted my computer
atfer installation, it didn't help...
"Voidcoder" <voidcoder@xxxxxxxxx> wrote in message news:Op7to9PQGHA.2668@xxxxxxxxxxxxxxxxxxxxxxx
Hm, strange. Can you try the same with the virtual serial
port. For example you can use this one:
http://www.eltima.com/download/virtual-serial-port-lite/
Do you have any experience with the tools like BusHound?
I would advice to use something like this and check whether
the emulator really tries to transfer data to the serial port.
"Semion" <semionb@xxxxxxxxx> wrote in message news:%23qu6pmPQGHA.4964@xxxxxxxxxxxxxxxxxxxxxxx
No, the function "WriteFile" returns TRUE, but on another port application don't recieve anything
"Voidcoder" <voidcoder@xxxxxxxxx> wrote in message news:%23poQUOPQGHA.2828@xxxxxxxxxxxxxxxxxxxxxxx
Well, are you able to send data from emulator?
"Semion" <semionb@xxxxxxxxx> wrote in message news:%23P0HZMGQGHA.3256@xxxxxxxxxxxxxxxxxxxxxxx
Thank you fo reply. There is only one COM-port in the "HKLM\Drivers\Active" key:
It's values are:
Hnd = 198160 ( I think it's the handle number )
Name = COM1:
Key = Drivers\BuiltIn\Serial
Interface Type = 4294967295
"voidcoder" <voidcoder@xxxxxxxxx> wrote in message news:ORPcHrDQGHA.5400@xxxxxxxxxxxxxxxxxxxxxxx
What I mean with the rest of the fields is that
you relay on the default DCB settings. Those
settings may differ from device to device...
Well, this seems to be not the case.
Use Remote Registry Editor and check
HKLM\Drivers\Active key. How much
COMx devices do you have there?
"Semion" <semionb@xxxxxxxxx> wrote in message news:upYEOGDQGHA.3872@xxxxxxxxxxxxxxxxxxxxxxx
Thank you for reply.
I tried various values:
dcb.fOutxCtsFlow = FALSE;
dcb.fTXContinueOnXoff = FALSE;
dcb.fDtrControl = DTR_CONTROL_DISABLE; // DTR_CONTROL_ENABLE
dcb.fRtsControl = RTS_CONTROL_DISABLE; // RTS_CONTROL_ENABLE
and all with the same result: application on emulator does not recieves anything.
But on WinCE real device everithing works OK even if I fill only above-mentioned
fields:
dcb.BaudRate = CBR_4800;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
If I try to open on emulator other ports ( COM2 - COM9 ), the function CreateFile failes.
"voidcoder" <voidcoder@xxxxxxxxx> wrote in message news:utYb$qkPGHA.2080@xxxxxxxxxxxxxxxxxxxxxxx
Well, are you sure handshaking is turned off? I can see you only
set BaudRate, ByteSize, Parity and StopBits fields leaving the rest
as is. Have a look through other fields as well.
"Semion" <semionb@xxxxxxxxx> wrote in message news:%23LK23dgPGHA.420@xxxxxxxxxxxxxxxxxxxxxxx
Hello everybody
I want my application to run on emulator and get some data from COM (serial) port.
I have 3 Com-ports on my PC ( COM1, COM3, COM4 ).
I connected COM1 and COM3 with proper cable.
I use Embedded VC++ 4.0 and STANDARDSDK_420 emulator.
To configure COM port on the emulator I open dialog from the menu:
Tools->Configure Platform Manager->STANDARDSDK_420->STANDARDSDK_420 Emulator->Properties->
Startup Server->Configure->Serial port1 = COM1.
Other application sends data from port COM3.
I run the same thread on PC application and on WinCE emulator application.
On PC application everithing is OK - the thread recieves data without any problem.
But on emulator in spite of that the "ReadFile" function returns TRUE, it does not read anything:
amount of read bytes always=0, and recieving buffer is not changed.
Here is the code of my thread:
DWORD WINAPI RecieveComThread ( LPVOID pParam )
{
HANDLE hPort = CreateFile ( _T("COM1:"), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL );
if ( hPort == INVALID_HANDLE_VALUE ) {
return 0;
}
DCB dcb;
if (!GetCommState( hPort, &dcb)){
CloseHandle( hPort);
hPort = INVALID_HANDLE_VALUE;
return 0;
}
dcb.BaudRate = CBR_4800;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
if (!SetCommState( hPort, &dcb)) {
CloseHandle( hPort);
hPort = INVALID_HANDLE_VALUE;
return 0;
}
COMMTIMEOUTS CommTimeouts;
GetCommTimeouts (hPort, &CommTimeouts);
CommTimeouts.ReadIntervalTimeout = MAXDWORD;
CommTimeouts.ReadTotalTimeoutMultiplier = 0;
CommTimeouts.ReadTotalTimeoutConstant = 0;
CommTimeouts.WriteTotalTimeoutMultiplier = 10;
CommTimeouts.WriteTotalTimeoutConstant = 1000;
if (!SetCommTimeouts (hPort, &CommTimeouts))
{
CloseHandle( hPort);
hPort = INVALID_HANDLE_VALUE;
return 0;
}
EscapeCommFunction (hPort, SETDTR);
EscapeCommFunction (hPort, SETRTS);
if (!PurgeComm( hPort, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR)) {
CloseHandle( hPort);
hPort = INVALID_HANDLE_VALUE;
return 0;
}
BYTE bBuff;
DWORD dwRead;
while (1) {
dwRead = bBuff = 0;
if ( !ReadFile ( hPort, &bBuff, 1, &dwRead, NULL ) ) {
Sleep(100);
continue;
}
if ( dwRead == 0 ) {
Sleep(100);
continue;
}
}
return 0;
}
The questions are:
Why I can't establish connection from PC to emulator applications?
What I have to do to make them communicate?
Thank you in advance.
.
- Follow-Ups:
- Re: Emulator serial communication problem
- From: Semion
- Re: Emulator serial communication problem
- References:
- Emulator serial communication problem
- From: Semion
- Re: Emulator serial communication problem
- From: voidcoder
- Re: Emulator serial communication problem
- From: Semion
- Re: Emulator serial communication problem
- From: voidcoder
- Re: Emulator serial communication problem
- From: Semion
- Re: Emulator serial communication problem
- From: Voidcoder
- Re: Emulator serial communication problem
- From: Semion
- Re: Emulator serial communication problem
- From: Voidcoder
- Re: Emulator serial communication problem
- From: Semion
- Emulator serial communication problem
- Prev by Date: Re: Emulator serial communication problem
- Next by Date: Re: Emulator serial communication problem
- Previous by thread: Re: Emulator serial communication problem
- Next by thread: Re: Emulator serial communication problem
- Index(es):
Relevant Pages
|