Main Content

Resolve Serial Port Connection Errors


If you are unable to connect to a serial port device using the serialport interface, follow these troubleshooting steps.

Possible Solutions

Check Device Status

Check that the specified port is not in use.

  • Make sure that a serialport object using the same port number does not already exist in the workspace. You can create only one serialport object for each port.

  • Check that your device is not in use outside of MATLAB®. Disconnect your device from any other devices, applications, or programs.

  • Use a third-party serial communication software, such as PuTTY, to check that you can access the specified port from other software.

  • Make sure that your device is powered on and connected to your computer.

Verify Port Name

Check that the specified port name is correct and that a device is connected to it.

  • Use the serialportlist function to return a list of all serial ports that you have access to on your computer. Use serialportlist("available") to return a list of only serial ports that are available. Make sure that you are creating a serialport object using one of the listed ports.

  • Check from your computer settings that the device connected to the serial port is available. For more information on how to view this information on your platform, see Find Serial Port Information for Your Platform.

Specify Supported Parameters

Check that the specified parameters are supported by your device.

  • Make sure that the baud rate specified as an input argument is supported by your device. Refer to your device documentation for this information. The baud rate must match the device configuration.

  • If you have specified any other parameters using name-value arguments, make sure that those are supported by your device as well. You can specify the DataBits, Parity, StopBits, FlowControl, ByteOrder, and Timeout properties using name-value arguments.

Additional Troubleshooting for Virtual Serial Port Connection

If you have devices that present themselves as serial ports on your operating system, you can use them as virtual USB serial ports. One example of such a device is a USB serial dongles.

  • If you are connecting to a device over a virtual serial port, check that the device drivers are properly installed.

  • If you are using Linux®, you might need to enable permissions to read from and write to a virtual serial port. Some Linux distributions require the user account to be a member of the dialout group to have permission to read from and write to the serial port.

See Also

Related Topics