Page 1 of 1

USB port not always recognized

Posted: Sat Feb 18, 2017 9:31 am
by Canedje
I'm using my RPI as a datalogger for Energy measuring. I'm using two devices both connected by USB to the RPI.
I predefined the names for the USB's. This is working fine.

My problem is that sometimes one of the USB is not recognized by the RPI anymore (Always the same one connected by P1 at smart energy meter, the other never have problems) and the RPI is not able to read the data anymore from this port.
Some time pulling out the USB cable and putting it back it works again. Some times that is not working also and I do have to shutdown the RPI, restart and pull out end put back the USB cable again.
Then it works.
This problem can occure ones a day, but also sometimes after a month.
the way I activate the USB port in Python is:

Code: Select all

#Set COM port config
ser = serial.Serial()
ser.baudrate = 9600
ser.bytesize=serial.SEVENBITS
ser.parity=serial.PARITY_EVEN
ser.stopbits=serial.STOPBITS_ONE
ser.xonxoff=0
ser.rtscts=0
ser.timeout=20
ser.port="/dev/P1poort"         # zelf aangemaakt poortnaam in /etc/udev/rules.d/99-input.rules --> Toegevoegde regel: SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A9YLNWZ7", SYMLINK+="P1poort"           # ATTRS{serial}=="A9YLNWZ7" opgevraagd met commando: udevadm info -a -n /dev/ttyUSB0 | grep '{serial}' | head -n1

What can cause this problem?
Is there a work around to activate the USB port again without shutting down the RPI?
Thanks in advance

Re: USB port not always recognized

Posted: Sat Feb 18, 2017 6:56 pm
by topguy
We have had a few similar requests earlier on the forum, as far as I remember there is no way of controlling the power output on the usb ports.
Does the problem unit have a long cable ?

Re: USB port not always recognized

Posted: Sat Feb 18, 2017 9:11 pm
by Canedje
Thanks topguy.
No only 1 mtr.
What is strange that it only happens to one of the two USB connectors

Re: USB port not always recognized

Posted: Sat Feb 18, 2017 9:28 pm
by MaxK1
Anything show up in dmesg? It could be a bad cable or connector.

Re: USB port not always recognized

Posted: Sat Feb 18, 2017 9:45 pm
by Canedje
Thanks MaxK1.
I don't know the command dmesg.
I executed it and a long list of lines appears.
Until now it says several times:

Code: Select all

[45967.273740] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:14:dd:a9:d1:f8:10:08:00:46:c0:00:20:00:00:40:00:01:02:04:17 SRC=0.0.0.0 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2
[45974.521449] gpiomem-bcm2835 3f200000.gpiomem: gpiomem device opened.
[46034.693528] gpiomem-bcm2835 3f200000.gpiomem: gpiomem device opened.
Your opinion about a bad connector or cable is possible.
I did have some time a lot of problems sevarall days. After that I did clean the connector with contactcleaner and after that there was about a month no problem.
Maybe buying a new cable is an option

Re: USB port not always recognized

Posted: Sat Feb 18, 2017 9:54 pm
by MaxK1
dmesg shows the kernel error/event messages. Very handy for debugging.
But your comment about contact cleaner leads me to think you have a cable problem...