From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication at different baud rates

Hello, Using the VISA vis, I have been operating a serial instrument (a Polaris camera) over a USB connection using an FTDI serial-to-USB converter chip. Recently, I removed the converter in order to connect the serial port on the instrument directly to an RS-232 port. The system works at 9600, 14,400, 19,200, and 38,400 bps, but I am unable to communicate at baud rates of 57,600 and 115,200 bps. This is strange, because in the previous (USB) configuration (using the same code), I was able to communicate at 115.2 kbps. The main reason for switching from USB to RS-232 serial was so that I could connect the instrument directly to the PXI controller / RT OS. I'm using the RS-232 connector on the PXI chassis. Previously, the instrument was connected to a PC that was running Windows (and then sending data to the PXI system over an ethernet connection - not ideal). It is also worth noting that I'm using the NI-supported NDI Polaris driver for this application. Can someone please point me in the right direction? These higher baud rates that are typically supported on RS-232 connections, so why can't I use them? Thanks, Kate
0 Kudos
Message 1 of 8
(8,764 Views)

Which PXI controller are u using? Does it specify the baudrates to be used for its RS-232?

0 Kudos
Message 2 of 8
(8,748 Views)

The controller is a NI PXI-8106 Core 2 Duo 2.16 GHz Controller with Real-Time Embedded Software. The serial port is described as 16550 RS-232. This post says that the system should be able to handle 115.2 kbps: http://digital.ni.com/public.nsf/allkb/01E1586616FD650886257440006E44EB

0 Kudos
Message 3 of 8
(8,707 Views)

 


The system works at 9600, 14,400, 19,200, and 38,400 bps, but I am unable to communicate at baud rates of 57,600 and 115,200 bps. This is strange, because in the previous (USB) configuration (using the same code), I was able to communicate at 115.2 kbps


 

Kate,

 

I would suspect the serial cable- length or shielding.  I'm not a big fan of the FTDI driver but it, ostensibly, provided a "repeater" in the RS-232 data.   If this system is using an RS-232 to TTL converter consider placing the converter on the far end.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 8
(8,692 Views)

Do you get any errors reported from the instrument driver? I would suspect that you are probably encountering overrun errors on that built-in port. The built-in port on all of our PXI controllers is a standard 16550 UART, which only has a 16-byte FIFO. This means that if you have a lot of high priority work happening on your RT system, you may be starving the thread which services the serial port.

 

The first step will be to look for errors from the instrument driver. Hopefully it will propagate any VISA errors back out to you.

 

-Jason S.

0 Kudos
Message 5 of 8
(8,664 Views)

I don't think that it's a cable length problem. The cable is designed for RS-232/422 use, and it's actually transmitting data in the RS-422 format. The cable is 30' long, well under the recommended maximum length for RS-422.


I have a powered 232/422 converter at the RS-232 end to adapt the instrument's 422 signal to the 232 format accepted by the PXI. The adaptor has a maximum baud rate of 115.4 kps.

0 Kudos
Message 6 of 8
(8,596 Views)
I found a bug (or difference between my instrument and the earlier version for which the driver was designed) in the driver files. This led to fixing the stop bits setting and allowed me to increase the baud rate to 57.6 kbps successfully. But I still do need to increase the baud rate to 115.4 kpbs.

As to the overrun errors, for testing purposes I'm only running the instrument I/O code right now. Still, I tried RX FIFO buffer lengths from 2 to 14, but I did not see any change in the results.

On the first call of VISA Read after changing the serial settings (specifically baud rate and stop bits), I get this error:
Error -1073807339 VISA Read: Timeout expired before operation completed

0 Kudos
Message 7 of 8
(8,592 Views)

Hi Kate,

 

How much data are you reading back at the VISA read? Have you tried increasing the default Timeout value?

 

Here's a KnowledgeBase article that discusses this error more in-depth.

 

If increasing the timeout doesn't solve the problem, could you post your code so we can take a look? As you said, the hardware shouldn't be limiting the baud rate.

 

Take care!

Tanya Visser
National Instruments
LabVIEW Group Manager
0 Kudos
Message 8 of 8
(8,551 Views)