Notifications
Clear all

USB Madness - Linux Mint 21

13 Posts
3 Users
2 Likes
127 Views
hilldweller
(@hilldweller)
Trusted Member
Joined: 2 months ago
Posts: 55
Topic starter  

Two things please - first, months ago I came across a video in which a small Linux incantation cured an intermittent USB connect problem - does this ring a bell, I can't find it now.

 

Second - this is driving me mad. Using Mint 20 I found my old M5Stick would not connect. I believe this is FTDI inside. It just does not appear and $ lsusb hangs until I unplug the M5Stick. I just upgraded to Mint 21. The M5Still will not connect. Any ideas ???

Right now a PICO would not connect until I did a restart. Over the years I've come to the conclusion USB is not up to the stress when hit by "makers" constantly poking it.

The CP210x driver seems very robust.

I am in dialout.

Mint 21 also introduced a new problem, USB connect problem caused by brltty - braile tty that takes over USB port to use it for text to speech. This is easily cured with:

sudo apt-get remove brltty

 


   
Quote
DaveE
(@davee)
Prominent Member
Joined: 2 years ago
Posts: 788
 

Hi @hilldweller,

  Sorry, I don't have a simple answer ... in desperation, I offer a few observations and questions, in the hope it will begin the process of finding a solution.

------------

Is it a failure which affects all USB ports, or maybe all of set of USB ports (as the higher speed ports are often in a separate grouping), or is the port still 'working', but not accepting your M5 device?

----------

  I previously hit the Braille tty problem ... which appears to be because some of the USB to serial adapters have adopted the same 'address' as a Braille device uses, and Ubuntu included the Braillle device in the list of 'already known' addresses. I presume there is a registration process for allocating the addresses, to avoid such clashes. I have my suspicions  that either the Braille system's or the serial adapter's manufacturers didn't follow the procedure, and as to which one it was. (I also suspect the procedure involves money and testing procedures to show that each gizmo is truly USB compatible.)

However, I found the problem by watching the logs as I plugged and unplugged the USB, whereupon I could see at plug-in, the system was attempted to 'install' the new connection, but after a short time (maybe a second?), it aborted and disconnected from it.  I then Googled for some help, and discovered enough to figure out that removing the Braille entry from the tables, would enable it to continue. Your solution looks easier than that, but essentially does the same thing!

----

So, I wondered if you had looked at the logs when plugging the M5 in and out, to see if there were any clues?

If you see something, add it this thread... someone might be able to make sense of it .

You should see at least some activity being recorded.

---

I wouldn't take too much notice of a one-off need for a restart, but a repeatable problem obvously needs a solution. For the moment, I would forget the Pico experience .. unless it keeps happening.

-------

Some USB 'equipment' has trouble with the higher performance USB3.0+ ports ... have you tried it in a USB2.0 port (assuming your computer has both.)  .. or vice versa.

If you have second computer, have you tried it in the other computer?

-------

A quick Google showed this report of all USBs disconnecting intermittently:

www.reddit.com/r/linux/comments/t7pxpk/are_all_of_your_usb_devices_disconnecting/

Also a thread regarding Ryzen processors, though I guess that one doesn't have a simple fix:

www.reddit.com/r/Amd/comments/lqq8p9/how_common_is_the_usb_disconnect_for_ryzen/

(Personally, I have Ryzen based laptop that runs Win 10 perfectly reliably, but intermittently hangs running Ubuntu or Kubuntu. I have a suspicision AMD cut a few corners with Ryzen development, but it is strange that Microsoft seems to know how to get around it.)

--

This post has a suggestion of a bios setting change

https://forums.linuxmint.com/viewtopic.php?t=333920

---------------------

Sorry, this is 100% wafflle, but sometimes a solution emerges from unlikely sources. Hope you can resolve it soon.

Best wishes, Dave

 


   
ReplyQuote
hilldweller
(@hilldweller)
Trusted Member
Joined: 2 months ago
Posts: 55
Topic starter  

Posted by: @davee

Hi @hilldweller,

  Sorry, I don't have a simple answer ... in desperation, I offer a few observations and questions,

No need to be sorry. Every clue is a valuable one.

------------

Is it a failure which affects all USB ports

======================

AH! - remove from one USB3, connect to USB3 hub - it works and usbserial 2 ftdi_sio, sp210x is listed.

 

I should tell you, this old ASUS / Athlon PC is outside this room on the landing to keep it quiet. One USB3 extension, 3m, is used for programming. Second USB extension goes to a hub with mouse/kbd.

I unplug from the hub, plug into previously failed extension and I still have ftdi_sio.

--------------------

So, I wondered if you had looked at the logs when plugging the M5 in and out

===========================

No listing when I plug in the M5 to the "programmer" cable.

Yet the hub has woken the FTDI up for the "programmer" cable.

 

, to see if there were any clues?

If you see something, add it this thread... someone might be able to make sense of it .

You should see at least some activity being recorded.

---

I wouldn't take too much notice of a one-off need for a restart, but a repeatable problem obvously needs a solution. For the moment, I would forget the Pico experience .. unless it keeps happening.

-------

Some USB 'equipment' has trouble with the higher performance USB3.0+ ports ... have you tried it in a USB2.0 port (assuming your computer has both.)  .. or vice versa.

============================

I have just transferred to programming extension to USB2.

 

This post has a suggestion of a bios setting change

https://forums.linuxmint.com/viewtopic.php?t=333920

=========================

I'll look into this. I know compatibility mode is set.

---------------------

Sorry, this is 100% wafflle,

Not at all.

Thinking back, over the many Arduino years, I used to have a hub I plugged in and regularly needed to swap sockets to get the USB back on line. Often I'd get USB1 instead of USB0. Then I thought, "keep hub for mouse/kbd and an single cable for programming. It did not change to pattern of dropped USB.

 

Ah, the Good Old Days when a port said RS232(1) etc.  

 

Thanks Dave. I'm sure we have found a solution but I'll see how things go on the USB connection.

 

A last note: Many times recently I've had to drop the baud rate for ESP32s from 921,600 to 460,800. I was thinking it was an ESP32 issue but maybe it a PC issue. Maybe not, some boards are happy at 921,600. What an incredible speed, I remember the says of sending machining data to a CNC machine at 19,200 baud and thinking it was seriously fast.

 

There can be no doubt, Terminator 1 is just around the corner.

 


   
ReplyQuote
hilldweller
(@hilldweller)
Trusted Member
Joined: 2 months ago
Posts: 55
Topic starter  

The madness continues.....

Reboot. Plug in M5Stick - lsmod | grep usb = usbhid,hid_generic

Move M5 to USB hub - usbhid,hid_generic Nothing changes. FTDI hiding.

Return M5 to USB extension - usbserial ftdi_sio plus the hid line

 

brian@brian-PC ~ $ dmesg | tail -30
[ 924.430213] usbcore: registered new interface driver usbserial_generic
[ 924.430232] usbserial: USB Serial support registered for generic
[ 924.436519] usbcore: registered new interface driver ftdi_sio
[ 924.436535] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 924.436604] ftdi_sio 5-1.4:1.0: FTDI USB Serial Device converter detected
[ 924.436642] usb 5-1.4: Detected FT232BM
[ 924.438248] usb 5-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
[ 975.338461] usb 5-1.4: USB disconnect, device number 5                  < ????????????????? Brian
[ 975.338861] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 975.338911] ftdi_sio 5-1.4:1.0: device disconnected
[ 979.681533] usb 9-1: new full-speed USB device number 10 using xhci_hcd
[ 989.534545] usb 9-1: Device not responding to setup address.
[ 995.125030] [UFW BLOCK] IN=enp5s0 OUT= MAC=01:00:5e:00:00:01:c0:a3:6e:de:04:e1:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=0 DF PROTO=2
[ 999.370095] usb 9-1: Device not responding to setup address.
[ 999.577253] usb 9-1: device not accepting address 10, error -71
[ 999.777329] usb 9-1: new full-speed USB device number 11 using xhci_hcd
[ 1009.633422] usb 9-1: Device not responding to setup address.
[ 1019.470075] usb 9-1: Device not responding to setup address.
[ 1019.676672] usb 9-1: device not accepting address 11, error -71
[ 1019.676971] usb usb9-port1: attempt power cycle
[ 1020.404657] usb 9-1: new full-speed USB device number 12 using xhci_hcd
[ 1030.032784] usb 9-1: Device not responding to setup address.
[ 1039.869298] usb 9-1: Device not responding to setup address.
[ 1040.076229] usb 9-1: device not accepting address 12, error -71
[ 1040.272251] usb 9-1: new full-speed USB device number 13 using xhci_hcd
[ 1049.900736] usb 9-1: Device not responding to setup address.
[ 1059.736958] usb 9-1: Device not responding to setup address.
[ 1059.943797] usb 9-1: device not accepting address 13, error -71
[ 1059.944091] usb usb9-port1: unable to enumerate USB device
[ 1120.116924] [UFW BLOCK] IN=enp5s0 OUT= MAC=01:00:5e:00:00:01:c0:a3:6e:de:04:e1:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=0 DF PROTO=2

 

 


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
 

@hilldweller I am a little unsure what it is you are trying to accomplish. If it's just that you have an unknown USB stick, if it didn't quickly reveal itself to me I would simply toss it, they are after all a dime a dozen these days. If your 'problem' is a USB port in a PC then that is a possible PC repair issue and you should either DIY it or take it in. As a long time international troubleshooter, I live by a couple of sayings, KISS, and 'divide and conquer' Good luck and good hunting.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
hilldweller
(@hilldweller)
Trusted Member
Joined: 2 months ago
Posts: 55
Topic starter  

I can see the confusion - the M5Stick is a lovely, tiny ESP32 based computer with full colour display. It uses an FTDI chip for it's USB interface.

 

It's weakness is a low battery life due to it's small size. It comes with a wrist strap but by the time you've strapped on the battery is half dead.


   
ReplyQuote
DaveE
(@davee)
Prominent Member
Joined: 2 years ago
Posts: 788
 

Hi @hilldweller,

  Sorry, as I can't see your set up, I am getting a bit confused as what is going on. Ron (@zander) is right when he says it is neccesary to keep the situation as simple as possible, and try to divide and conquer one small problem at  a time.

USB protocols usually include some form of flow control, so some of the old RS232 serial data overrun problems when using just Tx, Rx and ground wires, and no Xon/Xoff protocols should not happen between the PC and the USB chip (FTDI, CHxxx, etc). 

Of course the data overrun problems might reappear between the USB chip and the target microcontroller (ESP32, etc), as this typically relies on a simple software handshaking arrangement, as part of the downloader protocol.

USB plugs, sockets and the wires between the plugs are all made to a price and small size, with the result they all fail from time to time. I assume you have done your best to eliminate these from the usual suspects list.

I confess, I tend to use fairly low data rates ... commonly 115,200  Baud ... not because I have to make it work, but simply because it has been quick enough to not be a rate limiting factor, so I have been too lazy to change it. So I can't comment much about the limits of different cards. It should not be an issue regarding the USB PC to USB chip connection.

----------

I don't have any experience of USB extension cables either, but it is a bit of concern. USB was always designed as a short cable solution, so I would suggest you ensure your 3m extension cable is not introducing a problem. It will probably be innocent, but I never assume innocence!

---------

Looking at your log, with the M5 stick, it looks like the USB connection was registered at 924.4 seconds, but disconnected at 975.3 seconds. So what happened in the missing 50 seconds?

The message at 975.3 seconds looks like the PC had a problem ... tend to see "????" when it has crashed, but that maybe my lack of experience at looking at such files on a daily basis.

I realise you were connecting and disconnecting it at some point, but I don't know how that compares with the times.

After it has disconnected at 975.3 seconds, it gets in a tangle trying to reconnect, and whilst I wish I could be confident that it would recover, maybe it isn't that smart.

----------

Possibly another red herring ...

have a look at https://eblot.github.io/pyftdi/installation.html to see what should be in rules.d

   I recall having to venture down there for some reason in the past .. sadly I don't remember the details clearly enough. I have a sneaky feeling these numbers are the same ones that the Braille machine used, but I haven't checked.

----------------------

I just came across this odd one ... log is not the same, but your log looks corrupted, so it might have looked like this before some of it went missing!

https://forums.linuxmint.com/viewtopic.php?t=297367

-------------------

And another odd find on M5stack/stick ... (sorry I don't anything about them)

shows problem fixing problem linux permissions on dialout group ... you probably fixed this long ago

www.youtube.com/watch?v=05GKbdcH92Y

-------------------

In general, I would expect a USB device to have the best chance of working when plugged directly into the PC.  The only exception (maybe) is when the device needs more power than the PC is willing to provide .. then a hub with a higher dc power output might be able to support it. Definitely try to avoid extension leads, etc, whilst trying to get it to work.

---------

Think that is more than enough extra waffle ... see what you can discover ... if you get a bit further, but still stuck, then post again, trying to explain exactly what was happening at the time -  good luck!

Dave


   
ReplyQuote
hilldweller
(@hilldweller)
Trusted Member
Joined: 2 months ago
Posts: 55
Topic starter  

@davee Thanks again Dave.

Lots to go through there, but not tonight.

 

The M5 devices were ( still are ? ) one of the few packaged ESP32/Display units that would look acceptable as terminal in sight. The libraries to drive the display are excellent.


   
DaveE reacted
ReplyQuote
hilldweller
(@hilldweller)
Trusted Member
Joined: 2 months ago
Posts: 55
Topic starter  

Right, day 2 of Dronebot inspired digging. Just focussing on one ESP32 module, the M5Stick with FTDI chip on board.

Boot up, plug in M5 to long USB3:

[ 212.540866] usb 9-2: new full-speed USB device number 2 using xhci_hcd
[ 216.294704] [UFW BLOCK] IN=enp5s0 OUT= MAC=01:00:5e:00:00:01:c0:a3:6e:de:04:e1:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0x00 TTL=1 ID=0 DF PROTO=2
[ 222.393303] usb 9-2: Device not responding to setup address.
[ 232.228820] usb 9-2: Device not responding to setup address.
[ 232.436291] usb 9-2: device not accepting address 2, error -71
[ 232.632475] usb 9-2: new full-speed USB device number 3 using xhci_hcd
[ 242.485022] usb 9-2: Device not responding to setup address.
[ 252.320627] usb 9-2: Device not responding to setup address.
[ 252.527858] usb 9-2: device not accepting address 3, error -71
[ 252.528121] usb usb9-port2: attempt power cycle
[ 253.248066] usb 9-2: new full-speed USB device number 4 using xhci_hcd
[ 262.876854] usb 9-2: Device not responding to setup address.
[ 272.712451] usb 9-2: Device not responding to setup address.
[ 272.919625] usb 9-2: device not accepting address 4, error -71
[ 273.115646] usb 9-2: new full-speed USB device number 5 using xhci_hcd
[ 282.744523] usb 9-2: Device not responding to setup address.
[ 292.580090] usb 9-2: Device not responding to setup address.
[ 292.787095] usb 9-2: device not accepting address 5, error -71

usbhid 65536 0
hid 151552 2 usbhid,hid_generic

USB has spotted something but cannot connect to it. xhci_hcd features a lot.

Unplug long lead from USB3, Reboot.

Plug M5 into same USB3 port on mobo as the long lead was plugged in.

[ 76.290122] usb 9-2: new full-speed USB device number 2 using xhci_hcd
[ 86.142274] usb 9-2: Device not responding to setup address.
[ 96.185615] usb 9-2: device not accepting address 2, error -71
[ 96.381823] usb 9-2: new full-speed USB device number 3 using xhci_hcd
[ 106.233830] usb 9-2: Device not responding to setup address.
[ 116.070447] usb 9-2: Device not responding to setup address.
[ 116.277449] usb 9-2: device not accepting address 3, error -71
[ 116.277951] usb usb9-port2: attempt power cycle
[ 116.997500] usb 9-2: new full-speed USB device number 4 using xhci_hcd
[ 126.626489] usb 9-2: Device not responding to setup address.
[ 136.462105] usb 9-2: Device not responding to setup address.
[ 136.669104] usb 9-2: device not accepting address 4, error -71
[ 136.865112] usb 9-2: new full-speed USB device number 5 using xhci_hcd
[ 146.493499] usb 9-2: Device not responding to setup address.

Without rebooting: Unplug M5, plug long lead into mobo USB2, plug M5 into long lead.

361.920455] usb 3-1: new full-speed USB device number 2 using ohci-pci
[ 362.117563] usb 3-1: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 5.00
[ 362.117576] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 362.117580] usb 3-1: Product: M5Stack Intf
[ 362.117584] usb 3-1: Manufacturer: Kongou Hikari
[ 362.117587] usb 3-1: SerialNumber: 9952E6B245
[ 362.581391] usbcore: registered new interface driver usbserial_generic
[ 362.581411] usbserial: USB Serial support registered for generic
[ 362.585862] usbcore: registered new interface driver ftdi_sio
[ 362.585881] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 362.585969] ftdi_sio 3-1:1.0: FTDI USB Serial Device converter detected
[ 362.586024] usb 3-1: Detected FT232BM
[ 362.588540] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0

Conclusion: FTDI is not compatible with the latest USB3. Now it could be the FTDI chip in the old M5 or it could be the FTDI drivers in Linux kernal.

Thanks to everyone who contributed, all the hints have produced a result. For my part, I did not methodically test every combination of port/lead. I assumed USB3 was totally backward compatible with USB2, this does not seem to be the case right now.

 

Next: Plug in an RP2040zero  ( a brilliant Pico chip, the size of my thumb nail ), run Thonny - no connection and the pico did not boot and run it's neopixel. Damn. Press reset on RP2040 and led flashes, re-enter Thonny and it connects. Was the FTDI driver hanging on to the port ?

Brian.


   
ReplyQuote
DaveE
(@davee)
Prominent Member
Joined: 2 years ago
Posts: 788
 

Hi Brian @hilldweller,

   Looks like you have some progress .. well done!

  I have seen other reports of equipment designed in the USB2 era, not working with USB3 ports.

I think the USB3 ports are supposed to be compatible with USB2 equipment, but obviously it is not always the case.

Which is to blame is unclear ... ie Is it because the USB2 era designed equipment took some 'short cuts' that are ok with USB2 ports, but not USB3 ports, or are the USB3 ports not implemented properly, and don't understand all USB2 equipment? Probably doesn't make much difference if you know how to avoid the problem!!

Similarly, its not clear why the Pico needed some persuasion. Maybe the Linux logs might offer a clue if it happens again?

I have seen some issues when swapping between a ESP32-CAM and clone Mega250 ... usually when I try to download a new program. It isn't a consistent problem ... just one that can sense when it can cause the most annoyance and frustration!

Good luck with your project .. I hope you can make some progress now.

Best wishes, Dave


   
hilldweller reacted
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
 

@davee @hilldweller I doubt it's a backward compat issue, because I only have USB 4 ports on my Mac and I have plugged in many different boards that all work. 

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
hilldweller
(@hilldweller)
Trusted Member
Joined: 2 months ago
Posts: 55
Topic starter  

I was wondering whether to post an update, so.................

All has been wonderful. All the USB devices have been working perfectly.

 

I think the really serious bug was brlltty and I binned some USB leads.

 

I do have USB connector problems, they are not up to the stick we give them, I squirt a little contact cleaner in them.

 


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
 

@hilldweller In that case, go back to your original post and mark it solved.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote