rk3399使用i2s0发现I2S_CLK(MCLK)波形不正常,导致无法播放声音
需求:使用I2S0播放声音。在设备树中增加dummy-codec和simple-audio-card节点,内核配置增加CONFIG_SND_SOC_DUMMY_CODEC=y,
重新编译SDK后,I2S0的几个引脚都有输出,但是播放无声,使用示波器观察I2S_CLK发现波形很不标准,应该是I2S_CLK波形不标准导致无正常播放声音。
载板使用是官方载板。
请问这个问题应该如何解决,以下是示波器拍照图片和设备树文件。
/dts-v1/;
#include "rk3399-firefly-port.dtsi"
#include <dt-bindings/sensor-dev.h>
#include <dt-bindings/display/media-bus-format.h>
/ {
test-power {
status = "okay";
};
rt5640-sound {
status = "disabled";
simple-audio-card,cpu {
sound-dai = <&i2s1>;
};
simple-audio-card,codec {
sound-dai = <&rt5640>;
};
};
adc-keys {
compatible = "adc-keys";
io-channels = <&saradc 1>;
io-channel-names = "buttons";
poll-interval = <300>;
keyup-threshold-microvolt = <1800000>;
esc-key {
linux,code = <KEY_ESC>;
label = "esc";
press-threshold-microvolt = <0>;
};
};
fan_ctl: fan-ctl-regulator {
compatible = "regulator-fixed";
enable-active-high;
regulator-always-on;
regulator-boot-on;
gpio = <&gpio3 10 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
regulator-name = "fan_ctl";
pinctrl-0 = <&fan_drv>;
};
NPU5801_PWR_EN: HUB20-PWR-EN {
compatible = "regulator-fixed";
enable-active-high;
regulator-always-on;
regulator-boot-on;
gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&npu5801_pwr_en>;
regulator-name = "vcc5v0_5801_en";
status = "okay";
};
dummy_codec: dummy-codec {
compatible = "rockchip,dummy-codec";
#sound-dai-cells = <0>;
clocks = <&cru SCLK_I2S_8CH_OUT>;
clock-names = "mclk";
pinctrl-names = "default";
pinctrl-0 = <&i2s_8ch_mclk>;
status = "okay";
};
dummy-sound {
status = "okay";
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "rockchip,dummy-codec";
simple-audio-card,mclk-fs = <256>;
simple-audio-card,cpu {
sound-dai = <&i2s0>;
};
simple-audio-card,codec {
sound-dai = <&dummy_codec>;
};
};
};
&gmac {
/delete-property/ snps,force_thresh_dma_mode;
tx_delay = <0x2F>;
rx_delay = <0x1E>;
};
&vcc_sd_h {
rockchip,pins = <1 22 RK_FUNC_GPIO &pcfg_pull_up>;
};
&vcc_sd {
gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>;
};
&hdmi_dp_sound {
status = "okay";
};
&i2c2 {
status = "disabled";
i2c-scl-rising-time-ns = <300>;
i2c-scl-falling-time-ns = <15>;
sensor@4c {
status = "disabled";
compatible = "gs_mc3230";
reg = <0x4c>;
type = <SENSOR_TYPE_ACCEL>;
irq_enable = <0>;
poll_delay_ms = <30>;
layout = <1>;
};
};
&rt5640 {
hp-det-adc-value = <900>;
aux-det-adc-value = <900>;
hp-con-gpio = <&gpio3 16 GPIO_ACTIVE_HIGH>;
io-channels = <&saradc 3>,<&saradc 2>;
io-channel-names = "hp-det","aux-det";
status = "disabled";
};
&rt5640_hpcon{
rockchip,pins = <3 16 RK_FUNC_GPIO &pcfg_pull_none>;
};
&vcca1v8_codec {
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <900000>;
};
&spi1 {
dev-port = <0>;
status = "okay";
};
&spi_wk2xxx {
status = "okay";
reset-gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
irq-gpio = <&gpio2 8 IRQ_TYPE_EDGE_FALLING>;
cs-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
};
&vcc3v3_3g {
gpio = <&gpio2 28 GPIO_ACTIVE_HIGH>;
};
&vcc3v3_pcie {
/delete-property/ gpio;
};
&pcie0 {
ep-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
};
&uart4 {
status = "disabled";
};
&dp_in_vopb {
status = "disabled";
};
&hdmi_in_vopl {
status = "disabled";
};
&wdt {
status = "disabled";
};
&io_domains {
bt656-supply = <&vcc_3v0>;
};
&vcc2v8_dvp {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};
&vcca1v8_codec {
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <900000>;
};
&fusb0 {
status = "disabled";
};
&cdn_dp {
status = "disabled";
};
&tcphy0 {
/delete-property/ extcon;
status = "okay";
};
&u2phy0 {
status = "okay";
/delete-property/ extcon;
u2phy0_otg: otg-port {
rockchip,vbus-always-on;
vbus-5v-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
status = "okay";
};
};
&usbdrd3_0 {
status = "okay";
/delete-property/ extcon;
};
&usbdrd_dwc3_0 {
dr_mode = "host";
};
&route_hdmi {
status = "okay";
};
&rk808 {
/delete-property/ pmic,stby-gpio;
/delete-property/ pmic,hold-gpio;
};
&vcc_mipi {
status = "okay";
};
&dvdd_1v2 {
status = "okay";
};
&ov13850 {
pwdn-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
status = "okay";
};
&ov13850_1 {
pwdn-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
status = "okay";
};
&rkisp1_0 {
status = "okay";
};
&mipi_dphy_rx0 {
status = "okay";
};
&isp0_mmu {
status = "okay";
};
&rkisp1_1 {
status = "okay";
};
&mipi_dphy_tx1rx1 {
status = "okay";
};
&isp1_mmu {
status = "okay";
};
&pinctrl {
pinctrl-names = "default";
pinctrl-0 = <&host_hub_vcc>;
npu_pwr_en {
// control VCC5V0_HOST3
npu5801_pwr_en: npu5801-pwr-en {
rockchip,pins =
<0 2 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
host-hub-vcc {
host_hub_vcc: host-hub-vcc {
rockchip,pins =
<2 4 RK_FUNC_GPIO &pcfg_output_high>,
<4 29 RK_FUNC_GPIO &pcfg_output_high>;
};
};
pcie {
pcie_3g_drv: pcie-3g-drv {
rockchip,pins =
<2 6 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
vcc_sd {
vcc_sd_h: vcc-sd-h {
rockchip,pins =
<1 22 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
fan-ctl {
fan_drv: fan-drv {
rockchip,pins = <3 10 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};
换了几个核心板 刷官方的系统也是这样不会是硬件有问题 这个功能不能用吧{:4_172:} 如果是时钟问题,参考一下rk3399-firefly-core.dtsi的i2s1配置。 neutionwei 发表于 2023-3-6 18:03
如果是时钟问题,参考一下rk3399-firefly-core.dtsi的i2s1配置。
i2s0应该怎么改些什么?
rk3399-firefly-core.dtsi里是这样的
&i2s0 {
rockchip,i2s-broken-burst-len;
rockchip,capture-channels = <8>;
rockchip,playback-channels = <8>;
#sound-dai-cells = <0>;
status = "okay";
};
&i2s1 {
rockchip,i2s-broken-burst-len;
rockchip,playback-channels = <2>;
rockchip,capture-channels = <2>;
assigned-clocks = <&cru SCLK_I2S1_DIV>, <&cru SCLK_I2S_8CH>;
assigned-clock-parents = <&cru PLL_GPLL>, <&cru SCLK_I2S1_8CH>;
#sound-dai-cells = <0>;
status = "okay";
};
&i2s2 {
#sound-dai-cells = <0>;
dmas = <&dmac_bus 4>;
dma-names = "tx";
status = "okay";
}; assigned-clocks = <&cru SCLK_I2S1_DIV>, <&cru SCLK_I2S_8CH>;
assigned-clock-parents = <&cru PLL_GPLL>, <&cru SCLK_I2S1_8CH>;
这两个是时钟配置,可以参考一下。 neutionwei 发表于 2023-3-7 16:39
assigned-clocks = , ;
assigned-clock-parents = , ;
这两个是时钟配置,可以参考一下 ...
设备树增加了这两行,没效果,示波器上还是那样
&i2s0 {
rockchip,i2s-broken-burst-len;
rockchip,capture-channels = <8>;
rockchip,playback-channels = <8>;
assigned-clocks = <&cru SCLK_I2S0_DIV>, <&cru SCLK_I2S_8CH>;
assigned-clock-parents = <&cru PLL_GPLL>, <&cru SCLK_I2S0_8CH>;
#sound-dai-cells = <0>;
status = "okay";
};
可能是硬件问题,寄给售后处理吧 neutionwei 发表于 2023-3-13 10:13
可能是硬件问题,寄给售后处理吧
好的 那先返厂一块核心板 售后看一下 最终结果是什么?解决了吗?硬件有问题吗? xueyuking 发表于 2023-3-30 15:09
最终结果是什么?解决了吗?硬件有问题吗?
硬件没问题;
一开始自己编译的固件I2S1和I2S0的I2S_CLK信号都不能用,在自己编译的固件上导入了官方固件的rt5640的alas配置后,I2S1的I2S_CLK恢复了;在先刷官方固件再刷自己编译的固件后,I2S0的I2S_CLK也能正常用了(不知道是什么原理)。
另外发现,在开发板上I2S1和I2S0可能不能同时用。
页:
[1]
2