[Lazarus] SdpoSerial port open problems
Bo Berglund
bo.berglund at gmail.com
Thu Feb 10 22:55:48 CET 2011
On Thu, 10 Feb 2011 19:54:13 +1000, SteveG <steveg at nevets.com.au>
wrote:
>>
>> 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....
>>
>
>Dont know if its any help at all, but I am also having serial port
>problems using USB adaptors.
>
>I am developing under Ubuntu using synaser and have found that I can
>only connect to the port about once every 5 or so trys.
>
>Cant say if it is directly related SynaSer/ USB adaptor though, as I
>dont have an onboard one to test against.
>
>side notes -
>if I use 'serial port terminal' it connects every time.
>if I use 'cat /dev/ttyUSB0 > /tmp/test.txt' it tends to not connect more
>than it connects (similar to synaser)
>
>Suggests it may be necessary to 'reset' the port somehow before using
>I have a small sample program for testing if anybody wants it
>
It is very strange how Windows handles the com ports...
Somehow there seems to be some hidden deeper issues that makes some
components not work in some situations. Examples:
We used a 3rd party serial component in Delphi for many years without
real problems (WinNT4, Win95, Win2000 and now XP).
But then we encountered a case where the component simply would not
trigger any reception events. This happened on a Panasonic wireless
gadget that was an extension of a WinXP PC with a touch screen and a
few extras like a serial port. We used the serial port for an RFID
reader and it simply would not read. If I added a timer and let it
poll the component for data then I could make it work for this simple
case, but that was a real kludge..
So then I modified the program to use AsyncPro instead and it started
working. Don't know why the difference.
Later, around 2008, I had another problem with an automation program
communicating with a machine tool via RS232. At that time I *was*
using AsyncPro, and it worked just fine on my laptop when connected to
the machine. But the same software running on the customer's PC:s
refused to communicate. These PC:s had *real* com ports and were
running XP. So as a test I switched this program over to using the old
serial component we used before, and amazingly then it worked just
fine!
Now I have problems with USB attached serial ports and lazarus
programs using SdpoSerial as described in this thread. In this case
the comm works fine as long as I use the *real* com port in my docking
station. But won't work if I use one of the 4 com ports in my newly
bought SUNIX ComHub UTS2009P4 or for that matter if I use a USB single
channel com port adapter from ATEN. But the latter can be used if it
is not transferred to the virtual machine where I develop the
software.
Really very confusing, and I was not planning on doing research into
this. I was programming a comm application for data collection....
Do you think there is any chance of using my old serial component
(housed in a single pas file) with lazarus?
It is a Delphi component and I don't know what you need to do in order
to use it with lazarus. I realize that it would not work as a
cross-platform unit but could be interesting for testing.
In the end of course what I need to do is to get it working on the
embedded ARM system with Linux.
--
Bo Berglund
Developer in Sweden
More information about the Lazarus
mailing list