Jump to content
  • 0

I2S Problems with Respeaker MIC2 Hat on Banana PI Zero M2


FordPrfkt
 Share

Question

Hi,

 

i am trying to get the Respeaker 2 Mic Pi hat working on a Banana Pi Zero M2. The HAT uses the WM8960 codec and generates its own I2S MCLK.
After some trouble i got the i2c interface working and i2cdetect shows a device at address 0x1a which is correct.

But i can not get the I2S interface working.

I have added a user overlay with the following .dts:

 

/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun8i-h3";

        fragment@0 {
                target = <&i2c0>;
                __overlay__ {
                        #address-cells = <0>;
                        #size-cells = <0>;
                        status = "okay";

                        wm8960: wm8960{
                                compatible = "wlf,wm8960";
                                reg = <0x1a>;
                                #sound-dai-cells = <0>;
                        };
                };
        };

        fragment@1 {
                target = <&i2s0>;
                __overlay__ {
                        status = "okay";
                        pinctrl-0 = <&i2s0_pins>;
                        sound-dai = <&wm8960>;
                        pinctrl-names = "default";
                };
        };

        fragment@2 {
                target-path = "/";
                __overlay__ {
                        sound_i2s {
                                compatible = "simple-audio-card";
                                simple-audio-card,name = "I2S-master";
                                simple-audio-card,format = "i2s";
                                simple-audio-card,bitclock-master = <&codec_dai>;
                                simple-audio-card,frame-master = <&codec_dai>;
                                simple-audio-card,mclk-fs = <256>;
                                status = "okay";

                                simple-audio-card,widgets =
                                "Microphone", "Mic Jack",
                                "Speaker", "Speaker",
                                "Headphone", "Headphone Jack";

                                simple-audio-card,routing =
                                "Headphone Jack", "HP_L",
                                "Headphone Jack", "HP_R",
                                "Speaker", "SPK_LP",
                                "Speaker", "SPK_LN",
                                "LINPUT1", "Mic Jack",
                                "LINPUT3", "Mic Jack",
                                "RINPUT1", "Mic Jack",
                                "RINPUT2", "Mic Jack";

                                simple-audio-card,cpu {
                                        sound-dai = <&i2s0>;
                                };

                                codec_dai,codec {
                                        sound-dai = <&wm8960>;
                                };
                        };
                };
        };
};

 

I do not see errors in dmesg but aplay -l only shows the HMDI sound interface.

I am stuck here and have not found a good explanation how .dts files exactly work for audio or how to get some error messgae from the kernel to see what is wrong.

Kernel Version is 5.15.62-sunxi

 

Edited by FordPrfkt
There was a typo
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

From this very helpful thread:

 

I learned that I2S0 is disabled in the Banapi Zero M2 by default.

I enabled it in my overlay using

fragment@0 {
                target-path = "/soc/i2s@1c22000";
                __overlay__ {
                        status = "okay";
                };
        };

 

and with this dts:

Spoiler

// Definitions for G-Dis DAC
/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun8i-h3";

        fragment@0 {
                target-path = "/soc/i2s@1c22000";
                __overlay__ {
                        status = "okay";
                };
        };

        fragment@1 {
                target = <&i2c0>;
                __overlay__ {
                        #address-cells = <0>;
                        #size-cells = <0>;
                        status = "okay";

                        wm8960: wm8960{
                                compatible = "wlf,wm8960";
                                reg = <0x1a>;
                                wlf,shared-lrclk;
                                #sound-dai-cells = <0>;
                        };
                };
        };

        fragment@2 {
                target-path="/";
                __overlay__ {
                        wm8960_mclk: wm8960_mclk {
                        compatible = "fixed-clock";
                        #clock-cells = <0>;
                        clock-frequency = <12288000>;
                        };
                };
        };


        fragment@3 {
                target = <&i2s0>;
                __overlay__ {
                        pinctrl-0 = <&i2s0_pins>;
                        pinctrl-names = "default";
                        sound-dai = <&wm8960>;
                        status = "okay";
                };
        };

        fragment@4 {
                target-path = "/";
                __overlay__ {
                        sound_i2s {
                                simple-audio-card,name = "2MicHAT";
                                compatible = "simple-audio-card";
                                simple-audio-card,format = "i2s";
                                status = "okay";
                                simple-audio-card,bitclock-slave = <&dailink0_slave>;
                                simple-audio-card,frame-slave = <&dailink0_slave>;
//                              simple-audio-card,mclk-fs = <512>;
                                 simple-audio-card,widgets =
                                        "Microphone", "Mic Jack",
                                        "Speaker", "Speaker",
                                        "Headphone", "Headphone Jack";
                                simple-audio-card,routing =
                                        "Headphone Jack", "HP_L",
                                        "Headphone Jack", "HP_R",
                                        "Speaker", "SPK_LP",
                                        "Speaker", "SPK_LN",
                                        "LINPUT1", "Mic Jack",
                                        "LINPUT3", "Mic Jack",
                                        "RINPUT1", "Mic Jack",
                                        "RINPUT2", "Mic Jack";

                                simple-audio-card,cpu {
                                        sound-dai = <&i2s0>;
                                };

                                dailink0_slave: simple-audio-card,codec {
                                        sound-dai = <&wm8960>;

                                       clocks = <&wm8960_mclk>;
                                        clock-names = "mclk";
                                };
                        };
                };
        };

};

 

i now have the sound interface!

daniel@bananapim2zero:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: D2MicHAT [2MicHAT], device 0: 1c22000.i2s-wm8960-hifi wm8960-hifi-0 [1c22000.i2s-wm8960-hifi wm8960-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sun9ihdmi [sun9i-hdmi], device 0: SUN9I-HDMI PCM i2s-hifi-0 [SUN9I-HDMI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 

and also some kernel error messages:

[   53.784092] wm8960 0-001a: failed to configure clock
[   53.784107] wm8960 0-001a: ASoC: error at snd_soc_dai_hw_params on wm8960-hifi: -22
[   53.784124]  1c22000.i2s-wm8960-hifi: ASoC: soc_pcm_hw_params() failed (-22)
<goes on very long>

 

So now it seems there is something wrong with the clocking.

Probably i did not configure the I2S correctly to take MCLK from the HAT but at the moment i got no idea

 

Link to comment
Share on other sites

Armbian Linux community supported weekly builds download

  • 0

I found the Problem.

The Banana Pi M2 Zero claims to be Pin compatible to a Raspberry Pi 3 but it is not.

The RPI 3 (and Zero) have I2S_CLK and LRCLK on Pins 12 and 35 of the GPIO Header and the BPI has them on Pin 28 and 27.

I throw it in the bin and try to find another board that is compatible (RPIs are unobtainable at the moment)

Link to comment
Share on other sites

  • 0

That's unfortunate to hear. I also bought a BPi M2 Zero based on the premise that the PIN's are compatible with Raspberry Pi and hence my Hifiberry Digi would be supported.

 

Did you eventually get it to work by re-wiring the PINs somehow?

 

Did you get your HAT working on another board?

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...