- 使用耳麦(MIC3), 操作下列命令录音:
amixer -D hw:audiocodec cset name='ADC2 Input LINEINR Switch' 0
amixer -D hw:audiocodec cset name='ADC1 Input LINEINL Switch' 0
amixer -D hw:audiocodec cset name='ADC3 Input MIC3 Boost Switch' 1
amixer -D hw:audiocodec cset name='MIC3 Input Select' 0
amixer -D hw:audiocodec cset name='MIC3 gain volume' 28
amixer -D hw:audiocodec cset name='ADC3 volume' 230
arecord -D hw:audiocodec -f S16_LE -r 16000 -c 2 /tmp/test.wav
- 使用耳麦(MIC3), 操作下列命令播放录音文件:
amixer -D hw:audiocodec cset name='Headphone Switch' 1
amixer -D hw:audiocodec cset name='Headphone volume' 100%
aplay -D hw:audiocodec /tmp/test.wav
测试结果:播放录音文件时有快进播放的效果,声音轻并伴有杂声。
-
使用PC软件 Audacity,把采样率改为8000HZ,并选择增幅(放大),可以听到比较正常的声音。
-
录音时的时钟: codec set adc clk rate: 24576000
录音时相关寄存器的值如下:
root@TinaLinux:~/usr/bin# cat /sys/devices/platform/soc@3000000/2030000.codec/au
dio_reg_debug/audio_reg
REG NAME |OFFSET|VALUE |31-28|27-24|23-20|19-16|15-12|11-08|07-04|03-00|save_value
SUNXI_DAC_DPC |0x 0|0x 0|0000 |0000 |0000 |0000 |0000 |0000 |0000 |0000 |0x 0
SUNXI_DAC_VOL_CTRL |0x 4|0x 1a0a0|0000 |0000 |0000 |0001 |1010 |0000 |1010 |0000 |0x 0
SUNXI_DAC_FIFOC |0x 10|0x63004000|0110 |0011 |0000 |0000 |0100 |0000 |0000 |0000 |0x 0
SUNXI_DAC_FIFOS |0x 14|0x 80800c|0000 |0000 |1000 |0000 |1000 |0000 |0000 |1100 |0x 0
SUNXI_DAC_TXDATA |0x 20|0x 0|0000 |0000 |0000 |0000 |0000 |0000 |0000 |0000 |0x 0
SUNXI_DAC_CNT |0x 24|0x 17004|0000 |0000 |0000 |0001 |0111 |0000 |0000 |0100 |0x 0
SUNXI_DAC_DG |0x 28|0x 0|0000 |0000 |0000 |0000 |0000 |0000 |0000 |0000 |0x 0
SUNXI_ADC_FIFOC |0x 30|0x7b000408|0111 |1011 |0000 |0000 |0000 |0100 |0000 |1000 |0x 0
SUNXI_ADC_VOL_CTRL |0x 34|0xa0e6a0a0|1010 |0000 |1110 |0110 |1010 |0000 |1010 |0000 |0x 0
SUNXI_ADC_FIFOS |0x 38|0x 803d01|0000 |0000 |1000 |0000 |0011 |1101 |0000 |0001 |0x 0
SUNXI_ADC_RXDATA |0x 40|0xfffffff4|1111 |1111 |1111 |1111 |1111 |1111 |1111 |0100 |0x 0
SUNXI_ADC_CNT |0x 44|0x 10a946|0000 |0000 |0001 |0000 |1010 |1001 |0100 |0110 |0x 0
SUNXI_ADC_DG |0x 4c|0x 0|0000 |0000 |0000 |0000 |0000 |0000 |0000 |0000 |0x 0
SUNXI_ADC_DIG_CTRL |0x 50|0x 4|0000 |0000 |0000 |0000 |0000 |0000 |0000 |0100 |0x 0
SUNXI_VRA1SPEEDUP_DOWN_CTRL |0x 54|0x 10|0000 |0000 |0000 |0000 |0000 |0000 |0001 |0000 |0x 0
SUNXI_DAC_DAP_CTL |0x f0|0x 0|0000 |0000 |0000 |0000 |0000 |0000 |0000 |0000 |0x 0
SUNXI_ADC_DAP_CTL |0x f8|0x99000000|1001 |1001 |0000 |0000 |0000 |0000 |0000 |0000 |0x 0
SUNXI_ADC1_REG |0x 300|0x 1cc055|0000 |0000 |0001 |1100 |1100 |0000 |0101 |0101 |0x 0
SUNXI_ADC2_REG |0x 304|0x 1c0055|0000 |0000 |0001 |1100 |0000 |0000 |0101 |0101 |0x 0
SUNXI_ADC3_REG |0x 308|0xd01c1e55|1101 |0000 |0001 |1100 |0001 |1110 |0101 |0101 |0x 0
SUNXI_DAC_REG |0x 310|0x 15007a|0000 |0000 |0001 |0101 |0000 |0000 |0111 |1010 |0x 0
SUNXI_MICBIAS_REG |0x 318|0x4094b0b0|0100 |0000 |1001 |0100 |1011 |0000 |1011 |0000 |0x 0
SUNXI_RAMP_REG |0x 31c|0x10180000|0001 |0000 |0001 |1000 |0000 |0000 |0000 |0000 |0x 0
SUNXI_BIAS_REG |0x 320|0x 8d|0000 |0000 |0000 |0000 |0000 |0000 |1000 |1101 |0x 0
SUNXI_HMIC_CTRL |0x 328|0x f00cf|0000 |0000 |0000 |1111 |0000 |0000 |1100 |1111 |0x 0
SUNXI_HMIC_STS |0x 32c|0x 7700|0000 |0000 |0000 |0000 |0111 |0111 |0000 |0000 |0x 0
SUNXI_HP2_REG |0x 340|0x 6404000|0000 |0110 |0100 |0000 |0100 |0000 |0000 |0000 |0x 0
SUNXI_POWER_REG |0x 348|0x80013319|1000 |0000 |0000 |0001 |0011 |0011 |0001 |1001 |0x 0
SUNXI_ADC_CUR_REG |0x 34c|0x 151515|0000 |0000 |0001 |0101 |0001 |0101 |0001 |0101 |0x 0
在D1-H的用户手册里核查了SUNXI_ADC_FIFOC 寄存器的设置,看寄存器的值是设置对的。
-
cat /proc/asound/card0/pcm0c/sub0/hw_params
access: RW_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 16000 (16000/1)
period_size: 2000
buffer_size: 8000 -
cat /proc/asound/card0/pcm0c/sub0/status
state: RUNNING
owner_pid : 642
trigger_time: 1748.547045624
tstamp : 0.000000000
delay : 1152
avail : 1152
avail_max : 2000
hw_ptr : 535152
appl_ptr : 534000
请教大家了,谢谢。