Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

Why do I get a framing error?

I have recently updated a program written using old-school serial VIs and made it use VISA.  My users are complaining that they are getting a "framing error" when they use the new software, but it works just fine using the old software (note:  there was also no error-checking in the old program).  They are reading a periodic message using an N.I. USB-485 converter.  I was under the impression that a framing error was a bit-level issue, not related to serial drivers.
It's kind of making me look like a schmuk since I pushed for the upgrade to the new drivers and better programming techniques.
Any ideas on how to chase this down? 
0 Kudos
Message 1 of 29
Are you initializing the correct baudrate etc.

normally you get a framing error on something like that.
last week I read in a manual that the baudrate was 9600 (default NI also) but in fact it was half of this !!
somebody on the instrument had hanged the default.

greetings from the Netherlands
0 Kudos
Message 2 of 29
No problems like that have been noted before.  The software usually runs on a PC in the lab.  All the user has access to select is the COM port number.  The software is hardcoded with baudrate, stop bits, etc.  In the lab, we haven't noticed any problems.  The user has recently installed in on a laptop for field work and is now noticing the problem.
0 Kudos
Message 3 of 29
I would check the voltage levels of the laptop.
Some of them do not have real rs232 values.
officially better than -3Volt and +3Volt but most desktops have -12Volt and +12Volt
greetings from the Netherlands
0 Kudos
Message 4 of 29

A couple of questions.

1- Is the PC in the lab using the USB-485 converter as well?  Does the old software use the same USB-485 converter.

2 - Does the laptop user always get the framing error or does the program work sometimes?

0 Kudos
Message 5 of 29
The PC is using an NI PCI-485 card.  The old software was using the old serial VIs.  Most users had RS-232 converters or a Quatech 485 PCMCIA card for use in laptops.  The user is now switching between the old and new software, using the same USB-485 converter, and getting these results.
According to the user, he claims that he invariably gets a framing error with the new software on his laptop even after a computer restart and a system-under-test restart.
0 Kudos
Message 6 of 29
Do you have NI-VISA Runtime installed on the laptops?  I'm pretty sure you need to have that to deploy a standalone .exe that uses VISA.
Another thing to remember is that the access times for the PCI-485 card are a lot faster than the USB-485 adapter.  You may have a timing issue with communications on the laptops due to longer delays in reading and writing the buffer.  This could also be source of framing error.
0 Kudos
Message 7 of 29

The user installed it on the laptop using an installer, which I would assume included LV runtime and VISA drivers, as well as the application.

As far as your comment about access times, shouldn't that information be transparent to me, the programmer?  I mean, I check the number of bytes at the port before I read the port.  And the old serial drivers don't seem to be affected...Perhaps I'm just not understanding the subtle nuances of what causes a framing error with NI hardware.

0 Kudos
Message 8 of 29

I just went back and looked at an installer for a similar program I wrote that runs standalone and used USB-232 adapter.  I had put some notes to myself in the documentation.

You must have both LabView Runtime and NI-VISA Runtime installed on the target pc.  It will not run without the NI-VISA Runtime. 

The easiest way to rule out any potential differences between the PCI-485 and USB-485 is to use a USB-485 on your development system and see what happens.

0 Kudos
Message 9 of 29
When I receive a "framing error" it often has to do with parity issues.
Serial communication error (Baud rate, parity, or data length mismatch between instrument and connected serial device):
  1. Check application software sets correct serial parameters
  2. Check baud rate, parity etc. set correctly.

I know, I are probably tired of hearing you need to check the baud rate, parity, etc., but I'm just telling you what the description of an error is that I often receive. 

A few questions...

  • Are you using VISA read?  If so, this could be where the data length issue comes into play. 
  • How do you start up the instrument and serial device?
  • Do you ever disconnect and then reconnect the serial device to any other instrument while it is still operational?
  • Have you tried resetting everything to manufacturer defaults?  Sometimes by doing this and starting "fresh" a problem can be avoided.


0 Kudos
Message 10 of 29