I tried plugging two flash drives into a Raspberry Pi 4B one after another but the Pi does not seem to detect any of the drives. Here is the dmesg output
[ 177.737328] cpu cpu0: dev_pm_opp_set_rate: failed to find current OPP for freq 4294967186 (-34)
[ 180.446246] raspberrypi-clk soc:firmware:clocks: Failed to change fw-clk-arm frequency: -110
[ 181.036364] xhci_hcd 0000:01:00.0: Abort failed to stop command ring: -110
[ 181.052412] xhci_hcd 0000:01:00.0: Host halt failed, -110
[ 181.052421] xhci_hcd 0000:01:00.0: xHCI host controller not responding, assume dead
[ 181.052446] xhci_hcd 0000:01:00.0: HC died; cleaning up [ 181.052645] xhci_hcd 0000:01:00.0: Timeout while waiting for setup device command
[ 181.053349] usb 1-1: USB disconnect, device number 2
[ 181.536432] usb 1-1.3: device not accepting address 5, error -108
[ 181.536608] usb 1-1-port3: couldn't allocate usb_device
Any help is appreciated. Thanks in advance
USB problems in RPi typically happens because of a corrupted kernel, try to update it then give me a feedback.
Am trying to understand USB PCI MMIO and am using QEMU as a playgroud.
The following devices are on my VM,
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03) (prog-if 00 [UHCI])
Subsystem: Red Hat, Inc. QEMU Virtual Machine
Flags: bus master, fast devsel, latency 0, IRQ 16
I/O ports at c0a0 [size=32]
Kernel driver in use: uhci_hcd
00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03) (prog-if 00 [UHCI])
Subsystem: Red Hat, Inc. QEMU Virtual Machine
Flags: bus master, fast devsel, latency 0, IRQ 17
I/O ports at c0c0 [size=32]
Kernel driver in use: uhci_hcd
00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03) (prog-if 00 [UHCI])
Subsystem: Red Hat, Inc. QEMU Virtual Machine
Flags: bus master, fast devsel, latency 0, IRQ 18
I/O ports at c0e0 [size=32]
Kernel driver in use: uhci_hcd
00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03) (prog-if 20 [EHCI])
Subsystem: Red Hat, Inc. QEMU Virtual Machine
Flags: bus master, fast devsel, latency 0, IRQ 19
Memory at fc072000 (32-bit, non-prefetchable) [size=4K]
Kernel driver in use: ehci-pci
And the following code,
int fd = open("/sys/devices/pci0000:00/0000:00:1d.7/resource0", O_RDWR | O_SYNC);
int mmio = mmap(0, 0x100, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
iopl(3);
outl(0, 0xc0a0);
If I do not include outl(0, 0xc0a0); it seems that any writes to the MMIO address space will not trigger anything.
Looking to try and understand what exactly does outl(0, 0xc0a0); achieve.
outl() writes data. In your code no other function writes to I/O except outl()
https://linux.die.net/man/2/outl
If you want to know more internals about outl use gdb and disassemble it https://gist.github.com/jarun/ea47cc31f1b482d5586138472139d090
https://man7.org/linux/man-pages/man2/iopl.2.html
I'm using a udev rule to automount USB flash drives on my Raspberry Pi. I found this solution few months ago and I worked very well until I start using Raspbian Stretch lite.
KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
# Global mount options
ACTION=="add", ENV{mount_options}="relatime"
# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="\$env{mount_options},utf8,gid=100,umask=002"
# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/usbstick", RUN+="/bin/mount -o \$env{mount_options} /dev/%k /media/usbstick"
# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/usbstick", RUN+="/bin/rmdir /media/usbstick"
# Exit
LABEL="media_by_label_auto_mount_end"
And here is what I see in dmesg
[ 524.042731] usb 1-1.4: new high-speed USB device number 6 using dwc_otg
[ 524.174634] usb 1-1.4: New USB device found, idVendor=090c, idProduct=1000
[ 524.174649] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 524.174658] usb 1-1.4: Product: Flash Disk
[ 524.174666] usb 1-1.4: Manufacturer: USB
[ 524.174674] usb 1-1.4: SerialNumber: SCY0000000105542
[ 524.175515] usb-storage 1-1.4:1.0: USB Mass Storage device detected
[ 524.175994] scsi host0: usb-storage 1-1.4:1.0
[ 525.399056] scsi 0:0:0:0: Direct-Access USB Flash Disk 1100 PQ: 0 ANSI: 4
[ 525.399986] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 525.400243] sd 0:0:0:0: [sda] 15974400 512-byte logical blocks: (8.18 GB/7.62 GiB)
[ 525.401232] sd 0:0:0:0: [sda] Write Protect is off
[ 525.401259] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 525.401948] sd 0:0:0:0: [sda] No Caching mode page found
[ 525.401965] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 525.415578] sda: sda1
[ 525.418642] sd 0:0:0:0: [sda] Attached SCSI removable disk
Do anybody has a similar solution that works with Raspbian Stretch lite?
I finally got a USB DAC (HiFimeDIY Sabre DAC) for my Raspberry Pi (running on Raspbian Wheezy) today, but of course, just plugging it in doesn't do the trick. I've been messing around for quite some time with ALSA configuration now, but to no avail. Audio playback through the 3.5" headphone jack works just fine, but I can't seem to get the audio to play through USB. aplay -L gives
pi#raspberrypi ~ $ aplay -L
...
pulse
Playback/recording through the PulseAudio sound server
sysdefault:CARD=DAC
HiFimeDIY DAC, USB Audio
Default Audio Device
front:CARD=DAC
HiFimeDIY DAC, USB Audio
Default Audio Device
...
sysdefault:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
front:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
I wonder if both cards being marked as "Default Audio Device" is a good thing?
Anyways, testing playback via
pi#raspberrypi ~ $ aplay /usr/share/sounds/alsa/Front_Center.wav -D sysdefault:CARD=ALSA
Playback: WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate: 48000 Hz, mono
works fine, but
pi#raspberrypi ~ $ aplay /usr/share/sounds/alsa/Front_Center.wav -D sysdefault:CARD=DAC
ALSA lib pcm_direct.c:980:(snd1_pcm_direct_initialize_slave) unable to install hw params
ALSA lib pcm_dmix.c:1030:(snd_pcm_dmix_open) unable to initialize slave
aplay: main:682: Fehler beim Öffnen des Gerätes: Datenübergabe unterbrochen (broken pipe)
(Sry for german, it says something like Error while opening device: data stream interrupted)
My /etc/asound.conf looks as follows:
pcm.!default {
type hw
card 0
device 0
}
and /etc/modprobe.d/alsa-base.conf has the following entries:
# Keep snd-usb-audio from beeing loaded as first soundcard
options snd-usb-audio index=0
options snd_bcm2835 index=1
What am I doing wrong? Help would be much appreciated!
Edit:
Systemlog says the following:
Nov 7 18:30:29 raspberrypi kernel: [ 2.534311] usb 1-1: new full-speed USB device number 2 using dwc_otg
Nov 7 18:30:29 raspberrypi kernel: [ 2.546658] Indeed it is in host mode hprt0 = 00021501
Nov 7 18:30:29 raspberrypi kernel: [ 2.752653] usb 1-1: not running at top speed; connect to a high speed hub
Nov 7 18:30:29 raspberrypi kernel: [ 2.765131] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
Nov 7 18:30:29 raspberrypi kernel: [ 2.776874] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber$
Nov 7 18:30:29 raspberrypi kernel: [ 2.790194] hub 1-1:1.0: USB hub found
Nov 7 18:30:29 raspberrypi kernel: [ 2.799746] hub 1-1:1.0: 5 ports detected
Nov 7 18:30:29 raspberrypi kernel: [ 3.082453] usb 1-1.1: new full-speed USB device number 3 using dwc_otg
Nov 7 18:30:29 raspberrypi kernel: [ 3.192745] usb 1-1.1: not running at top speed; connect to a high speed hub
Nov 7 18:30:29 raspberrypi kernel: [ 3.205857] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
Nov 7 18:30:29 raspberrypi kernel: [ 3.218650] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumb$
Nov 7 18:30:29 raspberrypi kernel: [ 3.239311] smsc95xx v1.0.4
...
Nov 7 18:30:29 raspberrypi kernel: [ 3.308141] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb$
Nov 7 18:30:29 raspberrypi kernel: [ 3.432526] usb 1-1.3: new full-speed USB device number 4 using dwc_otg
Nov 7 18:30:29 raspberrypi kernel: [ 3.626813] usb 1-1.3: New USB device found, idVendor=1852, idProduct=7022
Nov 7 18:30:29 raspberrypi kernel: [ 3.647601] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumb$
Nov 7 18:30:29 raspberrypi kernel: [ 3.664695] usb 1-1.3: Product: HiFimeDIY DAC
Nov 7 18:30:29 raspberrypi kernel: [ 3.676431] usb 1-1.3: Manufacturer: HiFimeDIY Audio
Nov 7 18:30:29 raspberrypi kernel: [ 3.703597] input: HiFimeDIY Audio HiFimeDIY DAC as /devices/platform/bcm27$
Nov 7 18:30:29 raspberrypi kernel: [ 3.721606] hid-generic 0003:1852:7022.0001: input,hidraw0: USB HID v1.00 D$
Nov 7 18:30:29 raspberrypi kernel: [ 7.529882] usbcore: registered new interface driver snd-usb-audio
but as soon as the boot process is finished, I get this a jillion times in a row:
Nov 7 18:30:38 raspberrypi kernel: [ 41.221205] INFO:: schedule_periodic: Insufficient periodic bandwidth for p$
Nov 7 18:30:38 raspberrypi kernel: [ 41.221205]
Nov 7 18:30:38 raspberrypi kernel: [ 41.221261] ERROR::dwc_otg_hcd_urb_enqueue:544: DWC OTG HCD URB Enqueue fai$
Nov 7 18:30:38 raspberrypi kernel: [ 41.221261]
Nov 7 18:30:38 raspberrypi kernel: [ 41.221288] cannot submit urb 0, error -1: unknown error
Also:
Nov 7 18:45:21 raspberrypi kernel: [ 861.969647] bcm2835_audio_set_ctls:558 Controls set for stream 0
Nov 7 18:47:58 raspberrypi pulseaudio[2390]: [pulseaudio] module-always-sink.c: Unable to load module-null-sink
and
Nov 7 18:48:46 raspberrypi pulseaudio[2494]: [pulseaudio] module-udev-detect.c: Tried to configure /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.1/sound/card0 (alsa_card.usb-HiFimeDIY_Audio_HiFimeDIY_DAC-01-DAC) more often than 5 times in 10 seconds
Edit 2:
Contents of /proc/asound/card0/stream0 are
HiFimeDIY Audio HiFimeDIY DAC at usb-bcm2708_usb-1.3, full speed : USB Audio
Playback:
Status: Stop
Interface 3
Altset 1
Format: S16_LE
Channels: 2
Endpoint: 3 OUT (ADAPTIVE)
Rates: 8000, 16000, 32000, 44100, 48000, 96000
Interface 3
Altset 2
Format: S24_3LE
Channels: 2
Endpoint: 3 OUT (ADAPTIVE)
Rates: 8000, 16000, 32000, 44100, 48000, 96000
Capture:
Status: Stop
Interface 2
Altset 1
Format: S16_LE
Channels: 2
Endpoint: 2 IN (ADAPTIVE)
Rates: 8000, 16000, 32000, 44100, 48000, 96000
Interface 2
Altset 2
Format: S24_3LE
Channels: 2
Endpoint: 2 IN (ADAPTIVE)
Rates: 8000, 16000, 32000, 44100, 48000, 96000
Every time I want to force sound through the USB card (below I set it to be the default audio device in .asoundrc)I get
pi#raspberrypi ~ $ aplay piano2.wav
Wiedergabe: WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate: 48000 Hz, stereo
aplay: set_params:1145: Fehler beim Setzen der Hardware-Parameter:
ACCESS: RW_INTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 48000
PERIOD_TIME: 125000
PERIOD_SIZE: 6000
PERIOD_BYTES: 24000
PERIODS: 4
BUFFER_TIME: 500000
BUFFER_SIZE: 24000
BUFFER_BYTES: 96000
TICK_TIME: 0
(the german part says "aplay: set_params:1145: unable to install hw params:).
Additionally, aplay -L still gives me
Karte 0: DAC [HiFimeDIY DAC], Gerät 0: USB Audio [USB Audio]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 0: DAC [HiFimeDIY DAC], Gerät 1: USB Audio [USB Audio #1]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
and when I use aplay -D hw:0,1 sound.wav, playback seems to work (no error message is thrown out), but I can't hear anything at all. Is Card 0,1 the recording device? If I use onboard sound, everything works fine. I'm not using a usb hub (DAC is plugged directly into the pi). Might this be a power issue?
lsusb has
pi#raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 1852:7022 GYROCOM C&C Co., LTD
At the moment, a printer is plugged in (switched off though) and unplugging it changes nothing, lsusb still shows the same devices (I'm wondering why there are 4 and 3 of them different, while the Pi only has 2 ports, in one of which is the DAC). When the pi is starting up and the speakers are plugged into the DAC, I get a couple crackles, just like when they are plugged into the headphone jack.
Even i faced the similar issue.
Possible solution :
Check the kernel configs ( zcat /proc/config.gz | grep 'CONFIG_FW_LOADER' ). If that config is not enabled then try to build a kernel with this config enabled.
I tried similar approach across the different kernel for the same ROOT FILE SYSTEM, then checked for the configs i found out the above solution.
Thanks and Regards,
Sandesh K A
Let me know if this solution worked for you.
A while ago, I was experiencing the same issue. I've manage to fix it by double checking the config files. In my case, I've run alsa mixer after i've configured ~/.asoundrc. By running the alsa mixer / unplugging the usb, alsa automatically updates ~/.asoundrc file. Hence, overwritten my previous config.
Make sure that your changes in conf file are still in place before trying again. I hope this works on you as well.
Set up Raspberry Pi 3 USB mic ( creative sound blaster )
I am trying to boot VxWOrks using tftp for zynq.
I have set the enviroment varibles for ipaddr, serverip, netmask accordingly and files are loaded in RAM succesfully. however, i get the following error when trying to boot the vxWorks image. There is not problem with the VxWOrks image as i can successfully boot with these iamges when i write these files to SDcard and boot from the sdcard
zynq-uboot> bootm 0x5000000 - 0x4000000
#ERROR: booting os 'Unknown OS' (14) is not supported"
Here is a complete screen shot
zynq-uboot> setenv ipaddr 192.168.88.169;setenv serverip 192.168.88.88;setenv netmask 255.255.255.0
zynq-uboot> tftp 0x8000000 BOOT.bin
Trying to set up GEM link...
Phy ID: 01410E40
Resetting PHY...
PHY reset complete.
Waiting for PHY to complete auto-negotiation...
Link is now at 1000Mbps!
Using zynq_gem device
TFTP from server 192.168.88.88; our IP address is 192.168.88.169
Filename 'BOOT.bin'.
Load address: 0x8000000
Loading: T ########################
done
Bytes transferred = 345180 (5445c hex)
zynq-uboot> tftp 0x5000000 uVxWorks && tftp 0x4000000 zynq-7000.dtb
Using zynq_gem device
TFTP from server 192.168.88.88; our IP address is 192.168.88.169
Filename 'uVxWorks'.
Load address: 0x5000000
Loading: T T #################################################################
#################################################################
###############################################################
done
Bytes transferred = 2829468 (2b2c9c hex)
Using zynq_gem device
TFTP from server 192.168.88.88; our IP address is 192.168.88.169
Filename 'zynq-7000.dtb'.
Load address: 0x4000000
Loading: #
done
Bytes transferred = 3588 (e04 hex)
zynq-uboot> bootm 0x5000000 - 0x4000000
## Booting kernel from Legacy Image at 05000000 ...
Image Name: vxWorks
Image Type: ARM Unknown OS Kernel Image (uncompressed)
Data Size: 2829404 Bytes = 2.7 MiB
Load Address: 00200000
Entry Point: 00200000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
ERROR: booting os 'Unknown OS' (14) is not supported
zynq-uboot> <INTERRUPT>
SOlution:
i had to to load the vxWorks.bin as well and it worked.
zynq-uboot> tftp 0x200000 vxWorks.bin