ilvalle
Posts: 20
Joined: Mon Dec 17, 2012 12:51 pm

rpi4 usb issue

Sat Feb 22, 2020 7:33 am

Hi all, I've just switch from rpi2 to rpi4.
As before a wifi usb dongle and a usb hdd is connected to the new rpi, the hdd has its own power supply. As soon as I access the hdd through the wifi, the rpi crash. I don't have any log because the rpi is headless.
what am I missing? is it a kernel issue? something like https://github.com/raspberrypi/firmware/issues/1333?
Is there any option to add to /etc/config.txt ?

I'm running latest kernel.
regards

epoch1970
Posts: 4430
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: rpi4 usb issue

Sat Feb 22, 2020 5:26 pm

Connect via ssh in a separate window and run "tail -F /var/log/syslog" on the Pi.
Then access the drive.
Normally you'll see a trace of the crash.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

ilvalle
Posts: 20
Joined: Mon Dec 17, 2012 12:51 pm

Re: rpi4 usb issue

Sat Feb 22, 2020 7:58 pm

I've tried but nothing. I've also tried from an other host connected via ethernet

User avatar
HawaiianPi
Posts: 5240
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: rpi4 usb issue

Sat Feb 22, 2020 8:54 pm

ilvalle wrote:
Sat Feb 22, 2020 7:33 am
Hi all, I've just switch from rpi2 to rpi4.
As before a wifi usb dongle...
The Pi 4B has built-in WiFi, so why are you using a USB dongle?

What are you using for the Pi4 power supply?

Is it a USB 3.0 HDD, and is the WiFi dongle 2.4GHz?
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25367
Joined: Sat Jul 30, 2011 7:41 pm

Re: rpi4 usb issue

Sat Feb 22, 2020 9:19 pm

That sounds like a power supply problem.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

ilvalle
Posts: 20
Joined: Mon Dec 17, 2012 12:51 pm

Re: rpi4 usb issue

Sat Feb 22, 2020 9:36 pm

Hi there, the power supply is the official one. The built in wifi has no external antenna and is slower.
The crash is not always as soon as the hdd starts, sometimes it happens after few minutes.

ilvalle
Posts: 20
Joined: Mon Dec 17, 2012 12:51 pm

Re: rpi4 usb issue

Mon Feb 24, 2020 5:57 pm

To save some power I run switched the hdmi off with the command below without any better result

Code: Select all

/opt/vc/bin/tvservice -off

sora03
Posts: 246
Joined: Mon Dec 29, 2014 4:11 pm
Location: Philippines
Contact: Website YouTube

Re: rpi4 usb issue

Tue Feb 25, 2020 2:10 pm

can you do a lsusb to determine what is the manufacturer of the usb hdd?
I have a problem but it may or not be related, in my case I encounter a USB overcurrent change error in dmesg which causes the PI to disconnect the HDD and causing I/O errors. Since you have an externally powered HDD, it may not be the issue.

I would try to do the following (save power):

- underclock CPU/GPU
- disable bluetooth via config.txt
- tvservice -o (already done)

To try to detect the issue further:

- stress test the pi using stress-ng
- monitor vcgencmd get_throttled
- do an intensive I/O operations (copy, read)

Pi 4 should not have USB bandwidth issues, in my case Pi2B and Pi3B+ has the USB bandwidth problems when connecting too many USB devices or I/O intensive devices.
Mastodon: https://mastodon.social/@ssora

ilvalle
Posts: 20
Joined: Mon Dec 17, 2012 12:51 pm

Re: rpi4 usb issue

Tue Feb 25, 2020 3:56 pm

Hi sora03,
the same configuration worked with a rpi2 device.
Below few relevant settings I configured

/boot/config.txt

Code: Select all

# Disable the PWR LED
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off

# Disable the Activity LED
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

#Disable bluetooth & wifi
dtoverlay=disable-bt
dtoverlay=disable-wifi

rc.local

Code: Select all

echo none > /sys/class/leds/led1/trigger
echo none >  /sys/class/leds/ath9k_htc-phy0/trigger


hdparm -B127 /dev/sda

/opt/vc/bin/tvservice -off

echo "powersave" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

lsusb

Code: Select all

Bus 002 Device 002: ID 1234:5678 Brain Actuated Technologies 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0cf3:9271 Qualcomm Atheros Communications AR9271 802.11n
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
/etc/modprobe.d/ath9k.conf

Code: Select all

options ath9k_htc nohwcrypt=1 ps_enable=0 btcoex_enable=0 blink=0
The hdd is this one https://www.amazon.it/Raidsonic-Sistema ... 882&sr=8-6

sora03
Posts: 246
Joined: Mon Dec 29, 2014 4:11 pm
Location: Philippines
Contact: Website YouTube

Re: rpi4 usb issue

Thu Feb 27, 2020 2:35 pm

Are you sure that the command suggested by epoch1970 does not yield results?
This command specifically:
On your PC open an SSH session to your pi and execute this command,, so we can trace the Pi crash:

Code: Select all

sudo tail -F /var/log/messages
This command will stream dmesg until you encounter your problem, it will log the last message including the error. Like a blackbox of an airplane (I may have exaggerated).

Can you also post the dmesg log of your Pi, since you are using a VIA Labs USB to SATA are not having problems with usb quirks?

Can you try to underclock the Pi using /boot/config.txt to check if it still crashes.

Code: Select all

arm_freq=1000
arm_freq_min=100
Do you have watchdog installed?

Can you try to use the Pi without HDD just the built in microSD card?

Is it when you do an intensive input/output operations does the pi crash? (eg. writing large files/copying large files)

I do not know what does hdparm -B27 command does, perhaps spinning disk down or up may cause a problem.

Check all of your USB cables.
Mastodon: https://mastodon.social/@ssora

ilvalle
Posts: 20
Joined: Mon Dec 17, 2012 12:51 pm

Re: rpi4 usb issue

Thu Feb 27, 2020 6:52 pm

Hi, I'm sure no message from ssh before the crash. Tested a couple of times with a pc connected via eth0.
spinning down the hdd is necessary during the day, the night and all those hours when no one is at home.

Accessing the hdd via eth0 works without issue, ~30MB/s.

I haven't tested to underclock the pi, although setting the scaling_governor to powersave block the frequency at 600Mhz.
Yes, the crash happen when there is input/output traffic, most of the times when the phone sends the new file/photo to the rpi to be saved in the hdd.

sora03
Posts: 246
Joined: Mon Dec 29, 2014 4:11 pm
Location: Philippines
Contact: Website YouTube

Re: rpi4 usb issue

Fri Feb 28, 2020 12:11 am

ilvalle wrote:
Thu Feb 27, 2020 6:52 pm
Hi, I'm sure no message from ssh before the crash. Tested a couple of times with a pc connected via eth0.
spinning down the hdd is necessary during the day, the night and all those hours when no one is at home.

Accessing the hdd via eth0 works without issue, ~30MB/s.

I haven't tested to underclock the pi, although setting the scaling_governor to powersave block the frequency at 600Mhz.
Yes, the crash happen when there is input/output traffic, most of the times when the phone sends the new file/photo to the rpi to be saved in the hdd.
Try to also change the governor to conserve instead of powersave. I've had problems with high I/O disconnecting my USB HDD but this was fixed by using an external powered hub, (in my case).
Mastodon: https://mastodon.social/@ssora

Eng
Posts: 1
Joined: Sat Feb 29, 2020 2:15 am

Re: rpi4 usb issue

Sat Feb 29, 2020 2:33 am

I have a similar problem before and I spent a lot of time before I found a solution to this problem, try to add this line to `config.txt`:

over_voltage=1

Please, check and let me know is it works for you or not.

ilvalle
Posts: 20
Joined: Mon Dec 17, 2012 12:51 pm

Re: rpi4 usb issue

Sat Feb 29, 2020 7:31 am

Hi @sora03. I moved the HDD to the usb2 port and switched to conservative the scaling governor. The rpi crashed after few minutes, before was crashing after few seconds.

Return to “Troubleshooting”