Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication

I am having issues with my serial port. I am trying to communicate with a device which has a baud rate of 96200 and all other settings are defualt. When I use a serial to USB converter and connect it to my PXI system, I am getting all the messages and no errors. But when I connect directly to one of the serial ports on the PXI system then I am getting the I/O frame error.
 
For the serial communication first I am configuring the serial port then assining the buffer size and I am flushing the buffer before each write then waite some time before I read the data with the help of number of bytes at the port and then closing the port.
 
The whole procedure works with the keyspan Serial to USB converter but doesn't work with the serial Port hocked directly to the PXI system.
 
I have no clue why is this happening. Is this something to do with the serial drivers on the keyspan compared to the drivers on the serial port on PXI system. Any suggestions or thoughts are most welcome.
 
Thanks,
 
Mudda.
0 Kudos
Message 1 of 10
(4,916 Views)

Hi Mudda,

96200 is not a standard baudrate. I am surprised that your USB device supports this.

0 Kudos
Message 2 of 10
(4,902 Views)

I am sorry I ment 19200 baudrate

 

Thanks,

 

Mudda.

0 Kudos
Message 3 of 10
(4,891 Views)
Hello Mudda,
 
I have a couple of additional questions for you:
What PXI controller are you using?
Have you preformed a Serial Loopback Test on the PXI serial port (this will confirm serial port is communicating properly)?
 
If you can preform the Serial Loopback Test, can you use the Open Visa Test Panel in Measurement & Automation Explorer to communicate with the device?
A_Ryan
AES
National Instruments
0 Kudos
Message 4 of 10
(4,874 Views)
Hi Ryan,
 
The Cotronller I am using is PXI-8186. I think I am having a mismatch with the clock time on my test device compared to the clock on the PXI hardware. I have the transmit and recieve lines connected together and go to my test device. So for normal testing if I disconnect the test device and just send and receive the messages, I am reading all the messages that I have sent. but when I connect my test device and then do the transmit and receive messages. I am not even reading the transmit messages properly. I think the clock on the test device is screwing up all the communication. But If I connect a serial to USB converter in between and do the same communication I am reading the messages propely. I am thinking the drivers on the USB to serial converter are more forgiving with the timing or something else going on. Any help is very much appreciated.
 
Thanks,
 
Mudda.
0 Kudos
Message 5 of 10
(4,830 Views)
Hello,
Can you take a NI SPY log of your communication using the serial port and one using the serial-to-USB converter?
Then attach it here and we can further deduce what the issue is.
Christian A
National Instruments
Applications Engineer
0 Kudos
Message 6 of 10
(4,800 Views)
Hello Chris,
 
Attached are the files you requested
 
Thanks,
 
Mudda
Download All
0 Kudos
Message 7 of 10
(4,784 Views)
Hello,
The frame error you are receiving can be caused by either
  • Noise in your serial lines
  • Mismatch of baud rates on your device to PC
There is a knowledgabase article on this found here.

You can also take a look at other forum posts such as the one here.
If it seems that the data you are receiving is right you could just clear the error and continue with the application.

Please go through the steps and let us know if this helps.

Christian A
National Instruments
Applications Engineer
0 Kudos
Message 8 of 10
(4,771 Views)
Hi Chris,
 
I looked at the links that you attached, they did not help me much. I know for sure that I am using the correct Baud Rate and the data I am receiving is not a good data so I cannot ignore the error messages.
 
One thing I don't udnerstand is why the USB to serial port is working and not the PXI Serial card's Serial Port. Do you have any ideas why this difference would be. I am going to put an Oscilloscope and see how the signals are like. I remember last time when I measured the signals there was not lot of noise on the signals. I will make sure that is the case now also.
 
Thanks,
 
Mudda.
0 Kudos
Message 9 of 10
(4,767 Views)
Hello,
Lets try this, put a delay right after you configure your port and before you flush.
Let us know how this goes.
Christian A
National Instruments
Applications Engineer
0 Kudos
Message 10 of 10
(4,756 Views)