1、连接WIFI
sudo nmcli r wifi on
sudo nmcli dev wifi
sudo nmcli dev wifi connect "SSID" password "PASSWORD"
2、更新源
sudo apt-get update
sudo apt-get install git wget
export DISTRO=focal-stable
wget -O - apt.radxa.com/$DISTRO/public.key | sudo apt-key add -
sudo apt-get update
3、安装相关编译器
sudo apt-get install gcc-aarch64-linux-gnu build-essential device-tree-compiler libncurses5 libncurses5-dev make cmake
4、安装基础音频软件
sudo apt-get install alsa-utils jackd2 jackmeter mplayer
-------------------------------------------------------------------------------------------------------------------------------
接下来做一些基本的测试
1、jackd服务
jackd -dalsa -dhw:1 -r44100&
查看端口
jack_lsp
2、要使用高品质音频,需采用I2S的方式连接外部解码器,通过编译设备树将相应IO配置为I2S模式
2.1 反编译DTB
dtc -I dtb -O dts -o xx.dtb xxx.dts
即把/boot/dtbs/4.4.143-65-rockchip-g58431d38f8f3/rockchip/rk3308-rock-pi-s.dtb反编译为dts,然后对该文件进行编辑
dtc -I dtb -O dts -o /boot/dtbs/4.4.143-65-rockchip-g58431d38f8f3/rockchip/rk3308-rock-pi-s.dtb rk3308-rock-pi-s.dts
运行上述命令后,将在当前目录下生成rk3308-rock-pi-s.dts,接下来对该文件的以下片段进行修改,不使用rock pi s自带的音频解码器,并将IO配置为I2S模式。
2.2 I2S slave模式的设备树
i2s_8ch_0: i2s@ff300000 {
compatible = "rockchip,rk3308-i2s-tdm";
reg = <0x00 0xff300000 0x00 0x1000>;
interrupts = <0x00 0x30 0x04>;
clocks = <0x02 0x4c 0x02 0x4e 0x02 0xa4 0x02 0x6e 0x02 0x6f 0x02 0x03 0x02 0x04>;
clock-names = "mclk_tx\0mclk_rx\0hclk\0mclk_tx_src\0mclk_rx_src\0mclk_root0\0mclk_root1";
dmas = <0x25 0x00 0x25 0x01>;
dma-names = "tx\0rx";
resets = <0x02 0x89 0x02 0x8a>;
reset-names = "tx-m\0rx-m";
rockchip,cru = <0x02>;
rockchip,grf = <0x4b>;
rockchip,mclk-calibrate;
pinctrl-names = "default";
pinctrl-0 = <0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a>;
rockchip,clk-trcm = <2>;
#sound-dai-cells = <0>;
status = "okay";
phandle = <0xbe>;
};
I2S_sound {
status = "okay";
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "dummy-card";
simple-audio-card,mclk-fs = <256>;
simple-audio-card,bitclock-master = <&master>;
simple-audio-card,frame-master = <&master>;
simple-audio-card,cpu {
sound-dai = <&i2s_8ch_0>;
};
master:simple-audio-card,codec {
sound-dai = <&dummy_codec>;
};
};
dummy_codec: dummy-codec {
status = "okay";
compatible = "rockchip,dummy-codec";
//clocks = <0x02 0x6f>;
//clock-names = "mclk";
#sound-dai-cells = <0>;
};
acodec-sound {
compatible = "rockchip,multicodecs-card";
rockchip,card-name = "rockchip,rk3308-acodec";
rockchip,multicodecs-card,format = "i2s";
rockchip,mclk-fs = <0x100>;
rockchip,cpu = <&i2s_8ch_0>;
rockchip,codec = <0x8b>;
status = "disabled";
phandle = <0x13d>;
};
2.3 I2S master模式的设备树
i2s_8ch_0: i2s@ff300000 {
compatible = "rockchip,rk3308-i2s-tdm";
reg = <0x00 0xff300000 0x00 0x1000>;
interrupts = <0x00 0x30 0x04>;
clocks = <0x02 0x4c 0x02 0x4e 0x02 0xa4 0x02 0x6e 0x02 0x6f 0x02 0x03 0x02 0x04>;
clock-names = "mclk_tx\0mclk_rx\0hclk\0mclk_tx_src\0mclk_rx_src\0mclk_root0\0mclk_root1";
dmas = <0x25 0x00 0x25 0x01>;
dma-names = "tx\0rx";
resets = <0x02 0x89 0x02 0x8a>;
reset-names = "tx-m\0rx-m";
rockchip,cru = <0x02>;
rockchip,grf = <0x4b>;
rockchip,mclk-calibrate;
pinctrl-names = "default";
pinctrl-0 = <0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a>;
rockchip,clk-trcm = <2>;
#sound-dai-cells = <0>;
status = "okay";
phandle = <0xbe>;
};
I2S_sound {
status = "okay";
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "dummy-card";
simple-audio-card,mclk-fs = <256>;
simple-audio-card,bitclock-master = <&i2s_8ch_0>;
simple-audio-card,frame-master = <&i2s_8ch_0>;
simple-audio-card,cpu {
sound-dai = <&i2s_8ch_0>;
};
master:simple-audio-card,codec {
sound-dai = <&dummy_codec>;
};
};
dummy_codec: dummy-codec {
status = "okay";
compatible = "rockchip,dummy-codec";
//clocks = <0x02 0x6f>;
//clock-names = "mclk";
//pinctrl-names = "default";
//pinctrl-0 = <0x5a>;
#sound-dai-cells = <0>;
};
acodec-sound {
compatible = "rockchip,multicodecs-card";
rockchip,card-name = "rockchip,rk3308-acodec";
rockchip,multicodecs-card,format = "i2s";
rockchip,mclk-fs = <0x100>;
rockchip,cpu = <&i2s_8ch_0>;
rockchip,codec = <0x8b>;
status = "disabled";
phandle = <0x13d>;
};
3、编译修改完成的dts文件
sudo dtc -I dts -O dtb -f rk3308-rock-pi-s.dts -o /boot/dtbs/4.4.143-65-rockchip-g58431d38f8f3/rockchip/rk3308-rock-pi-s.dtb
重启系统
sudo reboot
--------------------------------------------------------------------------------------------------------------------------------文章来源地址https://www.toymoban.com/news/detail-486390.html
如果使用I2S master模式,ROCK PI S的DACLRCK、DACBCK针脚为输出,那么在启动jacd服务后,这两个针脚应将产生到对应的频率
jackd -dalsa -dhw:1 -r44100
如果使用I2S slave模式,LRCK、BCK针脚由外部时钟提供,如果外部时钟不存在,jackd服务将不能正常启动。
接下来会产生一个问题,在I2S master模式下,只产生BCK和LRCK时钟,没有MCLK时钟,可能有些外部解码器需要提供MCLK时钟,这个问题还没搞清楚怎么办,不过有一种硬件的解决方案是使用锁相环倍频电路,不过此电路的缺点是最高支持48k采样率。
锁相环倍频电路
假如CLK-IN输入的是LRCK时钟,74HC4046的3脚就与74HC4040的256分频连接,此时CLK-OUT输出就是11.2896M,或者CLK-IN输入的是BCK时钟,74HC4046的3脚就与74HC4040的4分频连接,此时CLK-OUT输出也是11.2896M。CLK-OUT就是通过倍频生成的MCLK时钟。
--------------------------------------------------------------------------------------------------------------------------------
如果使用I2S SLAVE模式就简单了,使用有源晶振直接分频即可,参照以下电路即可得到MCLK,BCK,LRCK三个时钟信号
请注意LRCK,BCK时钟信号应与ROCK PI S的ADC_LRCK,ADC_BCK连接,而不是DAC_LRCK,DAC_BCK。文章来源:https://www.toymoban.com/news/detail-486390.html
--------------------------------------------------------------------------------------------------------------------------------
到了这里,关于ROCK PI S音频开发(一)系统准备的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!