[Lazarus] SdpoSerial port open problems

Bo Berglund bo.berglund at gmail.com
Thu Feb 10 00:12:56 CET 2011


On Wed, 09 Feb 2011 22:26:51 +0000, Paulo Costa <paco at fe.up.pt> wrote:

>On 09/02/2011 22:10, Bo Berglund wrote:
>> I have used SdpoSerial as the RS232 handler in a class which is used
>> in a test application.
>> In this I create the SdpoSerial component in code in the constructor
>> of my class like this:
>>  ...
>> I keep track of various communication states in the FCommState
>> variable (it is indicating the state in a state machine).
>>
>> The problem I have is that even though I open a non-existing port the
>> SdpoSerial does not indicate this. Following the Open method Active is
>> true even though a completely bogus port number has been given!
>>
>> Why is this and how can I fix it?
>> I need to know if the port is actually working or not....
>>
>
>Hi,
>
>
>Two things:
>
>a) if possible post a compilable (even better runnable) example. There 
>are some detail missing that could hold the reason for your trouble.

The application is quite extensive now because it holds the complete
syntax of the data acquisition equipment I woark towards. So it is not
really realistic to post it all....
But it does work, it is just that the user gets no indication whatever
if he selects a port that either does not exist or is already used by
another application.
In all of my RS232 experience in Delphi (been at it since 1996) it was
always the case that the serial component barfed if one tried to open
a non-existing or already open port. I have used several different
ones and they all had a property similar to Active or Open, which
showed the actual state even if they did not throw an exception on
opening an erroneous port.
Not so with SdpoSerial (or I have yet to find it).
 
>What leads me to...
>
>b) have you redefined "Active" in your class and it is hiding the 
>TSdpoSerial active property?
>
No, as I showed I only create the FComm object as a TSdpoSerial
instance, then set its properties including Active.

I have tested the program now in the original development PC (a VMWare
virtual XP-Pro machine) and my Win7X64 laptop and as long as I use a
physical com port all seems to work OK. In the virtual machine it
means mapping the laptop docking station COM1 into the VM. THen it
works just fine.

But when I involve a USB connected serial port (which I have to do if
I undock my laptop) I get all kinds of strange errors, basically no
communications at all! I have two different ones but both are
problematic (ATEN RS232USB and SUNIX 4-port ComHub).

Do you know of any problems related to SynaSer via USB connected RS232
adapters on Windows7 or WindowsXP?

Right now I am moving the Lazarus application around to different
computers (real and virtual) and different COM ports (real or USB
connected) to try to figure out why it is so hard making it always
work. And this is when I found that I tried ports that were already
reserved for the virtual machine or actually unplugged without
SdpoSerial saying anything about it....



-- 
Bo Berglund
Developer in Sweden





More information about the Lazarus mailing list