pauldude
Posts: 2
Joined: Thu Aug 28, 2008 12:04 pm

Serial port freezes when opening

Thu Aug 28, 2008 12:08 pm

I have a GPS app in vb.net 2005 and I am trying to "guess" the gps port by Setting Enabled = true and then reading 10 lines and looking for a $ in the output.

On my HTC P3600 the GPS Port is actually 9, but when it gets to trying com 3 it locks up and requires a reboot. Through debugging I can clearly see that it locks up on opening the port.

When I try the noEvents sample app I get the same thing - port 3 is in the list and if I try and open it the phone freezes.

I could let the user choose but I think it is nicer to do it automatically.

I didn't get this problem when I used the native SerialPort component.

Thanks for your help

User avatar
johan
GpsGate
Posts: 14372
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Serial port freezes when opening

Thu Aug 28, 2008 12:11 pm

The source code for SerialTools is available here:
http://franson.com/serialtools/purchase.asp?license=source&platform=net

Regards,
Johan

Franson Support

pauldude
Posts: 2
Joined: Thu Aug 28, 2008 12:04 pm

RE: Serial port freezes when opening

Thu Aug 28, 2008 12:18 pm

Indeed - and I will be buying but I`d like to fix this first and also be sure that it won`t happen with a distribution.

tomeck
Posts: 1
Joined: Fri Apr 24, 2009 11:58 pm
Location: Poland

RE: Serial port freezes when opening

Sat Apr 25, 2009 12:41 am

Hi,

I have some similar problem with similar devices. I am trying to use first unused serial port by creating SerialNet.Port. The code:

byte[] portList = SerialNET.Port.List;


foreach(byte port in portList)
{
try
{
serialPort = new SerialNET.Port();
serialPort.ComPort = port;
serialPort.BaudRate = 9600;
serialPort.Enabled = true; ####
break;
}
catch (Exception ex)
{
serialPort.Enabled = false;
serialPort.Dispose();
serialPort = null;
}
}

which results in assigning a port to serialPort variable if it is possible

When the code is ran, it assigns a port only if first from a list is avaliable. If first one fails, then in subsequent step of the forach loop the code would freeze on (####). Devices need restarting. Why the code hangs?

* Htc or eten x500 (both devices do hang) - with CF 3.5
* MS Visual Studio Professional 2008
* Recent version of SerialTools

--
Tomek Jurkiewicz

Return to “SerialTools”