COM port lockup with Mbed Virtual Serial Port - serial-port

I am working with someone using Mbed and a LPCXpresso11U68 board.
I'm not intimately familiar with this particular board, but it has two USB connectors on it, one for the OpenSDA-ish debugger, and a second one is a direct connect to the CPU. I can connect both of these ports to my PC and attach a terminal emulator to each of them, and both ports show output (with a small installed program running on the board).
The device manager shows me that one port (COM51) is using "mbed Serial Port" driver and the other port (COM52) is using "Mbed Virtual Serial Port.
So far so good...
There is a reset button on the board. If I press that button, the port that is attached to the PC using the Mbed Virtual Serial Port driver (in my case COM52) stops operating. The other port (COM51) just restarts cleanly.
The problem I'm having is that after I exit the terminal program (note this happens with both TeraTerm and uCon), if I attempt to reconnect to that port, its not in the list of available comports. Strangely thought, it is still present in the Device Manager.
The only way I've found that I can clear this problem is to unplug/plug that usb cable (COM52) or issue a BREAK condition to COM51 (which AFAIK, resets the board).
I am the writer of uCon and I'd like to be able to detect this (which I can), and also be able to restart the comport connection without any other manual intervention.
One final note: apparently this is not specific to the LPCXpresso11U68 board; my guess it is some issue with the Mbed Virtual Serial Port driver.
Anyone have a clue what may be going on here?

Related

Simulate com port on pc to be recognised by other pc

Currently I have a server, that communicates with a projector through a RS232. The server opens a com port when the projector is connected. The same happens to any PC when a certain type of device is connected through the USB (lets say an Arduino for example). What I want to do it basically replace the projector with a PC/Arduino/Raspberry without the server noticing anything. That would mean the server will recognise the connected PC and open a COM port for it. What do I need to do on the PC so that it automatically opens a com port on the server? I guess there is something very basic that any printer, Arduino, projector etc does, that computers recognise it as a "com port device".
P.S. Doesn't matter the OS on the PC, I just need to make it work and then implement w/e I need to do with the established communication over the port.
P.S.2 I've searched a lot about it, but probabl I am doing it wrong, because I didn't find my type of question anywhere.
COM ports are basically hardware that is detected by the system. Let's say, if an Arduino is connected to a PC, it has its onboard USB to TTL converter which can be found in the device manager(if using windows). Similar USB to TTL converters are there in the market like CP2102, PL2303 which acts like a COM port even if no device is connected further to it. it may be possible that the program you are using(as you referred server) may be sending some data over the serial port and verifying the hardware.
What you need to do to replace it is, first of all, find the baud rate at which the communication is going on, then, listen over the serial lines which machine is sending which message in the sequence(there must be a handshake as I mentioned earlier), if a complicated algorithm is not used by the device, you can simply mimic the device by sending same messages over serial.

Serial communication crashes in LabVIEW

I am controlling a device over serial connection using LabVIEW (version 7.0). It is connected using USB, and is installed as a virtual serial port on the computer (running Windows XP). Every now and then my device crashes when my program sends a command, and it is unable to accept any more input (the device itself also stops working) until it has timed out.
I've looked at the serial port traffic using Portmon. Whenever the device crashes the serial driver sends the command I send using my program four times instead of just once, with an IOCTL_SERIAL_GET_COMMSTATUS command in between. I cannot see what this last command returns, but I assume something happens in the communication earlier on. I'm thinking my configuration of the port is not entirely right, but I have no idea how or why. I open and close the connection to my device every time I want to write something to it.
For completeness' sake: it has a baud rate of 9600, 8 bits, no parity, 1 stop bit, and no flow control. I'm aware that the correct settings of these parameters depend on the device, but the manufacturer has not supplied any recommended settings.
The driver is a DLL of some sort? If so, this is the most likely source of your problem, and you likely will need to contact the author of the driver. LabVIEW does have crashing bugs, but by far the most common source of crashes in simple communications apps is a buggy third-party DLL.
In other words, I doubt this is a LabVIEW problem at all and that you would have the same difficulty if you wrote a C program to talk to this driver. I only know what you've posted here about your system, but after many years of chasing down such issues, I would start with the device manufacturer/driver author.
If you have evidence to the contrary, please share.

Serial Port not working on Surface Book

I have a Microsoft Surface Book that I've dual booted Linux Mint on. I'm writing a program that needs to read in data from a serial port, but my serial ports don't seem to be working. The behavior is consistent across Mint and Windows (Testing done through Cygwin). It gets a bit of data the first 2-5 seconds that the device is plugged in (viewing the data through screen, same thing happens if I just use pyserial to print data incoming from serial port), then nothing.
What could be happening? I think I've isolated the problem to the serial ports - the Surface Book has 2 USB ports and the same thing happens on both of them, and I've tested the hardware that I'm plugging into it on 2 other computers (One Linux and one Mac OS), and it works fine on both of those.
Your MS Surface, seemingly, has a yellow triangle exclamation mark icon (over the adapter icon) without any driver to install/download. And properties in the device status box window say This device cannot start. (Code 10) or A device which does not exist was specified. Right?
If it's so you should wait for an update from MS. It's notorious problem.
I ended up getting the computer replaced on warranty for an unrelated issue months later, and what do you know, on the new computer the serial ports work fine. That indicates to me some sort of hardware problem, given that the issue persisted across OS's.
maybe this will help:
see Arduino examples for serial port communication - search google:
arduino serial c++
arduino serial c#
arduino serial c++ linux
the point is to open port properly you need to open a file, not a port. not with usual c - assembly write to port code.
another option you are using an unintentionally bought fake USB to serial cable with a Fake PL2303 chip
then you need to install the old version of the driver.
search in google:
Fake PL2303 + your os name:
install driver Fake PL2303 windows 10
another option is maybe it conserves energy and closes the port because it feels it is unused.
in windows> device manager,> properties of a device - usually USB root hub > power management - allow the computer to turn off this device to save power - uncheck it.
https://superuser.com/questions/408683/why-my-usb-mouse-gets-suspended-after-3-seconds-of-inactivity
https://blogs.msdn.microsoft.com/usbcoreblog/2013/11/08/help-after-installing-windows-8-1-my-usb-device-doesnt-charge-or-it-disconnects-and-reconnects-frequently/
also, you could look in windows events - to see what happens. usually, failures like this are registered in the events log.
an unlikely option is it consumes too much current, like a short circuit. and the device protection circuit shuts the chip off. also probably it does not have such circuit. one possibility is to try with an external powered hub.
the most probable of these is the power saving mechanism
I was experiencing the same problem - came across the solution on another site. The USB 3 ports on Surface Book aren't compatible with something or other to do with Com Port but running the device through a cheap USB hub solved my problem straight away and it was instantly recognised by the Arduino IDE

Arduino com port keeps getting busy

I have got an Arduino Uno R3 on which I have an accelerometer that I'm playing a bit with. This setup has worked for quite a while now, everything working from uploading to checking the serial output.
Today I started having problems with the com port reporting busy or not connected at all. When I use the default IDE it cant find the arduino at all but when I use a modded IDE (Arduino ERW 1.0.5) seems to find the port to communicate on but it reports it being busy.
I have reinstalled the driver like 5 or 6 times now and searched for any other driver that might work but they wont change anything. I have also checked that my pc actually detects the arduino which it does, it is listed among the COM ports on Device Manager. I also tried changing the Com port from COM3 to COM4 and still it worked for like 3 uploads and then the COM port kinda "disappeared" from the serial port list on the IDE.
EDIT: Weirdly, after closing some programs that seem to have to do with serial communication it works. I have to look into what I close and when.
EDIT2: For now it seems that processing sometimes didnt close properly when not using the stop button on the processing application which then didnt close the connection to the arduino. I havent had any problems since I started to use the Stop button on processing.
Win 8.1
Latest driver and IDE(an modded IDE called Arduino ERW 1.0.5 seem to work a bit better but have the same issues)
One thing I noticed is that if I press the reset button when it starts again it wont send anything through serial, is it defaulting to the Blink program after a reset or what?
For those getting the "port busy" error while connecting Arduino and Process, one fix is to close the serial monitor in Arduino.
For anyone who is struggling with this, you have to give again rw rights to ttyACM0
sudo chmod a+rw /dev/ttyACM0
after that I was able to open the serial port.
I found the problem being in Processing itself, on win 8.1 the P3D option for 3D renderer seems to leave the java process open after closure which causes the serial port to be busy even after the main window is closed.
I simply fixed it by using OPENGL instead of P3D which didn't change anything visibly so I'm fine with it.

Arduino COM port not found

For the past week I have been programming an Arduino Uno with a computer running Windows 7. When I first started, I found the device on COM6 and was able to upload code no problem. Recently it suddenly stopped receiving code under the error:
Serial port 'COM6' not found. Did you select the right one from the
Tools > Serial Port menu?
The Serial port menu though is grayed out. Research has told me to open up Device Manager and update drivers but there is no other devices tab in my Device Manager. The Arduino is run off the power of the USB cable and runs the code I uploaded a few days ago just fine. What can I do to be able to upload code to the Arduino?
Update:
I installed the Arduino software on another computer and it does not recognize the Arduino either. One of the comments indicates that this could be a problem with the FTDI chip. How can I test if this is the case, and if it is, can I fix it?
There are two types of cable:
Charging Cable
Data Transfer Cable
So try changing the cable, if you have already tried every USB driver and port; or else
Install a new driver using this link, http://www.wch.cn/download/CH341SER_MAC_ZIP.html.
But after installing the driver, if it doesn't work, then change the cable.
For Linux:
To solve the problem, simply run the IDE as super user, so go to terminal and type 'sudo arduino'.
To solve this problem permanently:
In the terminal, run 'gksudo gedit'
In gedit, open the /usr/share/applications/arduino.desktop file.
Change the line Exec=arduino
to Exec=gksudo arduino. Save the file.
Similarly, do the same for Windows...
Also try to re-install Arduino driver.
The Arduino probably started using a different port. When you plug Arduinos into a different USB port it sometimes defaults to a new COM port. Check your device settings for which ports are being used and try each of those. Also try plugging it into a different USB port (if no ports are displayed) and it should register with a new COM. If that fails reboot your machine and repeat the above. If that fails reinstall the Arduino USB driver and repeat above. If that fails you might have fried your Arduino's USB chip (or some other hardware on the Arduino).
For Linux: Vinayk93 is completely right. Adjust the serial port's access rights like so:
$ cd /dev/ ; ls -l ttyA* -- find the right portname, then
$ sudo chmod 666 ttyACMx -- x is 0 or 1

Resources