Re: Emulator serial communication problem
- From: "Voidcoder" <voidcoder@xxxxxxxxx>
- Date: Tue, 7 Mar 2006 09:32:59 +0100
I'm not sure the re-install will help you much. The problem is
that Emulator Settings Dialog uses the hardcoded ports
COM1 through COM4. So you can't use virtual serial ports
there as your PC has real serial ports in the COM1-4 range.
Normally the emulator images can be found here:
Standard_SSDK_Install_Dir\Emulation\nk.cem
The emulator itself can be found here:
Program Files\Common Files\Microsoft Shared\Windows CE Tools\Platman\bin\Emulator_500.exe
Here you can find the information how to run it from the command line:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcedebug5/html/wce50conemulatorcommandlinelaunchoptions.asp
"Semion" <semionb@xxxxxxxxx> wrote in message news:%23GCfc8aQGHA.2704@xxxxxxxxxxxxxxxxxxxxxxx
Thank you for help.
But in BIOS I see only COM1.
COM3 and COM4 - it's separate adapter with 2 COM-ports.
I tried to disable them and to work with virtual ports only - it
does not help. I think I have to reinstall embedded software:
SDK and emulators.
I tried also to start emulator from command-line, but failed
because didn't find image-file.
May be you know where can it be? I use EVC-4 with Standard SDK
4.2 and 5.0.
"Voidcoder" <voidcoder@xxxxxxxxx> wrote in message news:%23DfZwfTQGHA.3016@xxxxxxxxxxxxxxxxxxxxxxx
You can run the emulator from the command line, this
will give the ability to specify whatever port number
you want.
I specially told you to disable COM4-5 in BIOS as
Emulator Settings dialog seems to use hardcoded ports
there: COM1,2,3,4. In my case I can always see
COM1,2,3,4 in the combo box even on my laptop
which doesn't have any serial ports at all.
"Semion" <semionb@xxxxxxxxx> wrote in message news:ee2iraTQGHA.3016@xxxxxxxxxxxxxxxxxxxxxxx
Thank you, but on emulator settings dialog I don't see the
virtual ports that I created. in spite of, that I see them for example
in HiperTerminal. I don't know why, may be emulator on my computer installed
not rigth, or may be antivirus prevents... I have Symantec corporated.
But the facts are: programs from VC++ 6.0 can communicate through
2 COM-ports on the same computer, and emulator - no.
"Voidcoder" <voidcoder@xxxxxxxxx> wrote in message news:uU9qiuSQGHA.2436@xxxxxxxxxxxxxxxxxxxxxxx
Hm, then it seems to be not connected with your hardware
at all. Well, lets try step-by-step:
1. Boot into BIOS and disable COM4 (and COM5
if you have it).
2. Open Virtual Serial Port control app and
add a virtual port pair COM4<->COM5.
4. Open emulator's settings dialog and map:
"Serial Port 1" to None.
"Serial Port 2" to COM4.
6. Open you terminal app and attach to COM5/38400/8/N/1.
7. In eVC start a new "WCE Application" project, choose
"A simple Windows CE Application" as template.
8. Add the following code to your WinMain function:
---------------------------------------------------------------------------
HANDLE hDev;
DCB dcb;
DWORD dwWritten;
hDev = CreateFile(TEXT("COM1:"), GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (hDev != INVALID_HANDLE_VALUE)
{
ZeroMemory(&dcb, sizeof(dcb));
dcb.DCBlength = sizeof(dcb);
dcb.BaudRate = CBR_38400;
dcb.Parity = NOPARITY;
dcb.ByteSize = 8;
dcb.StopBits = ONESTOPBIT;
SetCommState(hDev, &dcb);
WriteFile(hDev, "Hello World !!!\r\n", 17, &dwWritten, NULL);
CloseHandle(hDev);
}
---------------------------------------------------------------------------
9. Execute the app.
10. Check the terminal window, it must be "Hello World !!!"
line there.
"Semion" <semionb@xxxxxxxxx> wrote in message news:ucn6DdSQGHA.5116@xxxxxxxxxxxxxxxxxxxxxxx
I tested it on virtual ports too and it does not work.
"Voidcoder" <voidcoder@xxxxxxxxx> wrote in message news:uyqG4KSQGHA.5296@xxxxxxxxxxxxxxxxxxxxxxx
That is why I told you to test with the virtual serial
port first. It works nice so you can communicate
between the application running in emulator and
application running on the same PC without the
actual hardware.
"Semion" <semionb@xxxxxxxxx> wrote in message news:%23iero9RQGHA.1688@xxxxxxxxxxxxxxxxxxxxxxx
I glad for you, I think my problem in my hardware.
Thank you for all.
"Voidcoder" <voidcoder@xxxxxxxxx> wrote in message news:erx9fbRQGHA.5152@xxxxxxxxxxxxxxxxxxxxxxx
Well, I have just tested myself to be sure. I can definitely
communicate from the emulator to either real or virtual
serial port (tested with emulator 5.3.0.26).
Keep in mind the following:
1. Serial Port 1 mapping will map the serial port
to the emulator's debug port.
2. Serial Port 2 mapping will map the serial port
to the emulator's "COM1:" port.
"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
- 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: TCP/IP
- Next by Date: Re: TCP/IP
- Previous by thread: Re: Emulator serial communication problem
- Next by thread: Re: Emulator serial communication problem
- Index(es):
Relevant Pages
|