This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Audio playback via USB Audio device does not work at the second playback with BeagleBone Black + SDK 07.00.00.00.



When I execute audio playback using aplay via USB Audio device works fine at the first time from boot.
Once playback is ended / interrupted, then aplay is executed again, audio playback failed high probability with the log:
aplay: pcm_write:1737: write error: Input/output error
Once this situation occurs, the situation does not recover until the BeagleBone Black is rebooted.
I've never meet this with built-in Angstrom or Ubuntu 14.04LTS, so I think this is TI SDK specific fault.

Condition:
- BeagleBone Black RevB
- TI SDK: 07.00.00.00
- kernel configures
- enable IPv6, enable dynamic printk() support
# uname -a
Linux am335x-evm 3.12.10-ti2013.12.01 #2 Tue Jun 10 09:58:35 JST 2014 armv7l GNU/Linux
- BeagleBone Black is powered via AC adapter.
- USB Audio device:
- Roland UA-30 (Bus powered)
- I've checked some other USB Audio devices, but the result is the same.

Steps for reproduction:
- Connect USB Audio device before power on the BealgeBone Black.
(does not depend whether the USB audio device is connected before / after the boot)
- Execute aplay like:
# aplay -D hw:0,0 tmp.wav
- Sound playback is successfully executed.
- Wait until playback is ended or terminate aplay by Ctrl-C.
- Execute aplay again.

Result:
- No sounds from USB audio device.
- After 10 or more seconds, aplay is terminated with the following log.
aplay: pcm_write:1737: write error: Input/output error

- The following log is displayed in dmesg.
[ 126.021612] ALSA sound/core/pcm_lib.c:1945 playback write error (DMA or IRQ trouble?)

- When I terminate aplay by Ctrl-C during the situation, sometime the following messages are displayed.
[ 127.882758] ------------[ cut here ]------------
[ 127.890291] WARNING: CPU: 0 PID: 1448 at drivers/dma/cppi41.c:605 cppi41_dma_control+0x29c/0x2e4()
[ 127.899688] Modules linked in: g_mass_storage usb_f_mass_storage libcomposite configfs snd_usb_audio snd_hwdep snd_usbmidi_lib snd_soc_omap snd_pcm_dmaengine snd_rawmidi snd_soc_core regmap_spi snd_compress musb_dsps snd_pcm musb_hdrc snd_timer snd soundcore snd_page_alloc musb_am335x
[ 127.926228] CPU: 0 PID: 1448 Comm: aplay Tainted: G W O 3.12.10-ti2013.12.01 #1
[ 127.934622] Backtrace:
[ 127.937197] [<c0017880>] (dump_backtrace+0x0/0x10c) from [<c0017a1c>] (show_stack+0x18/0x1c)
[ 127.946046] r6:c02f4dfc r5:00000009 r4:00000000 r3:00000000
[ 127.952000] [<c0017a04>] (show_stack+0x0/0x1c) from [<c059e9fc>] (dump_stack+0x20/0x28)
[ 127.960405] [<c059e9dc>] (dump_stack+0x0/0x28) from [<c0046d08>] (warn_slowpath_common+0x70/0x90)
[ 127.969716] [<c0046c98>] (warn_slowpath_common+0x0/0x90) from [<c0046d4c>] (warn_slowpath_null+0x24/0x2c)
[ 127.979748] r8:0000003c r7:00000018 r6:00000051 r5:dba7dc00 r4:dba7c4c0
[ 127.986798] [<c0046d28>] (warn_slowpath_null+0x0/0x2c) from [<c02f4dfc>] (cppi41_dma_control+0x29c/0x2e4)
[ 127.996881] [<c02f4b60>] (cppi41_dma_control+0x0/0x2e4) from [<bf037d74>] (cppi41_dma_channel_abort+0xc4/0x130 [musb_hdrc])
[ 128.008586] [<bf037cb0>] (cppi41_dma_channel_abort+0x0/0x130 [musb_hdrc]) from [<bf033740>] (musb_cleanup_urb+0x48/0xf8 [musb_hdrc])
[ 128.021080] r8:dbe4c010 r7:dc7fa7f4 r6:ddb880c0 r5:e09e0da0 r4:dbe4ca90r3:bf037cb0
[ 128.029338] [<bf0336f8>] (musb_cleanup_urb+0x0/0xf8 [musb_hdrc]) from [<bf033900>] (musb_urb_dequeue+0x110/0x124 [musb_hdrc])
[ 128.041216] [<bf0337f0>] (musb_urb_dequeue+0x0/0x124 [musb_hdrc]) from [<c03e1c20>] (unlink1+0x34/0x10c)
[ 128.051165] [<c03e1bec>] (unlink1+0x0/0x10c) from [<c03e3184>] (usb_hcd_unlink_urb+0x60/0x7c)
[ 128.060112] [<c03e3124>] (usb_hcd_unlink_urb+0x0/0x7c) from [<c03e3b08>] (usb_unlink_urb+0x34/0x50)
[ 128.069598] r7:ddf76960 r6:ddf74000 r5:ddf74000 r4:00000001
[ 128.075576] [<c03e3ad4>] (usb_unlink_urb+0x0/0x50) from [<bf0cf820>] (deactivate_urbs+0xe0/0x10c [snd_usb_audio])
[ 128.086359] [<bf0cf740>] (deactivate_urbs+0x0/0x10c [snd_usb_audio]) from [<bf0d0ac8>] (snd_usb_endpoint_stop+0x38/0x78 [snd_usb_audio])
[ 128.099246] [<bf0d0a90>] (snd_usb_endpoint_stop+0x0/0x78 [snd_usb_audio]) from [<bf0d8760>] (stop_endpoints+0x78/0x90 [snd_usb_audio])
[ 128.111922] r5:00000000 r4:dc7cf010
[ 128.115703] [<bf0d86e8>] (stop_endpoints+0x0/0x90 [snd_usb_audio]) from [<bf0d88c0>] (snd_usb_substream_playback_trigger+0x94/0xb8 [snd_usb_audio])
[ 128.129563] r5:dc7cf800 r4:dc7cf010
[ 128.133372] [<bf0d882c>] (snd_usb_substream_playback_trigger+0x0/0xb8 [snd_usb_audio]) from [<bf058fb0>] (snd_pcm_do_stop+0x5c/0x60 [snd_pcm])
[ 128.146777] r4:bf061f38 r3:bf0d882c
[ 128.150555] [<bf058f54>] (snd_pcm_do_stop+0x0/0x60 [snd_pcm]) from [<bf058c68>] (snd_pcm_action_single+0x40/0x80 [snd_pcm])
[ 128.162253] [<bf058c28>] (snd_pcm_action_single+0x0/0x80 [snd_pcm]) from [<bf058cd4>] (snd_pcm_action+0x2c/0x30 [snd_pcm])
[ 128.173834] r7:00000000 r6:b6e8f4c0 r5:dc7cd780 r4:dc7cf800
[ 128.179805] [<bf058ca8>] (snd_pcm_action+0x0/0x30 [snd_pcm]) from [<bf058cf4>] (snd_pcm_stop+0x1c/0x24 [snd_pcm])
[ 128.190592] [<bf058cd8>] (snd_pcm_stop+0x0/0x24 [snd_pcm]) from [<bf058d54>](snd_pcm_drop+0x58/0xa0 [snd_pcm])
[ 128.201198] [<bf058cfc>] (snd_pcm_drop+0x0/0xa0 [snd_pcm]) from [<bf05a22c>](snd_pcm_common_ioctl1+0x810/0xcac [snd_pcm])
[ 128.212779] r4:dc7cf800 r3:00004143
[ 128.216559] [<bf059a1c>] (snd_pcm_common_ioctl1+0x0/0xcac [snd_pcm]) from [<bf05ab8c>] (snd_pcm_playback_ioctl1+0x48/0x464 [snd_pcm])
[ 128.229175] [<bf05ab44>] (snd_pcm_playback_ioctl1+0x0/0x464 [snd_pcm]) from [<bf05afdc>] (snd_pcm_playback_ioctl+0x34/0x40 [snd_pcm])
[ 128.241759] r6:00004143 r5:00000004 r4:00005452
[ 128.246630] [<bf05afa8>] (snd_pcm_playback_ioctl+0x0/0x40 [snd_pcm]) from [<c00e0ee0>] (do_vfs_ioctl+0x84/0x578)
[ 128.257306] [<c00e0e5c>] (do_vfs_ioctl+0x0/0x578) from [<c00e1448>] (SyS_ioctl+0x74/0x84)
[ 128.265898] [<c00e13d4>] (SyS_ioctl+0x0/0x84) from [<c0014660>] (ret_fast_syscall+0x0/0x30)
[ 128.274656] ---[ end trace f43ff5ffe4182eda ]---

Additional information:

- arecord works fine with the same operation on TI SDK 07.00.00.00.

- aplay works fine with build-in Angstrom Linux and Ubuntu 14.04 LTS.
- I've tried another ALSA playback application: http://equalarea.com/paul/alsa-audio.html (A Minimal Playback Program), but the result is the same.
- The application works until snd_pcm_writei() without error response of the APIs.
- snd_pcm_writei() loop is executed 16 times, then the application stacks.

  • Hi,

    Are you using TI default kernel image or modified ?

    Did you modify the kernel configuration especially in "Sound Card Support" ?

    Have you enable "Generic sound devices" support ?

    [ * ]   Generic sound devices  --->

    Please provide "aplay -l" output.

    [ 128.008586] [<bf037cb0>] (cppi41_dma_channel_abort+0x0/0x130 [musb_hdrc]) from [<bf033740>] (musb_cleanup_urb+0x48/0xf8 [musb_hdrc])

    This issue seems to be DMA issue,

    Could you try to disable DMA support and try.

  • Hi Titus,

    Thank you for your support.
    The situation seems fixed by DMA disabled.

    > Are you using TI default kernel image or modified ?

    I've modified as follows.
    - enable IPv6, enable dynamic printk() support

    > Have you enable "Generic sound devices" support ?

    Yes.

    > Please provide "aplay -l" output.

    The result of aplay -l is follows. When the faulty situation, the result of aplay -l is the same.

    root@am335x-evm:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: REC [UA-30 (44100Hz, Analog REC)], device 0: USB Audio [USB Audio]
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    > Could you try to disable DMA support and try.

    I modified the following section.

    - Device Drivers -> USB support -> MSUB DMA mode
    (X) Disable DMA (always use PIO)

    After the modification, I don't meet the fault after more than 20 times retry.
    Thank you for your suggestion.

    Are there any possibility of patches on this issue?

    Regards,
    Tommy

  • Hi Tommy,

    Sounds good,

    Thanks for your update.

    Actually, You are using the latest kernel, It should updated with latest patches, but your failure cases seems to be different like having "USB Audio device"

    In TI Linux SDK default kernel configuration, The "USB Audio device support" not enabled by default.

    BTW, I hope Our SDK team would fix it in next SDK releases.

  • Hi Titus,

    Thank you for your reply.

    > In TI Linux SDK default kernel configuration, The "USB Audio device support" not enabled by default.

    Hmm... But the following settings are the same as the original tisdk_am335x-evm_defconfig.

    CONFIG_SND_USB=y
    CONFIG_SND_USB_AUDIO=m

    BTW, I hope this issue will be fixed on the next SDK.

    Best regards,
    Tommy