We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › serial.list() super slow ... 10 seconds win XP
Page Index Toggle Pages: 1
serial.list() super slow ... 10 seconds win XP (Read 3715 times)
serial.list() super slow ... 10 seconds win XP
Mar 7th, 2007, 6:05pm
 
I'm new to processing but I'm excited about the possibilities.

I'm trying to open a com port to COM10, which is a virtual port to a bluetooth serial protocol device.  I can open that port with TeraTerm Pro and get data from my device, but processing can't seem to open it.

I'm seeing that Serial.list() takes about 10 seconds to return!  I get:
COM1 COM2 COM9 COM10 COM11

When I try to open the port to COM10 (Serial.list()[3]
 port = new Serial( this, Serial.list()[3]);
It never seems to open.

I saw on the technical ref pages that if you find that Serial.list() never returns it might be because the exec bit isn't set for the serial .dll.  Does that have anything to do with this?

I'm running WinXP Home, fully updated.  I've tried noodling with processor affinity and all that, but I can't seem to get it to work.

Ideas?  Help?!
Re: serial.list() super slow ... 10 seconds win XP
Reply #1 - Mar 9th, 2007, 5:36pm
 
that sounds like a serial driver problem between your bt driver and xp, unfortunately. or perhaps rxtx (the serial lib we use) doesn't like the driver. i would suspect that it might actually be working, but just taking forever to communicate (ala the list() problem).

the exec bit issues are rare on windows, it's more of a macosx/linux problem.

let us know what you find...
Re: serial.list() super slow ... 10 seconds win XP
Reply #2 - Mar 9th, 2007, 11:34pm
 
Fry,

Thanks for your thoughts on this.

I can tell you that a program as stupid as Hyperterminal is able to connect to this port without complaint.  It must present itself as a very generic COM, so I'm doubting that the problem is between bt driver & XP.  I'm wondering if rxtx is being too clever?  (no insult meant to rxtx here.  now the thing about hyperterminal-- I /meant that/.)

I can open this port with any bit rate (I think) because it doesn't matter.  It does seem like the bt driver is doing something very complicated, but that seems like it's all on the back end (it actually initiates an rf connection to my hardware and everything just seems to work ... which I find amazing given the complexity of bluetooth.)

I can also say that if I just play around with the graphics example code everything seems to work speedily.  The problem does seem to be centered around serial.*

Oh, yes, and I don't think it's just taking a very long time, because I've left it sitting for quite a while haven't seen anything come thru.  Also, my hardware lights up when a bt connection has been initiated and I'm never seeing that.
Re: serial.list() super slow ... 10 seconds win XP
Reply #3 - Jun 23rd, 2009, 1:02pm
 
hi, have you fixed the problem? i have the same under win xp. the list function is soooooooooo slow (27 seconds !!!!!!!!!!):

Code:
println(minute() + ":" + second());
println(Serial.list());
println(minute() + ":" + second());


58:18
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
[0] "COM1"
[1] "COM3"
[2] "COM4"
[3] "COM5"
[4] "COM6"
[5] "COM7"
[6] "COM8"
[7] "COM9"
[8] "COM10"
[9] "COM11"
[10] "COM12"
[11] "COM13"
[12] "COM14"
[13] "COM15"
[14] "COM16"
[15] "COM17"
[16] "COM18"
[17] "COM19"
[18] "COM20"
[19] "COM21"
[20] "COM22"
[21] "COM23"
[22] "COM24"
[23] "COM25"
[24] "COM26"
58:45
Re: serial.list() super slow ... 10 seconds win XP
Reply #4 - Jun 23rd, 2009, 1:37pm
 
I don't remember if I was ever able to fix this, but the general gist of it is that the operating system is super slow generating this list if you have Bluetooth Serial Port Profile devices installed on your system.  

I think what may be happening is that the OS calls down into the BT SPP driver asking for some parameter or other about it.  The BT driver thinks, "oh, somebody is asking about the serial device that's tied to this virtual COM port, I'll go out and see if I can contact the device."  When the BT driver is unable to make contact with the device (typical) you just end up waiting for a bunch of radio timeouts and retries.

So, a possible solution is to uninstall unnecessary BT COM ports and that should make the whole thing speed up.  If that's not an option then sorry!

Good luck!
Re: serial.list() super slow ... 10 seconds win XP
Reply #5 - Jun 23rd, 2009, 1:46pm
 
Oh yes, there's a program called RealTerm that's a freebie, open source download.  Just google it.

I think they have a handle on the nature of this problem, though not necessarily a fix.  As the program starts up it starts looking for COM ports.  RealTerm notices if this is taking a ridiculous amount of time and offers to stop.  There may be clues in their code about what to do about this.
Re: serial.list() super slow ... 10 seconds win XP
Reply #6 - Jun 30th, 2009, 9:35pm
 
hello,

I have been using Processing since tonight!

I get the same result with the serial.

The original code is

Code:
 serial = new Serial(this, Serial.list()[12], 9600, 'N', 8, 1.0); 



that takes 32 seconds

My USB Xbee explorer board is on COM30.

so I wrote
Code:
serial = new Serial(this, "COM30", 9600, 'N', 8, 1.0); 


or
Code:
serial = new Serial(this,"COM30", 9600); 



and that takes 16 seconds ( now it take 24 sec, I got a lot of stuff running on my computer Smiley )

I will read about mdfogarty comment on RealTerm. I hope to find a solution for this, I am interfacing with the arduino.

I was planning on making a .exe file but I get a blank screen for 24 seconds and more before I see all my interface. Do you think there is a way to write "loading" so people know that my program is doing something instead of thinking I am a bad programmer Tongue
Even if I draw a line before calling serial, it is a blank window.


Thanks!
Re: serial.list() super slow ... 10 seconds win XP
Reply #7 - Jun 30th, 2009, 9:59pm
 
Oh, I was just thinking about something.

If you are familiar with the Arduino environment, you probably know that when you click "tools" in the menu, it takes a real long time to load that menu. In that menu there is a list of the serial port... NOW I know why it takes time Smiley

Quote:
Why does do the Arduino software and the Tools menu take a long time to open (on Windows)?

If the Arduino software takes a long time to start up and appears to freeze when you try to open the Tools menu, there by a conflict with another device on your system. The Arduino software, on startup and when you open the Tools menu, tries to get a list of all the COM ports on your computer. It's possible that a COM port created by one of the devices on your computer slows down this process. Take a look in the Device Manager. Try disabling the devices that provide COM ports (e.g. Bluetooth devices).


from arduino.cc/en/Guide/Troubleshooting#toc12

so we are screwed!

So we should delete all the other COM's except our specific one (COM30 in my case). Then we call serial...
Page Index Toggle Pages: 1