LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PDA bluetooth disconnect takes a long time

Hi there.  These are the specs I'm working with.

- Labview 8.0
- Labview PDA Pocket PC version 8.0
- IPAQ hx 2490 running Windows Mobiole 5.0
- Proprietary Bluetooth Radio on Custom Instrumentation.

This is the problem I am having.   Connecting and communicating via bluetooth seems to work fine.  When I attempt to disconnect, sometimes, and this seems pretty random, it takes almost a minute before it will disconnect.  I have tried to place code in the Micro on the instrumentation to reset the Bluetooth radio on that side before a disconnect and this seemed to make the problem occur a little less.  Has anyone else run into this problem and if so were you able to get it to operate properly?  If so, how?  Thanks in advance.

Greycat
0 Kudos
Message 1 of 8
(3,645 Views)
I think I have solved the problem ... or at least reduced it.  For anyone who might have this problem in the future.  I was using a read BT function in the standard mode.  I wanted to empty the buffer of the micro I was talking to so I could send it a BT radio reset command (this particular micro uses the same register for TRasmit and Recieve buffers).  So therefore I read all the available bytes that the buffer could possibly hold.  When using the Standard Bluetooth Read vi, if the number of bytes returned does not meet the number requested, it returns whatever bytes it got and also returns an error.  I think is what was causing my problem.  It would return an error more times then not therefore the BT close vi would not execute.  I simply severed the error cluster from the BT read vi and the BT close connection vi.  All seems good now.  One could, if they wanted to capture errors properly, sent a error message at both the Bt Read function and after the BT close connection vi.  I have not looked in to the possibility using a different mode on the BT read vi.  This could also solve the problem, or one could simply skip the BT read vi with the error cluster and go straight to the BT close connection with it because you usually don't care if you get all the bytes when emptying a buffer.  Probably too much information but hope this might help someone in the future.

Greycat
0 Kudos
Message 2 of 8
(3,632 Views)
Just to readdress this situation. 

I thought I had this problem licked but apparently not.  It is pretty simple but I haven't found a way to effectively reproduce this problem.  My handheld is in the field right now but when it gets back I will do some more testing and tell you what I find out.  The problem still remains that, sometimes, it takes Labview on the PDA a very long time to disconnect (about 1 minute) ... instead of the usual < 5 sec.  This is very annoying as I cannot figure out what could be causing it.  Has anyone had any experience with this problem?  Please let me know if youhave..  Thanks

Greycat
0 Kudos
Message 3 of 8
(3,619 Views)
Greycat,
My development is over four months behind what you must be doing now.  I'm encountering a problem similar to this except it isn't with a PDA module.  I'm using a PC to communicate with a Bluetooth eval board but at a higher baud rate (921.6kbps).  Sometimes the application will close the BT connection fine but every 4 or 5 tries it takes about a minute to disconnect. I remember conducting my experiments at a slower baud rate (115.2kbps) but don't recall seeing this problem.  Have you been able to resolve this issue since the time you first encountered it?
0 Kudos
Message 4 of 8
(3,544 Views)
tuned99:

I haven't seen this problem in a little while ... but I can't remember how I fixed it  ... can you post an example VI and I'll compare it to what I have and see if that will jog my memory

Then if we do figure it out ... we'll have to make sure we post here so we can't forget Smiley Tongue

Greycat

Message Edited by Greycat on 07-27-2006 12:48 PM

0 Kudos
Message 5 of 8
(3,542 Views)
Greycat, My physical test setup is rather circular.  From my PC, I'm using hyperterminal to send data over a serial port to a Bluetooth eval board.  On the same PC, I have a Bluetooth USB adapter which receives the BT transmission and captures any data sent as shown by the LabVIEW code attached.  Everything works very well until time comes to close the connection itself.  4 times out of 5 it will work fine but the 5th time, the close connection does something to hang things up on the hyperterminal side of things.  The mode I'm using is "Immediate."  Bytes to read is 1024 and my timeout is 20ms.  Hope this jogs your memory!

Message Edited by tuned99 on 07-27-2006 01:29 PM

0 Kudos
Message 6 of 8
(3,542 Views)
To answer my own question, it appears that adding a few second delay between the last BT read and the BT Close Connection stablizes the software a bit.  For me, I decided to use 4 seconds.  Time delays of 1 and 2 seconds still resulted in an occasional hiccup.
0 Kudos
Message 7 of 8
(3,526 Views)
I seem to recall that using an event structure in my program was what fixed my problem ... so this may work too.  Probably in the same way ... by delaying things ...

Greycat
0 Kudos
Message 8 of 8
(3,510 Views)