How to Config I2S
Contents
Overview
ROM-5780 supports two CODEC RT5640 using i2s interface and only one codec is turned on by default(i2s0).
If ROM-DB5901 is used as the ROM-5780 carrier board, then the interface to connect is as follows. The compatible small i2s CODEC board model is ROM-EG57
I2s(ROM5780) |
Interface(DB5901) |
I2s0 |
i2s_cn3 |
i2s1 |
i2c_cn4 |
Configuration
The following configuration is only for ROM-5780 with the carrier board ROM-DB5901.
Use the CODEC of the i2s0 for recording and playback.
The CODEC board is pluged into the I2S_cn3. I2s0 is turned on by default, so the CODEC can be turned on directly using the command.
1. Recording audio data
root@linaro-alip:~# arecord -Dhw:0,0 -c 2 -f S16_LE -r 8000 -d 5 -t wav test.wav
2. Play the recorded test audio
root@linaro-alip:~# aplay –Dhw:0,0 -t wav test.wav
Use the CODEC of the I2S1 for recording and playback.
The second codec needs to be configured before using it.
If two i2S codec board are both inserted, then the second i2s CARD generated automatically by kernel is 1.
If only the second I2S1 interface i2s_CN4 is plugged, then the i2s CARD is 0
$Card under the following command please use the number 0 or 1
root@linaro-alip:~# amixer -c $CARD cset name='DAI select' '1:1|2:2' root@linaro-alip:~# amixer -c $CARD cset name='RECMIXL BST1 Switch' 1 root@linaro-alip:~# amixer -c $CARD cset name='RECMIXR BST1 Switch' 1 root@linaro-alip:~# amixer -c $CARD cset name='RECMIXL BST2 Switch' 0 root@linaro-alip:~# amixer -c $CARD cset name='RECMIXR BST2 Switch' 0 root@linaro-alip:~# amixer -c $CARD cset name='Stereo ADC1 Mux' 'ADC' root@linaro-alip:~# amixer -c $CARD cset name='Stereo ADC MIXL ADC1 Switch' 1 root@linaro-alip:~# amixer -c $CARD cset name='Stereo ADC MIXR ADC1 Switch' 1 root@linaro-alip:~# amixer -c $CARD cset name='Stereo ADC MIXL ADC2 Switch' 0 root@linaro-alip:~# amixer -c $CARD cset name='Stereo ADC MIXR ADC2 Switch' 0 root@linaro-alip:~# amixer -c $CARD cset name='ADC Capture Switch' 1 1 root@linaro-alip:~# amixer -c $CARD cset name='ADC Capture Volume' 47 47
1. Recording audio data
root@linaro-alip:~# arecord -Dhw:$CARD,0 -c 2 -f S16_LE -r 8000 -d 5 -t wav test.wav
2. Play the recorded test audio
root@linaro-alip:~# aplay –Dhw:$CARD,0 -t wav test.wav