USB device crashes Pi4/RasPiOS

Jan 07, 2024 Last reply: 2 years ago 28 Replies

From time to time my Pi 4 running



Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux



crashes when a USB device is plugged into it. The Pi4 boots from a usb3 mechanical disk.



Usually the culprit is a storage device, but an FT232-based usb-serial adapter did it also. The first symptom is an unresponsive menu bar and report about I/O error on the command line. The palsy grows over a few minutes as the mouse stops tracking. By that time there's nothing to do but cycle power.



Plugged into a Windows 10 box the usb-serial adapter is recognized just fine. I haven't been able to find a terminal emulator for Win



10 to test it further, but I suspect it's ok.

This behavior is relatively new, sometime in the last six months or so. I don't remember it in the distant past. If I plug in a camera it's recognized without difficulty.



Anybody else seen this sort of behavior or have a hint what to do?



Thanks for reading,



bob prohaska


What I am about to describe may be an unrelated phenomenon:

I run a Pi4b in the Official Case with the Official Fan. [I don't recommend that fan to anyone. It does not get much airflow unless the case is propped open.]

The operation of the fan tends to build up a static charge throughout the case's environment. When a USB device is plugged in, there is often a brief static discharge, which can have an undesirable effect on the Pi. I might get a screen glitch or a hang or a crash or a reboot,

I alleviate this problem by using an old unpowered Radio Shack USB hub. This minimizes static buildup, and keeps any potential discharge some distance from the Pi's circuit board.

What does:

sudo dmesg

say immediately after you plug it in? You can print the last 30 lines with:

sudo dmesg | tail -30

It seems like the USB serial adapter wedges the USB subsystem, which is problematic given your root filesystem is also on USB storage. The storage stops responding, and over time programs get increasingly unhappy that their storage is not functioning.

Another thing to try is to plug the serial adapter into a USB2 port, which is a different controller on the Pi4 from the USB storage. Maybe that won't break the storage?

Theo

So either all USB is blocked, or the USB disk with the root FS stops responding.

This might be a power issue. Mechanical disks pull a lot of power, and unless it is a 1.8" drive this is often more than the 500mA allowed on USB2.0 ports.

Make sure the power supply for the Pi can handle the (peak) load without voltage drops. Aging power supplies and cables/connectors with bad contact can cause slowly increasing problems.

You might try putting a self-powered USB hub (with its own power supply) between the Pi and the disk and see if that changes anything.

cu Michael

Maybe. My Pi4 lives in a CanaKit (or similar) case with a little

5v fan running on 3.3 volts. There's certainly not enough zap to make a noise, I've not been watching the display at the moment of plug-in.

It also lets the usb subsystem recognize the hub as a separate object, apart from the thing you actually want to connect. I.E., it enumerates the hub, then enumerates the device. not both at once. Dunno if that matters, but I'd think not.

You've raised an interesting point. I've noticed that if I put a microSD card in a USB adapter and plug it into the pi, the pi crashes. If I plug the adapter into the Pi and then plug the card into the adapter, it works fine. Hubs are not the same as adapters, but there's a whiff of similarity.

Thanks for writing!

bob prohaska

It says "I/O error", or words to that effect, in any shell prompt. Enter produces a CR/LF combo and repeats the prompt, but any typing provokes the I/O error message.

Yes, that's my thinking too.

That's what I did, sorry if it wasn't clear. There is a keyboard on USB2, so there's still potential for interaction and maybe the "I/O error" is in reference to the keyboard input. Likewise, the mouse hangs off a hub in the keyboard, so clicking on an icon produces a similar effect..

You've brought up something that never crossed my mind. I've been thinking "disk i/o", maybe it's "keyboard i/o" being reported.

Either way, it seems like a bug, except that few see it. Strange.

Thanks for writing

[snip]

I've found that my RPi Zeros tend to reboot when a USB device is plugged in. I presume it's a power issue to do with the wimpy 600mA USB plugpacks that I power them from, but as I mainly just have a wireless keyboard/mouse receiver pluged in all the time it doesn't worry me much. It could also be that the tracks on the PCB are too narrow and dropping too much voltage due to resistance during the surge when a device is connected, in which case you might want a PSU that outputs nearer to the maximum safe input voltage for the Pi (5.25V? 5.5V? I'm not sure if they've specified this).

The camera likely is powered by its own battery and only uses USB for I/O, so with that working every time it definately suggests a power issue.

Buy a pack of bubble-gum ... the foil/paper wrapper for each stick can be teased into its component parts. The ultra-thin foil is slightly sticky. Stick it all over the inside of the case (we used to stick 'em to school desks back in the day) by rubbing it on with a bit of hard wood or something of similar characteristics. A pencil worked for the school desks.

Weave in a fine wire that touches both the ground plane of the Pi and the foil in the case. Doesn't have to be a super-good soldered connection.

If you use WiFi then maybe leave the upper 1/3rd of the case un-foiled around where the WiFi antenna thingie is. An all-metal case would work for the static, but will block a lot of the WiFi signal.

This should safely drain-off static charge.

Apparently you live in a VERY dry area - always a prob for electronics. Hell, lived in a US western town high in the mountains for awhile. In the winter you could easily draw a 4-inch spark off a door-knob just by walking across a carpet first. Guess that's about a 200,000 volts or so. Actually HURT ! You learned to lead with a knuckle ....

Oh yea, Pi-compatible fans ... they mostly ARE crap. Lucky if you can go 6-months before the bearing goes and they start making noise. OTOH, they only cost a couple of dollars ........

Alternatively buy a roll of copper or aluminium tape, both are easily available.

You can buy adhesive backed copper foil, made for sheilding electric guitars and similar quite cheaply - and its a cinch to solder to it to earth it

That's why I only use solid body aluminium cases with my Pi3s and Pi4s, no fan needed. Don't know if this is still possible with the Pi5, though.

-jw-

I would tightly grip a key and draw the spark off it.

Or, if you can find an old pen body with a metal upper half and a plastic lower half, put a NE2 neon light bulb poking out of the top end. Connect one side of the bulb to the metal upper body half. Through a current-limiting series resistor, connect the other end to a metal protrusion from the tip of the pen. If I remember correctly, under the right conditions the charge will run the bulb for a couple of seconds. (It was ~50 years ago when I did that.)

In a pinch, a ring or metal watchband can also do the job.

HTH

Aluminum and/or stainless-steel tape is often sold at automotive parts stores. Not gonna say what the nickname for it may be. Copper tape ... never seen it in the USA in retail stores (can be had from electronics suppliers like Mouser or Digi-Key).

Either would be fairly effective for the OPs problem, but the bubble-gum solution is More Fun ! :-)

There is also conductive PAINT ...

formatting link
... which should also drain-off pesky static.

In any case, the OP seems to live in an EXTREMELY dry environment. Surprised he doesn't lose devices all the time.

Yep ... but WHERE ? Never seen it on a shelf in the USA. Is it more common in the UK perhaps ? For what use ?

However aluminum/SS tape is more readily found in retail locations. Problem is that you can't solder to it. However even a "spring" connection will serve. Conductive paint can be had too, but only from electronics suppliers.

Aluminium tape is sold in builder's merchants for taping insulation boards for air tightness (I used several rolls of it insulating my house), it also sometimes gets used to seal air duct joins.

It can sometimes be found in garden centres as gardeners use it for slug/snail repellent, it is also used for making stained glass and repairing electrical toys like Scalextric track. Copper tape comes in a very wide variety of widths unlike aluminium tape, I have 6mm, 10mm and 50mm rolls to hand.

Amazon (easiest), a good electronics parts retailer (OK they're hens teeth these days) or a good garden centre.

This is quite possible. Especially if the widget you plug in has a big decoupling capacitor, it could take a current spike which causes the supply voltage to drop out momentarily and could upset further communications.

One thing to try would be to put the widget behind a powered hub. Plug the widget into the hub, make sure the hub power is on, then plug the hub into the Pi. That way there will be no increased power loading on the Pi as the widget is plugged in.

Theo

Probably not on shelves here, nowadays for anything useful you tend to have to buy online

Slug repellent, stained glass work, EMI shielding, lining guitar cavity ...

Shielding electric guitars. I got mine from amazon. Here in the UK we don't have 'shelves' except in online suppliers warehouse, and food supermarkets.

formatting link
Aluminium foil sticky tape is used to vapour seal foil covered insulation so a builders merchant will stock it

formatting link

You *can* solder to aluminium,. You just need the right flux, And breathing apparatus!

The one I used is UK specific. Made by Carrs. keep a window open though.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required