Re: contolling com2 under compact framework
- From: selmaguzel <selmaguzel@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 4 Jul 2008 02:50:01 -0700
Hi again,
(I study on arm based qq2440 sbc and use cf2 c# under wince5)
I followed the steps below:
1-) I added the keys for com1,com2 and com3 the bsp's(smdk2440) platform.reg
file under platform builder as below:
IF BSP_NOSERIAL !
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SER2440]
"DeviceArrayIndex"=dword:0
"Irq"=dword:03
"IoBase"=dword:50000000
"IoLen"=dword:2C
"Prefix"="COM"
"Dll"="SER2440.Dll"
"Order"=dword:0
"Priority"=dword:0
"Port"="COM1:"
"DeviceType"=dword:0
"FriendlyName"="Serial Cable on COM1"
Tsp"="Unimodem.dll"
"DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00,
00,00, 08, 00, 00, 00,00,00,00
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\COM2] ;;add by lyc 2007/1/12
"DeviceArrayIndex"=dword:1 ;;can't use COM2
"Irq"=dword:16
"IoBase"=dword:50004000
"IoLen"=dword:2C
"Prefix"="COM"
"Dll"="SER2440.Dll"
"Order"=dword:0
"Priority"=dword:0
"Port"="COM2:" ;;use COM4 instead of COM2
"DeviceType"=dword:0 ; null modem
"FriendlyName"="S2440 COM2"
"Index"=dword:2
"DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00,
08, 00, 00, 00,00,00,00
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\COM3] ;;add by lyc 2007/1/12
"DeviceArrayIndex"=dword:2
"Irq"=dword:17
"IoBase"=dword:50008000
"IoLen"=dword:2C
"Prefix"="COM"
"Dll"="SER2440.Dll"
"Order"=dword:0
"Priority"=dword:0
"Port"="COM3:"
"DeviceType"=dword:0 ; null modem
"FriendlyName"="S2440 COM3"
"Index"=dword:3
"DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00,
08, 00, 00, 00,00,00,00
ENDIF BSP_NOSERIAL !
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SER2440\Unimodem]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:0
"FriendlyName"="SER2440 UNIMODEM"
"DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00,
00,00, 08, 00, 00, 00,00,00,00
2-) And in the c# program I used the code below:
For writing:
serialPort1.PortName = comboBox1.SelectedItem.ToString();
if (serialPort1.IsOpen) serialPort1.Close();
serialPort1.Open();
string sendmesaj = textBox1.Text;
serialPort1.WriteLine(sendmesaj);
For reading:
serialPort1.PortName = comboBox1.SelectedItem.ToString();
if (serialPort1.IsOpen) serialPort1.Close();
serialPort1.Open();
string i = serialPort1.ReadLine();
textBox2.Text = i;
3-) When i selected COM1, i got error as "COM1 does not exist" and
'System.IO.FileNotFoundException' at output.But i can see "COM1:" under
HKEY_LOCAL_MACHINE\Drivers\Active\05 .
But the default value is not set,is it important?If yes, what must the value
be?
4-) When i selected COM2, i didn't get any error as above.Anyhow i can see
"COM2:" under HKEY_LOCAL_MACHINE\Drivers\Active\06. But when i wanted to
write, i got error as below on the dnw program which is used for
communicating with the device:
SL_Open 0x36FC0 (0 opens)
Data Abort: Thread=8f8bd400 Proc=8e026160 'device.exe'
AKY=00002007 PC=02a525cc(ser2440.dll+0x000025cc)
RA=02a525c0(ser2440.dll+0x000025c0) BVA=06000010 FSR=00000007
SL_TxInt : Error : i = 600000
SL_TxInt : Error : i = 600000
SL_TxInt : Error : i = 600000
After this long story, how can i solve these problems?
Best regards.
P.S: "and haven't been change the other settings"
:) Really a stupid sentence as a result of sending quickly and without
controlling.I wanted to say that I haven't changed the other properties.
"Huh? " :) :)
"Paul G. Tobey [eMVP]" wrote:
"and haven't been change the other settings"? Huh? Did you Open() the.
serial port? A file not found exception would generally indicate that the
device/file name that you're trying to open does not exist. It's quite
possible for there to be no COM1:, but a COM2:, and no COM3:, but a COM4:.
You need to know how your hardware is configured so you know what port you
should be opening. We don't know anything about your hardware or your board
support package. We can't answer questions that are specific to it, as this
one is. You could use Remote Registry Editor to look at the keys under
HKEY_LOCAL_MACHINE\Drivers\Active to see what drivers are loaded and verify
that COM<whatever> is there. Make sure that you are passing a correct
serial port name, too. It should end with a colon ":". That is, "COM1:" is
valid; "COM1" is not.
Paul T.
"selmaguzel" <selmaguzel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C1D2FD88-34A4-4271-B7D1-456B7F21601A@xxxxxxxxxxxxxxxx
I set serialport1 to com1.And haven't been change the other settings.
"selmaguzel" wrote:
Hi,
When i have run this line below:
serialPort1.ReadLine();
I have gotten error as below:
A first chance exception of type 'System.IO.FileNotFoundException'
occurred
in mscorlib.dll
A first chance exception of type 'System.TimeoutException' occurred in
System.dll
What is the problem?
Thanks in advance.
"Paul G. Tobey [eMVP]" wrote:
Yes, your configuration of the drivers for your platform is wrong in
some
way, assuming that there actually are two serial ports present.
Perhaps one
of them is used for serial debug messages from the OS? Your BSP
documentation should say something about this...
Paul T.
"selmaguzel" <selmaguzel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8A61D378-B829-463B-BB68-2AC7E2C71A77@xxxxxxxxxxxxxxxx
Hi,
When i want to access com2 using serail port component under compact
framework 2, i get error as there is not a port as this.
I can use com1.
I suppose the problem is related with the serial driver in bsp(i use
smdk2440;bsp of qq2440 ).
Despite of investigating to find,i haven't found exact solutions.
But some informations from the sorce code of the serial bsp are
below:
"// Note on defaults. While the PC typcially considers COM1 to be at
// 3F8, irq4 and COM2 to be 2F8, irq3, NKPC uses COM1 internally for
the
// debugger. So, when NK tells me to start "COM1" it really means
the
// first one that's available, which is what the PC calls COM2.
Confused?
// The end result is that COM1 on NK is what the PC considers to be
COM2.
// But wait, there's more. On a Puzzle, the debugger is on COM2 and
the
// COM1 for NK is ACTUALLY COM1. So PCs need 2F8 for their port base
// and Puzzles need 3F8.
"
But it's really confused for me to understand.
How can i access com2 from compact framework 2 applicaiton using
serial
port
component?
Thanks.
- Follow-Ups:
- Re: contolling com2 under compact framework
- From: Paul G. Tobey [eMVP]
- Re: contolling com2 under compact framework
- References:
- Re: contolling com2 under compact framework
- From: selmaguzel
- Re: contolling com2 under compact framework
- From: selmaguzel
- Re: contolling com2 under compact framework
- From: Paul G. Tobey [eMVP]
- Re: contolling com2 under compact framework
- Prev by Date: Re: The installation of the image has halted after boot logo
- Next by Date: Re: VoIP support in Windows CE 6.0
- Previous by thread: Re: contolling com2 under compact framework
- Next by thread: Re: contolling com2 under compact framework
- Index(es):
Relevant Pages
|