Win error code 5 com port

win error code 5 com port

Once you're in 'Advanced Settings for COM10' on the bottom you can see the 'COM Port Number: COM10'. Click on that to change it to the lowest possible number . I tried a bunch of things, but I can't seem to resolve this issue. The code is very simple. Python Code: import serial arduinoData = serial. Windows 10 PC's may not display COM ports without additional configuration. 5. Hit Next and then Finish. 6. The COM ports item will now display in.

Messages: Win error code 5 com port

Display error php page
Alignment error hp 500
Hpdesignjet 500 ps error code 79 04

Win error code 5 com port - with you

Access to the port 'COM1' is denied

First, make sure the serial port exists. Check the Device Manager; right-click on My Computer, select "Manage" from the context menu, select "Device Manager", expand "Ports Com & LPT". If Com1 is not listed, you will need to enable it in the BIOS.

If COM1 is there, then another program has left it open. Access to COM1 is exclusive; only one program can have it open at a time. Fax software or a modem could have it open, or you could have left it open yourself.

This is easy to do. If you work on a program that opens the port and forget to close it, or if an error occurs and the program terminates without closing the port, this is the message you will get the next time you try to open COM1. Only the program that opened the port can close it. "Catch" or "Finally" blocks are good places to close the port and prevent this.

answered Jul 20, 2009 at 13:51

user avatar
R UbbenR Ubben

2,2151616 silver badges88 bronze badges

Serial port

Communication interface transmitting information sequentially

In computing, a serial port is a serial communicationinterface through which information transfers in or out sequentially one bit at a time.[1] This is in contrast to a parallel port, which communicates multiple bits simultaneously in parallel. Throughout most of the history of personal computers, data has been transferred through serial ports to devices such as modems, terminals, various peripherals, and directly between computers.

While interfaces such as Ethernet, FireWire, and USB also send data as a serial stream, the term serial port usually denotes hardware compliant with RS-232 or a related standard, such as RS-485 or RS-422.

Modern consumer personal computers (PCs) have largely replaced serial ports with higher-speed standards, primarily USB. However, serial ports are still frequently used in applications demanding simple, low-speed interfaces, such as industrial automation systems, scientific instruments, point of sale systems and some industrial and consumer products.

Server computers may use a serial port as a control console for diagnostics, while networking hardware (such as routers and switches) commonly use serial console ports for configuration, diagnostics, and emergency maintenance access. To interface with these and other devices, USB-to-serial converters can quickly and easily add a serial port to a modern PC.


Modern devices use an integrated circuit called a UART to implement a serial port. This IC converts characters to and from asynchronous serial form, implementing the timing and framing of data specified by the serial protocol in hardware. The IBM PC implements its serial ports, when present, with one or more UARTs.

Very low-cost systems, such as some early home computers, would instead use the CPU to send the data through an output pin, using the bit banging technique. These early home computers often had proprietary serial ports with pinouts and voltage levels incompatible with RS-232.

Before large-scale integration (LSI) made UARTs common, serial ports were commonly used in mainframes and minicomputers, which would have multiple small-scale integrated circuits to implement shift registers, logic gates, counters, and all the other logic needed. As PCs evolved serial ports were included in the Super I/O chip and then in the chipset.

  • An IBM PC serial card with a 25-pin connector (obsolete 8-bit ISA card)

    An IBM PC serial card with a 25-pin connector (obsolete 8-bit ISA card)

  • A four-port serial (RS-232) PCI Express ×1 expansion card with an octopus cable that breaks the card's DC-37 connector into four standard DE-9 connectors

    A four-port serial (RS-232) PCI Express ×1 expansion card with an octopus cable that breaks the card's DC-37 connector into four standard DE-9 connectors

  • A converter from USB to an RS-232 compatible serial port—more than a physical transition, it requires a driver in the host system software and a built-in processor to emulate the functions of the IBM XT compatible serial port hardware.

    A converter from USB to an RS-232 compatible serial port—more than a physical transition, it requires a driver in the host system software and a built-in processor to emulate the functions of the IBM XT compatible serial port hardware.

  • UART to USB adapter

DTE and DCE[edit]

The individual signals on a serial port are unidirectional and when connecting two devices, the outputs of one device must be connected to the inputs of the other. Devices are divided into two categories: data terminal equipment (DTE) and data circuit-terminating equipment (DCE). A line that is an output on a DTE device is an input on a DCE device and vice versa, so a DCE device can be connected to a DTE device with a straight wired cable, in which each pin on one end goes to the same numbered pin on the other end.

Conventionally, computers and terminals are DTE, while peripherals such as modems are DCE. If it is necessary to connect two DTE (or DCE) devices together, a cable with reversed TX and RX lines, known as a cross-over, roll-over or null modem cable must be used.


Generally, serial port connectors are gendered, only allowing connectors to mate with a connector of the opposite gender. With D-subminiature connectors, the male connectors have protruding pins, and female connectors have corresponding round sockets.[2] Either type of connector can be mounted on equipment or a panel; or terminate a cable.

Connectors mounted on DTE are likely to be male, and those mounted on DCE are likely to be female (with the cable connectors being the opposite). However, this is far from universal; for instance, most serial printers have a female DB25 connector, but they are DTEs.[3] In this circumstance, the appropriately gendered connectors on the cable or a gender changer can be used to correct the mismatch.


The only connector specified in the original RS-232 standard was the 25-pin D-subminiature, however, many other connectors have been used to save money or save on physical space, among other reasons. In particular, since many devices do not use all of the 20 signals that are defined by the standard, connectors with fewer pins are often used. While specific examples follow, countless other connectors have been used for RS-232 connections.

The 9-pin DE-9 connector has been used by most IBM-compatible PCs since the Serial/Parallel Adapter option for the PC-AT, where the 9-pin connector allowed a serial and parallel port to fit on the same card.[4] This connector has been standardized for RS-232 as TIA-574.

Some miniaturized electronics, particularly graphing calculators[5] and hand-held amateur and two-way radio equipment,[6] have serial ports using a phone connector, usually the smaller 2.5 or 3.5 mm connectors and the most basic 3-wire interface—transmit, receive and ground.

A Cisco rollover cable using the 8P8C Yost standard

8P8C connectors are also used in many devices. The EIA/TIA-561 standard defines a pinout using this connector, while the rollover cable (or Yost standard) is commonly used on Unix computers and network devices, such as equipment from Cisco Systems.[7]

Many models of Macintosh favor the related RS-422 standard, mostly using circular mini-DIN connectors. The Macintosh included a standard set of two ports for connection to a printer and a modem, but some PowerBook laptops had only one combined port to save space.[8]

10P10C connectors can be found on some devices.[9]

Another common connector is a 10 × 2pin header common on motherboards and add-in cards which is usually converted via a ribbon cable to the more standard 9-pin DE-9 connector (and frequently mounted on a free slot plate or other part of the housing).[10]

Hardware abstraction[edit]

Operating systems usually create symbolic names for the serial ports of a computer, rather than requiring programs to refer to them by hardware address.

Unix-like operating systems usually label the serial port devices /dev/tty*. TTY is a common trademark-free abbreviation for teletype, a device commonly attached to early computers' serial ports, and * represents a string identifying the specific port; the syntax of that string depends on the operating system and the device. On Linux, 8250/16550 UART hardware serial ports are named /dev/ttyS*, USB adapters appear as /dev/ttyUSB* and various types of virtual serial ports do not necessarily have names starting with tty.

The DOS and Windows environments refer to serial ports as COM ports: COM1, COM2,..etc.[11]

Common applications for serial ports[edit]

This list includes some of the more common devices that are connected to the serial port on a PC. Some of these such as modems and serial mice are falling into disuse while others are readily available. Serial ports are very common on most types of microcontroller, where they can be used to communicate with a PC or other serial devices.

Since the control signals for a serial port can be driven by any digital signal, some applications used the control lines of a serial port to monitor external devices, without exchanging serial data. A common commercial application of this principle was for some models of uninterruptible power supply which used the control lines to signal loss of power, low battery, and other status information. At least some Morse code training software used a code key connected to the serial port to simulate actual code use; the status bits of the serial port could be sampled very rapidly and at predictable times, making it possible for the software to decipher Morse code.


Bit rate (bit/s)Time per bit (μs)Windows predefined serial port speed[12][13]Common applications
1109090.9YesBell 101 modem
3003333.3YesBell 103 modem or V.21 modem
1,200833.3YesBell 202, Bell 212A, or V.22 modem
2,400416.7YesV.22bis modem
4,800208.3YesV.27ter modem
9,600104.2YesV.32 modem
14,40069.4YesV.32bis modem
31,25032NoMIDI port
56,00017.9YesV.90/V.92 modem
57,60017.4YesV.32bis modem with V.42bis compression
76,80013.0NoBACnet MS/TP networks[14]
115,2008.68YesV.34 modem with V.42bis compression, low cost serial V.90/V.92 modem with V.42bis or V.44 compression
128,0007.81YesBasic Rate InterfaceISDNterminal adapter
230,4004.34NoLocalTalk, high end serial V.90/V.92 modem with V.42bis or V.44 compression[15][16]
250,0004.0NoDMX512, stage lighting and effects network

Serial standards provide for many different operating speeds as well as adjustments to the protocol to account for different operating conditions. The most well-known options are speed, number of data bits per character, parity, and number of stop bits per character.

In modern serial ports using a UART integrated circuit, all these settings can be software-controlled. Hardware from the 1980s and earlier may require setting switches or jumpers on a circuit board.

The configuration for serial ports designed to be connected to a PC has become a de facto standard, usually stated as 9600/8-N-1.


Serial ports use two-level (binary) signaling, so the data rate in bits per second is equal to the symbol rate in baud. The total speed includes bits for framing (stop bits, parity, etc.) and so the effective data rate is lower than the bit transmission rate. For example, with 8-N-1 character framing, only 80% of the bits are available for data; for every eight bits of data, two more framing bits are sent.

A standard series of rates is based on multiples of the rates for electromechanical teleprinters; some serial ports allow many arbitrary rates to be selected, but the speeds on both sides of the connection must match for data to be received correctly. Bit rates commonly supported include 75, 110, 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600 and 115200 bit/s.[13] Many of these standard modem baud rates are multiples of either 0.9 kbps (e.g., 19200, 38400, 76800) or 1.2 kbps (e.g., 57600, 115200).[17]Crystal oscillators with a frequency of 1.843200 MHz are sold specifically for this purpose. This is 16 times the fastest bit rate, and the serial port circuit can easily divide this down to lower frequencies as required.

The capability to set a bit rate does not imply that a working connection will result. Not all bit rates are possible with all serial ports. Some special-purpose protocols such as MIDI for musical instrument control, use serial data rates other than the teleprinter standards. Some serial port implementations can automatically choose a bit rate by observing what a connected device is sending and synchronizing to it.

Data bits[edit]

The number of data bits in each character can be 5 (for Baudot code), 6 (rarely used), 7 (for true ASCII), 8 (for most kinds of data, as this size matches the size of a byte), or 9 (rarely used). 8 data bits are almost universally used in newer applications. 5 or 7 bits generally only make sense with older equipment such as teleprinters.

Most serial communications designs send the data bits within each byte least significant bit first. Also possible, but rarely used, is most significant bit first; this was used, for example, by the IBM 2741 printing terminal. The order of bits is not usually configurable within the serial port interface but is defined by the host system. To communicate with systems that require a different bit ordering than the local default, local software can re-order the bits within each byte just before sending and just after receiving.


Main article: Parity bit

Parity is a method of detecting errors in transmission. When parity is used with a serial port, an extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. Correct parity does not necessarily indicate absence of corruption as a corrupted transmission with an even number of errors will pass the parity check. A single parity bit does not allow implementation of error correction on each character, and communication protocols working over serial data links will typically have higher-level mechanisms to ensure data validity and request retransmission of data that has been incorrectly received.

The parity bit in each character can be set to one of the following:

  • None (N) means that no parity bit is sent and the transmission is shortened.
  • Odd (O) means that the parity bit is set so that the number of 1 bits is odd.
  • Even (E) means that the parity bit is set so that the number of 1 bits is even.
  • Mark (M) parity means that the parity bit is always set to the mark signal condition (1 bit value).
  • Space (S) parity always sends the parity bit in the space signal condition (0 bit value).

Aside from uncommon applications that use the last bit (usually the 9th) for some form of addressing or special signaling, mark or space parity is uncommon, as it adds no error detection information.

Odd parity is more useful than even parity since it ensures that at least one state transition occurs in each character, which makes it more reliable at detecting errors like those that could be caused by serial port speed mismatches. The most common parity setting, however, is none, with error detection handled by a communication protocol.

To allow detection of messages damaged by line noise, electromechanical teleprinters were arranged to print a special character when received data contained a parity error.

Stop bits[edit]

Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronize with the character stream. Electronic devices usually use one stop bit. If slow electromechanical teleprinters are used, one-and-one half or two stop bits may be required.

Conventional notation[edit]

The data/parity/stop (D/P/S) conventional notation specifies the framing of a serial connection. The most common usage on microcomputers is 8/N/1 (8N1). This specifies 8 data bits, no parity, 1 stop bit. In this notation, the parity bit is not included in the data bits. 7/E/1 (7E1) means that an even parity bit is added to the 7 data bits for a total of 8 bits between the start and stop bits.

Flow control[edit]

Flow control is used in circumstances where a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a handshaking method. There are hardware and software handshaking methods.

Hardware handshaking is done with extra signals, often the RS-232 RTS/CTS or DTR/DSR signal circuits. RTS and CTS are used to control data flow, signaling, for instance, when a buffer is almost full. Per the RS-232 standard and its successors, DTR and DSR are used to signal that equipment is present and powered up so are usually asserted at all times. However, non-standard implementations exist, for example, printers that use DTR as flow control.

Software handshaking is done for example with ASCIIcontrol charactersXON/XOFF to control the flow of data. The XON and XOFF characters are sent by the receiver to the sender to control when the sender will send data, that is, these characters go in the opposite direction to the data being sent. The circuit starts in the sending allowed state. When the receiver's buffers approach capacity, the receiver sends the XOFF character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an XON character to tell the sender to resume transmission. It is an example of in-band signaling, where control information is sent over the same channel as its data.

The advantage of hardware handshaking is that it can be extremely fast; it doesn't impose any particular meaning such as ASCII on the transferred data; and it is stateless. Its disadvantage is that it requires more hardware and cabling, and these must be compatible at both ends.

The advantage of software handshaking is that it can be done with absent or incompatible hardware handshaking circuits and cabling. The disadvantage, common to all in-band control signaling, is that it introduces complexities in ensuring that a) control messages get through even when data messages are blocked, and b) data can never be mistaken for control signals. The former is normally dealt with by the operating system or device driver; the latter normally by ensuring that control codes are escaped (such as in the Kermit protocol) or omitted by design (such as in ANSI terminal control).

If no handshaking is employed, an overrun receiver might simply fail to receive data from the transmitter. Approaches for preventing this include reducing the speed of the connection so that the receiver can always keep up; increasing the size of buffers so it can keep up averaged over a longer time; using delays after time-consuming operations (e.g. in termcap) or employing a mechanism to resend data which has been corrupted (e.g. TCP).

See also[edit]


Further reading[edit]

  • Serial Port Complete: COM Ports, USB Virtual COM Ports, and Ports for Embedded Systems; 2nd Edition; Jan Axelson; Lakeview Research; 380 pages; 2007; ISBN 978-1-931-44806-2.

External links[edit]

Last Updated on January 14, 2019

Updated August 2022: Stop getting error messages and slow down your system with our optimization tool. Get it now at this link
  1. Download and install the repair tool here.
  2. Let it scan your computer.
  3. The tool will then repair your computer.

A serial port may be useful, but some users have reported that the serial port message cannot be opened on their PC. This can be a big problem, and in today’s article we will show you how to solve it.

Problems with a serial port can be very annoying, especially if you tend to use the serial port frequently. When we talk about these types of problems, here are some related problems that have been reported by users:

  • Connection to com1 Windows 10, com3 could not be opened – This problem can sometimes occur if you do not have the required drivers. To solve the problem, you must update the serial port driver and verify that it solves your problem.
  • Putty cannot open Windows 10 serial port – Sometimes this problem can occur due to some Windows services. This is not a big problem, and you can solve it by disabling these services.
  • Access to the serial interface com1 cannot be opened – This problem may occur due to problems with the serial interface. To solve the problem, temporarily disable the serial port and see if it helps.
  • Com port cannot be opened win error code 5, 123, 32 – These are some common problems that can occur with a serial port, but you should be able to solve most of them with one of our solutions.

Windows may try to assign it to a COM port already in use. It seems that Windows sometimes gets an inconsistency in the registry of what has already been assigned.

To see if this is the problem (and if possible solve it), try changing the assigned COM port.

  1. Go to Device Manager > Ports (COM & LPT) > mbed Serial Port, then right-click and select Properties.
  2. Select the Port Settings tab and click Advanced.
  3. Under “COM port number”, try to select a different COM port.

August 2022 Update:

You can now prevent PC problems by using this tool, such as protecting you against file loss and malware. Additionally it is a great way to optimize your computer for maximum performance. The program fixes common errors that might occur on Windows systems with ease - no need for hours of troubleshooting when you have the perfect solution at your fingertips:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.


Note that Windows marks some of them as (in use), but does not consider them exhaustive, for the same reason that this problem may exist!

Try switching it to a few different unused COM ports and see if it has an effect. If not, we will dive deeper to see what Windows is reporting.

And don’t forget to unplug the power cord after the change to recharge the driver and see all the results.

Try using another cable.

I noticed that using an older USB cable sometimes leads to a poor connection of the card. It would be moody if it worked sometimes and not differently. The problem was solved with a new or even different cable.


If you enter “Hyperterminal” in the Windows Start menu, right-click after the call and select “Run as administrator”. It should help you access the serial port.

Also check which COM port it uses. To do this, follow these steps:

1. press the window+R button

2. type devmgmt.msc

3. go to ports

Now check which port is assigned to the USE serial converter and use it in the spatula.

Expert Tip:This repair tool scans the repositories and replaces corrupt or missing files if none of these methods have worked. It works well in most cases where the problem is due to system corruption. This tool will also optimize your system to maximize performance. It can be downloaded by Clicking Here


Ed Moyes

CCNA, Web Developer, PC Troubleshooter

I am a computer enthusiast and a practicing IT Professional. I have years of experience behind me in computer programming, hardware troubleshooting and repair. I specialise in Web Development and Database Design. I also have a CCNA certification for Network Design and Troubleshooting.

Categories Windows

How to fix error code 5 (ERROR_ACCESS_DENIED)

Error Code 5 is a Windows error code that appears when the user does not have sufficient permission to access the requested file or location. It appears when the software was denied access to a location for the purposes of saving, copying, opening, or loading files. This usually occurs when your Windows user account does not have administrative privileges or when you attempt to access a network location or folder that is protected by using Windows User Account Control security policies. This error can appear when you attempt to browse to a location, save a file, or download a file. This error may also appear when attempting to run the Check for Updates feature, which downloads an installer to update the software.

If you encounter Error Code 5, try the following:

  • Make certain you are logged into Windows with a user account that has permission to access the location. In the case of downloading any updates, you will need to make sure your user account has permission to save files to the software's installation folder (usually C:\Program Files (x86)\GoFiler Complete or a folder in C:\Program Files (x86) with the name of your software). If your user account does not have permission to access the location, contact your organization's IT department or run the process with elevated privileges.

Our support team can help you identify this issue but we cannot resolve it directly for you. This error usually indicates an environmental issue that your IT department would have to resolve.

<pid>] [name]
-a Dump all handle information.
-l Just show pagefile-backed section handles.
-c Closes the specified handle (interpreted as a hexadecimal number).
You must specify the process by its PID.
WARNING: Closing handles can cause application or system
-y Don't prompt for close handle confirmation.
-s Print count of each type of handle open.
-u Show the owning user name when searching for handles.
-p Dump handles belonging to process (partial name accepted).
name Search for handles to objects with <name> (fragment accepted).

No arguments will dump all file references.

Handle type summary:
Desktop : 56
Directory : 165
Event : 3470
File : 1463
IoCompletion : 142
Job : 1
Key : 1540
KeyedEvent : 49
Mutant : 632
Port : 566
Process : 221
Section : 373
Semaphore : 1327
SymbolicLink : 2
Thread : 1009
Timer : 46
Token : 93
WaitablePort : 3
WindowStation : 99
WmiGuid : 98
Total handles: 11355

This is a tough one.