Firefly开源社区

有谁用过audio gadget这个功能吗?我用了录音会报错

50

积分

0

威望

0

贡献

技术小白

积分
50
发表于 2020-4-24 14:47:12     
在内核配置usb gadget 选择 audio gadget,开启 uac1
编译后,开启板子能够被识别为 ac interface 麦克风和扬声器设备
但是使用Windows录音机点击录音,板子提示如下错误:
====read frame error = -32===
Overrun occurred: -32
ALSA lib pcm.c:8905:(snd_pcm_recover) overrun occurred
====write frame error = -32===
Underrun occurred from write: -32
ALSA lib pcm.c:8905:(snd_pcm_recover) underrun occurred
rk eq_drc v2.02 2019-07-20 Oct 11 2019 09:26:56
psEqualizer->m_pfControlValue = 0.000000
param_name = /data/cfg/eq_bin/Para_48000Hz_2ch.bin
EQ/DRC Algorithm 3BAND_IIR_DIVFREQ PEAK VALUE V1.0...Oct 11 2019 09:26:56
GetLMTVersion v1.03 2019-10-10 Oct 11 2019 09:26:57,force=0 firstInit=1
回复

使用道具 举报

351

积分

0

威望

0

贡献

技术达人

Rank: 2

积分
351
发表于 2020-4-25 09:33:05     
贴出PC端和开发板端的操作步骤
回复

使用道具 举报

50

积分

0

威望

0

贡献

技术小白

积分
50
发表于 2020-4-26 09:34:00     
firefly_zhongw 发表于 2020-4-25 09:33
贴出PC端和开发板端的操作步骤

在 kernel 中执行
make rk3308_linux_defconfig
make menuconfig

device drivers-->
     <*>usb support -->
          <*>usb gadget support-->
                  <*> usb gadget drivers (audio gadget)
                           audio gadget
                  <*>           uac 1.0
该选项选中后,编译烧写进去板子,windows端识别到ac interface ,没有adb
音频设备与usb枚举log:
[    0.556550] ALSA device list:
[    0.556588]   #0: UAC1_Gadget 0
[    0.556608]   #1: rockchip,rk3308-pcm
[    0.556629]   #2: rockchip,rk3308-vad
[    0.556687]   #7: Loopback 1
[    0.559306] VFS: Mounted root (squashfs filesystem) readonly on device 31:6.
[    0.560543] devtmpfs: mounted
[    0.560835] Freeing unused kernel memory: 320K
[    0.567647] dwc2 ff400000.usb: new address 11
[    0.762785] dwc2 ff400000.usb: new device is high-speed
[    0.795656] dwc2 ff400000.usb: new address 12
[    0.818172] g_audio gadget: high-speed config #1: Linux USB Audio Gadget

eq/drc 程序运行log

==========EQ/DRC process release version 1.23===============
snd_pcm_open
snd_pcm_hw_params_malloc
snd_pcm_hw_params_any!
snd_pcm_hw_params_set_access!
snd_pcm_hw_params_set_format
channels = 2
bufferSize = 20480
periodSize = 1024
Rate = 48000
Open record device done
Open PCM: fake_play
[    3.494665] dwmmc_rockchip ff4a0000.dwmmc: Busy; trying anyway
[    3.494707] mmc_host mmc0: Timeout sending command (cmd 0x202000 arg 0x0 status 0x0)
interleaved mode
snd_pcm_hw_params_alloca
interleaved mode
format successed
     3.507831]c hmamncn_eholsst  =m m2c0:
Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div = 0)
setting sampling rate (48000)
write_bufferSize = 4096
write_periodSize = 1024
rk eq_drc v2.02 2019-07-20 Oct 11 2019 09:26:56
psEqualizer->m_pfControlValue = 0.000000
open write device is successful
WAKE_LOCK[RK_acquire_wake_lock] id=eq_drc_process
param_name = /data/cfg/eq_bin/Para_48000Hz_2ch.bin
EQ/DRC Algorithm 3BAND_IIR_DIVFREQ PEAK VALUE V1.0...Oct 11 2019 09:26:56
GetLMTVersion v1.03 2019-10-10 Oct 11 2019 09:26:57,force=0 firstInit=1

串口端输出arecord -f dat -t wav -r 48000 -c 2 -D hw:2,0 /tmp/test.wav,执行录音
ctrl+c  停止,得到音乐文件 test.wav
然后执行aplay /tmp/test.wav -c 2 -r 48000 -D hw:2,0 播放
Windows打开 录音机 软件 点击录音
串口提示错误log
[root@rockchip]:/$:aplay /tmp/test.wav -c 2 -r 48000 -D hw:2,0
Playing WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
====read frame error = -32===
Overrun occurred: -32
ALSA lib pcm.c:8905:(snd_pcm_recover) overrun occurred
回复

使用道具 举报

351

积分

0

威望

0

贡献

技术达人

Rank: 2

积分
351
发表于 2020-4-26 09:50:06     
你的UAC1是声卡Card 0,那对应的应该是 hw:0,0
  1. [    0.556550] ALSA device list:
  2. [    0.556588]   #0: UAC1_Gadget 0
  3. [    0.556608]   #1: rockchip,rk3308-pcm
  4. [    0.556629]   #2: rockchip,rk3308-vad
  5. [    0.556687]   #7: Loopback 1
复制代码
回复

使用道具 举报

50

积分

0

威望

0

贡献

技术小白

积分
50
发表于 2020-4-26 11:41:33     
firefly_zhongw 发表于 2020-4-26 09:50
你的UAC1是声卡Card 0,那对应的应该是 hw:0,0

执行 arecord -f dat -t wav -r 48000 -c 2 -D hw:0,0 /tmp/test.wav
提示:
Recording WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
arecord: pcm_read:2143: read error: Input/output error

执行 aplay /tmp/test.wav -c 2 -r 48000 -D hw:0,0
提示报错:
aplay: main:828: audio open error: Device or resource busy
是这样设置是被Windows占用了声卡吗
Windows直接按录音一样报错
====read frame error = -32===
Overrun occurred: -32
ALSA lib pcm.c:8905:(snd_pcm_recover) overrun occurred
====read frame error = 64===
====write frame error = -32===
Underrun occurred from write: -32
ALSA lib pcm.c:8905:(snd_pcm_recover) underrun occurred
rk eq_drc v2.02 2019-07-20 Oct 11 2019 09:26:56
psEqualizer->m_pfControlValue = 0.000000
====read frame error = -32===
Overrun occurred: -32
ALSA lib pcm.c:8905:(snd_pcm_recover) overrun occurred
param_name = /data/cfg/eq_bin/Para_48000Hz_2ch.bin
EQ/DRC Algorithm 3BAND_IIR_DIVFREQ PEAK VALUE V1.0...Oct 11 2019 09:26:56
GetLMTVersion v1.03 2019-10-10 Oct 11 2019 09:26:57,force=0 firstInit=1
这个是什么错误 读写溢出?
回复

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表