Solution
Serial data is transferred one byte at a time, with each byte having a specific format that includes a start bit, data bits, parity, and stop bits. A framing error occurs when a byte of data is received but does not match the expected format.
Before debugging, or if you are not successful with the steps detailed below, verify that your serial device is functional. Here are some options:
- Use the serial device's shipping software to test it, if possible.
- Try a different unit, if available.
- Use third-party serial software from a PC serial port to verify that the commands are correct and that the unit responds as expected.
- Running an NI IO Trace can be useful to see what is happening.
- If you are using an NI-9871 module, make sure you have an isolated power supply connected to it to ensure proper operation. For more details, please refer to the following article: Does My NI 987x Module Need an External Power Supply?
Review the points below to try to resolve the issue:
- Verify that the port has finished its configuration by the time the first character is received off of that port. You can do this by putting a delay (approximately 10-100 ms) after the VISA Configure Serial Port VI to allow the serial port enough time to configure itself. Then, by using a VISA Flush I/O Buffer VI, you can clear any invalid data in the buffer. Reading after this sequence should work correctly. Your block diagram should appear as shown below:

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW Diagram
- Ensure you are not closing the VISA Resource before the Read/Write task is complete.
- Check that your serial port and device have been configured with the same settings. To do this, open NI Measurement & Automation Explorer (NI MAX) and select your serial port under Devices and Interfaces. Verify that the VISA Resource Name, Baud rate, Data bits, Parity, and Stop bits all match the settings of your device under the port settings tab. The easiest way to check the configuration is by tracing the received signal with an oscilloscope.
Note: You can change these settings programmatically during run-time, as seen in the example above, or in NI-MAX, as shown below.

- Check to ensure your cables are securely plugged in.
- You may have a bad serial cable or the wrong type of serial cable. Try another serial cable and check your device manual to determine if a null modem or straight-through cable is required. Refer to the article: Should I Use Null Modem or Straight Through Serial Cables?
- You may be experiencing noise on your serial line. Move the serial cable away from power cables, monitors, or other potential noise sources.
- Although unlikely, a corrupt driver installation could be the issue. To use serial devices, you need to have LabVIEW, NI-Serial, and NI-VISA installed on your computer. You may need to repair these installations if the error continues and you have tried all the steps above. Refer to the article: Force Reinstall Non-Working or Corrupt NI Software.