08-03-2009 08:23 AM
I am using LabVIEW 8.6 and I am having an issue with setting a serial port to baud 125000 when using the VISA serial VI to control a USB to Serial port. This same port can be controled by a generic com port controller at 125000.
The error I am receiving is "Error -1073807330 occurred at Property Node (arg 2) in VISA Configure Serial Port". I have found NI hardware that will run at this baud so I have to believe that if I have 3rd party hardware that will run at that baud that I should be able to set it to that baud.
Hopefully someone has seen this issue and can help me with this.
Thanks.
08-03-2009 09:02 AM
More information:
When I stated a generic com port controller I am refering to a program that control the serial port. I am currently using CRT but anyone that allows you to set the desired baud rate will work. Hyper Terminal is an example of another program used to control serial ports but Hyper Terminal will not allow you to type in your desired baud rate, with it you can only use the bauds in the drop down box.
The serial port I am trying to control is a 3rd party USB to serial device. The current one I am using is by SerialGear - USB 2 Port Serial BD-9 RS-232 Adapter with Prolific Chipset. This device will run at baud 125000.
The issue is that when I run CRT with the SerialGear device I am able to communicate at baud 125000 but when I use NI with the SerialGear device I get an error when I try to communicate at baud 125000.
08-03-2009 10:15 AM
08-03-2009 10:55 AM
Not sure if this will help.
Years ago I was trying to get a special serial interface to run at a high rate under LV. It turns out I had to specify one of the "normal" baud rate setting and it in turn picked its rate from its own list.
So...
You may wat to try all of the setting that work and use an intrument (tot test with ) or if all else fails break-out a O'scope and measure how long it takes to transmit a repeating pattern to find out what rate it is actually running at.
Like I dsaid, I don't know if that experience help you.
Ben
08-03-2009 12:00 PM
wiltdavi wrote:The issue is that when I run CRT with the SerialGear device I am able to communicate at baud 125000 but when I use NI with the SerialGear device I get an error when I try to communicate at baud 125000.
On Windows, NI-VISA just passes the baud rate through to the serial driver, which will in turn decide if it is valid. That fact that your CRT application is working makes me think that it is not really passing the 125000 rate down the driver.
In order to confirm this, I would recommend that you download Microsoft Portmon. When running Portmon, you will be able to capture the low-level calls made to your serial driver, so that you can determine how your CRT software is sending the baud rate request to the driver. Below I have included a screen capture of Portmon's output when trying to set a baud rate of 125000 through LabVIEW 8.6.1, on a standard built-in serial port.
You can clearly see the IOCTL_SERIAL_SET_BAUD_RATE that is sent to the driver, along with the INVALID_PARAMETER result. What you need to do is to perform a capture while running your CRT software to see if it is successfully setting it to 125000, or if CRT is actually coercing the baud rate to a known value, such as 115200.
You will also notice in my capture that the baud rate is set to 115200 twice. This is due to the default settings being applied when the port is opened, and restoring the default settings after the error occurs. It is really just the one in the red box that should interest you.
If you post a capture of opening the port with 125000 baud in CRT, I would be happy to look at it for you if you post it here. Ideally this would be a short capture of nothing but opening and configuring the port, without any extra data transfers included.
-Jason S.
08-03-2009 12:53 PM
I have attached the traces from Portmon for both CRT and LabVIEW and neither of the traces show anything failing.
The LabVIEW trace was taken from running just the VISTA serial VI and even though nothing failed in the Portmon trace, the VI still displayed the error.
If you can see something from the Portmon traces that can explain this, please let me know.
Thanks again.
08-03-2009 01:34 PM - edited 08-03-2009 01:35 PM
That really surprises me, I had expected to see an error on the baud rate. Could you perform a capture using NI-Spy (Available in the Start Menu under National Instruments)? Start a capture with that, then run the LabVIEW VI, and then save and post the SPY capture. Please post the actual .spy file, so that we can open it up and view it using NI Spy. This should help us pinpoint which VISA call is failing.
-Jason S.
08-03-2009 01:46 PM
08-03-2009 08:52 PM
Ok, I think I know what the problem is. I believe that NI-VISA is reading back the baud rate after setting it, to make sure that the driver is reporting the correct baud rate. I think that your driver is probably returning a different value than you actually set. This is probably because the serial port doesn't hit the exact baud rate, just something close to it. I suspect the driver is probably returning the calculated actual baud rate, instead of caching the value that you set.
To test this, I threw together a little VI that will query the Windows API directly, to tell you what the driver is reporting as the baud rate. It will first query the baud rate, then set the new baud rate, then query the baud rate again. Hopefully it will be something close to 125k. If the "Failed to set baud rate" indicator illuminates, then the driver completely rejected your baud rate, although I don't think that will happen based on the Portmon captures you have already performed.
Go ahead and try this out, just fill in the correct COM port name and the desired baud rate, then post back what the "Baud Rate After Setting" is.
-Jason S.
08-04-2009 01:54 AM
Take a look here
http://digital.ni.com/public.nsf/allkb/BA0652D1E13DBBC58625649F006561C2 I think Jason is into something