LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetInQLen() returns greater than Queue size!

GetInQLen() returns greater than Queue size.  I'm using CVI 5.5 for this project, but OpenComConfig (com_port, NULL, 115200, 0, 8, 1, 512, 512); is successful and data appears to flow, but eventually GetInQLen() returns a value greater than 512 which causes the debugger to break as my intermediate buffer is sized as 512.

Com port is Bluetooth device emulating a serial port opened as COM4.   Not clear what is going on here but it greatly complicates things.  I was expecting an error from GetQlen if I was too slow reading the port and the queue overflowed, or at the very least silent discarding of data once the queue is filled and a return from GetInQLen() equal to the queue size.

Ideas?  Bluetooth driver/stack issue?

--wally.


0 Kudos
Message 1 of 5
(3,401 Views)
CVI help for the inputQueueSize parameter on the OpenComConfig() function says that on Windows, the minimum queue size is 4096. Might help your debugger if you matched your source code definitions to this figure.
 
JR
0 Kudos
Message 2 of 5
(3,398 Views)
As JR stated, Windows enforces a minimum that is larger than 512.  Essentially, when you pass a queue length to OpenComConfig, you are requesting a minimum length, not an exact length.

Mert A.
National Instruments
0 Kudos
Message 3 of 5
(3,372 Views)
I should have mentioned that before I posted this message I made the input queue size and my buffer to 16K, which only postponed the day of reckoning.

So what you are saying is the com input buffer is really set by the port driver and the values "set" in OpenComConfig are mearly suggetions or wishfull thinking, and having GetInQLen() return a number bigger than the input queue I requested is "normal" for some drivers?  I should be able to deal with it now that I know, but my concern is will the com port routines report errors if the buffer overruns because my reading process is too slow?

--wally.



0 Kudos
Message 4 of 5
(3,332 Views)
You must call the GetComStat function to determine what error, if any, has occurred. If there has been an input buffer overrun, the return value of that function bitwise-anded with kRS_OverrunError will be nonzero.  You can also use InstallComCallback to register a callback for the LWRS_ERR event, which will then fire whenever an error with the communication occurs.

Mert A.
National Instruments
0 Kudos
Message 5 of 5
(3,327 Views)