How do I recover when Arduino USB Port randomly disappears? - arduino

I'm using my computer remotely and have an Arduino Every attached to a powered USB 3.0 hub. Anyway, the Arduino is part of a hardware tool that does some nice things for me. I communicate with it through the COM port.
The problem is that sometimes, after several days or even weeks, the Arduino's COM port just disappears. Is there some way to recover that COM port without physically unplugging it?
Sometimes restarting the computer works, but since the Arduino is plugged into a Powered USB Hub, it doesn't lose its power during a computer reset, so it doesn't reset itself and the COM port doesn't show up.
This used to happen frequently when I was using Arduino Nano knock-offs. I changed over to using Genuine Arduino Every devices and it hasn't been a problem for the last couple months. However, I'm now seeing it happen again.
Does anybody have a solution for this problem, or is this just something that happens from time to time with an Arduino when its connected for weeks/months at a time?

So, I replaced all usages of String with char[] and the problem still persisted.
I finally went online and purchased an internal PCI-E USB expansion card with 7 ports. I started using that 2 weeks ago and haven't seen the problem since. The other benefit to the internal card is that when I reboot the computer, the card reboots and forces a disconnect/reconnect of all COM ports.
I guess there was just something about having an external USB Hub that was causing the problems in the first place and the internal card was much more stable.
UPDATE - After week 3, I lost communication with a couple of my Nano Every devices. Unplugging and replugging them in fixes the problem, but I need them to NOT have that problem again. I guess the internal PCI-E Usb Hub didn't solve the problem. Maybe if I plug the Every's directly into the Computers standard USB ports that might help. I'll give that a try...
UPDATE 2 - I ended up purchasing a couple wifi wall plugs. Now, I can remotely unplug my computer and remotely unplug the USB Hub Power. I just 'Shut Down' my computer remotely and then remotely power it off for a few minutes and power off the USB hub for a few minutes. I then power up the computer (I have it's BIOS set to auto boot on power-cycle) and after it boots up, I power up the USB HUB and get all devices recognized again. Sometimes, I can just power-cycle the USB HUB to get the COM Ports visible again. It's a pain, but unless somebody comes up with a better idea, that's what I'm goin' with...

Related

Why NodeMcu is disconnecting every 2 sec?

Summery
I recently bought a nodemcu 1.0 (ESP8266 12-E). It was working fine before this noon. But, now it's disconnecting every 2 sec.
Description
Until this noon I successfully run the blink code and some other codes. But, now when I connect the board to PC, PC plays a sound and immediately after 2 sec It disconnects from PC. If I keep open arduino software i can see the com 4 for a split sec but, then It disconnects. When I unplug it and replug the cable same happens again.
Things I tried
I did try to update arduino software as well as nodemcu drivers from http://www.wch-ic.com/downloads/CH341SER_ZIP.html
Updated the arduino software to 1.8.15 which is current latest release.
This question is rather tricky to be answered. I faced the same situation a while before and got some cases.
Drivers
As you mentioned, You updated drivers from http://www.wch-ic.com/downloads/CH341SER_ZIP.html which is CH340G/CH341 drivers. It is possible that you might have CH340G chip in your board but, the board comes with another variant as well(cp2102). You can download the drivers from here.
Software
You did update the software but, it is likely not the case which is disconnecting the board. Software is medium through which you can access the board.
Hardware
It is possible that one of the component in your board is damaged. It can be possible. Unless you are a pro at hardware you cannot figure out what's causing the issue.
Still, there is a possibility that serialization chip is damaged. And you can use FTDI driver for that. You can buy that from market easily.
YOUR PC
It is very rare but, Yes it is quite possible that actually your pc is damaged or usb port is damaged. In my case usb port was damaged and was not supplying enough current to board and then it was disconnecting automatically.
If above mentioned scenario doesn't work then I highly recommend that check the board with other PC.

Why can't I run two USB serial adaptors on the same machine?

My work involves interacting with legacy hardware that uses serial ports. I often have to monitor more than one serial line, and for the purpose I have a couple of the common USB serial adaptors. When I connect both of them to the same (Windows 10) machine, irregularities show up. Both ports show up in device manager, but only the first one that I plug in to the USB connector works. The other one indicates port not open when I try to send data via RealTerm.
I have also seen the situation where when I plug the second adaptor in, its port comes up, but the one for the other adaptor disappears. Does anyone know a way that two devices can happily coexist on the one machine? Thanks in advance.
Just ion case this helps anyone in the future......
The problem seems to be caused by the fact that one of the adaptors was coming in via a (powered) USB hub. When I liberated another native port on the machine so I could host both serial adaptors directly, everything worked fine.
Not worth hunting the cause down, a solution is at hand.

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

RS232 connection from PC to PLC slower than using USB2RS232 cable?

I had a PC connected to a PLC (Mitsubishi Q Series) via a USB2RS232 cable. The cable was plugged into the PC side, which was then plugged into a Serial cable and then into the PLC. I hade the baud rate set to 19200 and everything worked fine.
My problem was that every now and then the PC would blue screen on me. When I checked through the dump files the problem seemed to be related to the driver for the USB2RS232 cable (ftdi). I update to the latest driver but still bluescreening (Pc was running Windows 7).
Anyway I replaced the PC with another which had a dedicated RS232 port. Now I keep getting communication issues which is indicated by the response by the PLC. Just by chance I lowered the baud rate down to 9600 on both the PC and PLC. The issue seems to have gone away.
My question is why would removing the USB2RS232 cable cause me to have to slow down the communication? Both devices can communicate at speeds greater than 19200 and I would have thought going from serial port (PC) to serial port (PLC) with a serial cable would be better.
EDIT: Problem maybe solved - still testing
Thanks to some of the input from you guys, I may have solved the problem. Here are the following points I went by to get the speed back up to 19200 when using straight RS232 to RS232.
Even though no noise was detected on the equipment, a shielded cable was used.
The PC program would wait 100ms between sending data to the PLC. I read somewehere that 100ms is a good approx for PLC scan time.
RS232 Communication between modern PLCs and modern computers is often a hassle. These are some things I look at what it's not working:
The cable. Lots of cables are nonstandard, and have nonstandard internal jumpers and whatnot that can increase error rates and lower throughput. It is possible that your USB converter is more advanced and is autodetecting something with your cable and compensating for it.
The OS on the PC. Windows versions newer than Windows 98 don't seem to have the best support for serial communications.
Interference. Be especially careful of drives near the comm line. If you are using unshielded cables, a drive that runs intermittently can cause exactly the problem you describe, where you get an intermittent failure, but no noise at all whe the equipment is idle and you go check.
From your description I would guess that you have your equipment in a "noisy" environment - judging from the previous blue screens and now the issues with a regular RS232.
Have you tried to run the setup elsewhere with same hardware but other environment?
See if you can get a better isolated serial cable and/or use an EMF-meter to measure electric/magnetic fields around your setup.
Also worth to check out would be to put in another RS232 card in the PC to see if you have issues there, it could be that you had bad luck and the RS232 has broken.
Edit
Are you sure the speed is higher than 9600 with the USB converter? maybe it has negotiated down the speed? (disclaimer: not sure what brand you are using and how intelligent it is).

Arduino programming using USB download fails on Windows 2000

I have a number of Windows 2000 systems that we are trying to use to program the new Arduino Uno and Mega devices. These boards now come with a USB connection, an upgrade from the prior FTDI. I'm not able to download the Arduino code into the board from a Windows 2000 system
The supplied drivers are *.inf files that modify the standard USB driver that comes with Windows (in this case Windows 2000).
I go through the process of setting the port, setting the device and doing the download. The download fails, and the apparent error is that the PC can not communicate with the board. I've checked the port, adjusted the baud rates, etc. I've even moved the port number from a high port number (ie COM12) to a lower port (COM2) without any success. I do see activity on the rec/xmt lights on the Arduino board, so some type of data is being sent and received.
I'm looking for:
Someone who has been able to download files from Windows 2000 to the Arduino
or
A way to shim inside the USB driver to be able to watch the traffic going up and down to the board so I can continue to debug this.
or
Some general tips for things to look at in the .inf file that need to be set/not set to make it work on Windows 2000.
I know the boards work I've used them on a different set of Windows XP systems. So I know to some extent the install is good and that most of what I have works.
Full dumps can be found on the Arduino forum, http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1291090110/.
This is the information produced by the AVRDude program while it's trying to download the code.
this could be a long shot, but I jsut recentlz had problems uploading too. Fist of all, how long is the USB cabele you are uploading from? Mine in one case was too long and th arduino woul lose sync. Secondly, and this might just be a silly oversight (like i did) do you have things wired in the digital pin 0 and 1? These are used for the communication, and if there is anything else plugged in to them the upload will also fail.
As I said, long shot but those were two errors I had.

Resources