USB port not always recognized
Posted: Sat Feb 18, 2017 9:31 am
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:
What can cause this problem?
Is there a work around to activate the USB port again without shutting down the RPI?
Thanks in advance
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
Is there a work around to activate the USB port again without shutting down the RPI?
Thanks in advance