Jump to content
giseleznev

ADC add MCLK signal

Recommended Posts

I got I2S working with a PCM5102 codec (DAC), but in the next board I would like to use a board which requires MCLK (256*fs).

How to output MCLK as well additionally to BCLK/LRCLK?

Share this post


Link to post
Share on other sites

Basically, I need to output clock signal to one of free gpio pins. It should be synced with other clocks of i2s. How can I do it ?

Share this post


Link to post
Share on other sites

OK, I found:

i2s_8ch_mclk: i2s-8ch-mclk {
		rockchip,pins = <4 0 RK_FUNC_1 &pcfg_pull_none>;
};

Seems like I need this one to use in overlay to output mclk. How should I add it to a .dts file ?

Share this post


Link to post
Share on other sites

For a simple test, I'm adding usage of i2s_8ch_mclk to a hifiberry dac overlay. I want to see not just i2s signal, but also master clock on pin 37 (phys num). There no master clock, just i2s for now. What am I doing wrong? Any ideas, please, help!
Overlay (Linux linaro-alip 4.4.194) :

#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/clock/rk3399-cru.h>

/dts-v1/;
/plugin/;

/ {
	compatible = "rockchip,rk3399";

	fragment@0 {
		target-path = "/spdif-sound";
		__overlay__ {
			status = "disabled";
		};
	};

	fragment@1 {
		target-path = "/hdmi-dp-sound";
		__overlay__ {
			status = "disabled";
		};
	};

	fragment@2 {
		target = <&i2s0>;
		__overlay__ {
			assigned-clocks = <&cru SCLK_I2SOUT_SRC>;
            		assigned-clock-parents = <&cru SCLK_I2S0_8CH>;
			pinctrl-0 = <&i2s_8ch_mclk>, <&i2s0_8ch_bus>;
			status = "okay";
		};
	};

	fragment@3 {
		target-path = "/";
		__overlay__ {
			pcm5102a-codec {
				#sound-dai-cells = <0>;
				compatible = "ti,pcm5102a";
				status = "okay";
			};
		};
	};

	fragment@4 {
        	target = <&pinctrl>;
        	__overlay__ {
            		i2s0 {
                		i2s_8ch_mclk: i2s-8ch-mclk {
                    			// GPIO4_A0 - RK3399 I2S_CLK
                    			rockchip,pins = <4 21 1 &pcfg_pull_none>;
                		};
            		};
		};
    	};

	fragment@5 {
		target-path = "/sound-ext-card";
		__overlay__ {
			compatible = "hifiberry,hifiberry-dac";
			i2s-controller = <&i2s0>;
			status = "okay";
		};
	};
};

 

Edited by giseleznev

Share this post


Link to post
Share on other sites

hello @giseleznev

1. which adc are you using? do you have a product link so i can check the spec?

2. may i have a look at how the sound card is connected to tinker board 2s?

Share this post


Link to post
Share on other sites

ADC is pcm1804, but it doesn't matter, as basically all I need is master clock signal, taken from i2s. I can test master clock adding with a DAC pcm5102. That's what I'm doing. 

I'm using hifiberry-dac-overlay with changes above, and in addition to usual i2s I want to get master clock on one of the pins. As I think, it can be done with adding i2s-8ch-mclk to an overlay. The question is how ?

pcm 5102 connected and it sounds OK, I'm probing additional pin with oscillograph, hoping to get master clock

image.png

Edited by giseleznev

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...