respeaker / seeed-voicecard

2 Mic Hat, 4 Mic Array, 6-Mic Circular Array Kit, and 4-Mic Linear Array Kit for Raspberry Pi
GNU General Public License v3.0
487 stars 294 forks source link

[Bug]: respeaker 4-mic array and raspberry pi 5 support #342

Open KamelAbdelouahab opened 4 months ago

KamelAbdelouahab commented 4 months ago

Describe the bug

Hi,

I'm currently building a 4 channel microphone HAT for the raspberry pi based on the AC108. Something similar to the respeaker 4-mic array respeaker 4-mic array (which can not be found anywhere btw) with some camera placeholders.

The current driver is based on the work of HinTak work .

On the RPI-4: The HAT works pretty well and is able to capture 4 channel audio

On the RPI-5: I patched the device tree with the new I2S producer/consumer paradigm, which lets me see the sound device and have some records.

/ {
    compatible = "brcm,bcm2712";

    fragment@0 {
        target = <&i2s_clk_consumer>;
        __overlay__ {
            #sound-dai-cells = <0>;
            status = "okay";
        };
    };
...

    fragment@3 {
        target = <&sound>;

        sound_overlay: __overlay__ {
            compatible = "seeed-voicecard";
            seeed-voice-card,format = "dsp_a";
            seeed-voice-card,name = "seeed-4mic-voicecard"; 
            status = "okay";

            seeed-voice-card,bitclock-master = <&codec_dai>;
            seeed-voice-card,frame-master = <&codec_dai>;
            seeed-voice-card,channels-playback-override = <4>;
            seeed-voice-card,channels-capture-override  = <4>;

            cpu_dai: seeed-voice-card,cpu {
                sound-dai = <&i2s_clk_consumer>;
                dai-tdm-slot-num     = <4>;
                dai-tdm-slot-width   = <32>;
                //dai-tdm-slot-tx-mask = <1 1 0 0>;
                //dai-tdm-slot-rx-mask = <1 1 0 0>;
            };
            codec_dai: seeed-voice-card,codec {
                sound-dai = <&ac108_a>;
                clocks =  <&ac108_mclk>;
            };
        };
    };
};

However, only one channel among the 4 seems to contain data, other channels have only zeros: image

Do you have any suggestions related to the cause of this behaviour ? Can this come from the RP1 firmware ?

Expected behavior

Expected behaviour, once the AC108 is detected is a 4-channel audio record, but only one channel (number 2) gets data

Platform

Driver and kernel modules are the same (I literally use the same SD card and I forced and kernel8). The only difference that I see is that the RPi-5 involves the RP1 chip to handle the I2S.

Linux rpi-5b 6.6.31+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux

Relevant log output

No response

HinTak commented 4 months ago

RP5's audio is different from RP4 's . See https://github.com/raspberrypi/linux/issues/5743

There is an older discussion here https://github.com/HinTak/seeed-voicecard/issues/19 (Though I would really prefer people use the upstream issue tracker)

KamelAbdelouahab commented 4 months ago

I would have loved to participate in the discussion in https://github.com/HinTak/seeed-voicecard/issues/19. But the owner of this repository has limited the ability to comment to users that are collaborators on this repository. :smiley:

I will try to use the rpi upstream issue tracker.

HinTak commented 4 months ago

By "upstream" I mean here, and anywhere else instead of my fork. The limit was intentional. I should have closed it off a lot earlier.

deansouth8 commented 3 months ago

al. I should have closed it off a lot earlier.

Are you saying that THIS upstream driver installation should in theory work for the KEYESTUDIO ReSpeaker 2-Mic Pi HAT V1.0 on latest 64bit Pi 5 or, the scripts at the HinTak git?

HinTak commented 3 months ago

@deansouth8 I don't know why I need to make this declaration: I am just another past customer of seeedstudio, who happens to be somewhat knowledgeable in linux driver in general. I have no intention of doing seeedstudio's staff work for them. Hence anything I post in public is provided as is, and I prefer not to hear about complaints or bug reports (and people's expectations that I deal with them). If you want to commission me to do that work, please get in touch privately; or you could click on the donate link under my profile for past work. But I have no affiliation with seeedstufio and therefore will not deal with issues/complaints that they should deal with.

deansouth8 commented 3 months ago

I was truly simply asking for a couple distinctions however; No expectation of you taking on responsibilities without compensation.

But I'll continue to allow my intuition to read between the lines. I think I'll take away from this that... There may be some clues or answers on your git fork but, nothing yet has yet been adopted by seeedstudio or elsewhere. The limit of comments and stifling of free communication there at the fork was intentional but, not because it functions elsewhere. It's clear this respeaker fork is the proper location for free communication topic. Leave [HinTak] alone about it unless you pay.

Understood.

HinTak commented 3 months ago

It is for this kind of abuse going on for many years that I closed off comments on my repo. If you have a complaint / comments / problems about seeedstudio device's driver support, please talk to a seeedstudio employee. Harassing a 3rd party who is nice enough to post "what works for me" publicly, is quite appalling. Enough said.

HinTak commented 3 months ago

On my repo it is simply one branch for one kernel series - if you are using kernel X.Y.Z, you use the vX.Y branch.

I think upstream stopped updating after about 5.1x .