RasPi – USB microphone locks up

lockraspberry piusb-audio

On my RasPi board, Debian Linux, the USB microphone occasionally gets locked up such that nothing can use it. The microphone has a LED which is usually flashing, when it's locked, it turns off.

The utility arecord describes it as follows:

card 1: Device [DYNEX USB MIC Device], device 0:USB Audio [USB Audio]
    Subdevices: 1/1
    Subdevice #0: subdevice #0

When the microphone stops working, arecord gives diagnostics like this:

> arecord -D plughw:1,0 > recording.wav
Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
arecord: set_params:1145: Unable to install hw_params:
ACCESS:  RW_INTERLEAVED
FORMAT:  U8
etc...

Unplugging and plugging the microphone fixes it, only because the current dip forces the RasPi to reboot! Not an ideal situation.

Is there a way to fix this from the command line or a C executable?

I also tried using ioctl(fd, USBDEVFS_RESET, 0) using the output from lsusb to provide the bus and device number. That turns the LED back on, but it's overkill. The device has to be re-setup using alsamixer.

Best Answer

This is easy to solve.

Issue: Your microphone is not getting enough power. The Raspberry Pi USB ports have issues supplying enough amps to USB devices that need more than power than USB memory cards.

Solution: Get an active USB hub (powered hub plugged into a power source like an outlet.) The hub will power the microphone.