anotherfiz
Posts: 1
Joined: Mon Apr 01, 2019 8:38 pm

another I2S thread

Mon Apr 01, 2019 8:50 pm

Hey all,

I've come seeking help with some general I2S questions. Before you ask - I've read the sticky and it was extremely helpful in implementing a DT overlay file which I was able to use to create a working capture and playback device - sort of.

My configuration is a BM64 bluetooth module connected to the Pi via I2S, with the BM64 acting as a clock master, and the Pi acting as a slave. Thus far, I've successfully been able to play music using my phone, connected to the BM64 using bluetooth, and record a clip on the Pi using arecord, leveraging the I2s Capture interface that I created. The recording comes back clean when played on my ubuntu workstation - everything looks good here!

Where I am having trouble is my use case for playback. my end goal is to be able to make a phone call with my same phone, establish a bluetooth HFP link, and use the Pi to broadcast audio over I2S in the hopes of hearing it on the speaker of the phone I am calling. I am about 90% of the way there insomuch as I can hear audio from the speaker of the phone I am calling , but it comes out completely distorted and skippy. I have tried both 16 and 24 bit I2S configuration for the BM64, but this does not seem to make much of a difference.

My intuition is that the problem lies with the TDM configuration i am using for the playback interface - I will attatch my DToverlay code for you guys to take a look.

Furthermore, I am generally confused about how to calculate TDM configuration as it applies to the Pi. Here is what I have so far:

Code: Select all

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2708";

    [email protected] {
        target-path = "/";
        __overlay__ {
            dual_soundcard: dual-soundcard {
                compatible = "simple-audio-card";
                simple-audio-card,name = "I2S Sound Interface";

                status="okay";

                capture_link: simple-audio-card,[email protected] {
                    format = "i2s";


                    bitclock-master = <&r_codec_dai>;
                    frame-master = <&r_codec_dai>;

                    r_cpu_dai: cpu {
                        sound-dai = <&i2s>;

                        dai-tdm-slot-num = <2>;
                        dai-tdm-slot-width = <32>;
                    };

                    r_codec_dai: codec {
                        sound-dai = <&codec_in>;
                    };
                };

                playback_link: simple-audio-card,[email protected] {
                    format = "i2s";
                    bitclock-master = <&p_codec_dai>;
                    frame-master = <&p_codec_dai>;

                    p_cpu_dai: cpu {
                        sound-dai = <&i2s>;

                        dai-tdm-slot-num = <2>;
                        dai-tdm-slot-width = <32>;
                    };

                    p_codec_dai: codec {
                        sound-dai = <&codec_out>;
                    };
                };
            };
        };
    };

    [email protected] {
        target-path = "/";
        __overlay__ {
            codec_out: spdif-transmitter {
                #address-cells = <0>;
                #size-cells = <0>;
                #sound-dai-cells = <0>;
                compatible = "linux,spdif-dit";
                status = "okay";
            };

        };
    };
    [email protected] {
        target-path = "/";
        __overlay__ {

            codec_in: spdif-receiver {
                #address-cells = <0>;
                #size-cells = <0>;
                #sound-dai-cells = <0>;
                compatible = "linux,spdif-dir";
                status = "okay";
            };
        };
    };

    [email protected] {
        target = <&i2s>;
        __overlay__ {
            #sound-dai-cells = <0>;
            status = "okay";
        };
    };

};
Failing the TDM configuration being a problem - my next guess is that it could be a conversion issue - I am playing a 48khz file, and HFP is only designed with 8khz and 16hz sampling in mind. Any thoughts from the experts would be helpful i'm sure.

Thanks in advance for reading.

espritle
Posts: 2
Joined: Sun Dec 01, 2019 5:43 pm

Re: another I2S thread

Thu Jan 16, 2020 1:30 pm

Hi,
do You have experience on switch HFP to 16kHz instead of 8kHz?

Thanks in advance

Return to “Interfacing (DSI, CSI, I2C, etc.)”