I2S MCLK_PIN signal error?

natee.th
Posts: 26
Joined: Fri Feb 10, 2023 5:25 pm

I2S MCLK_PIN signal error?

Postby natee.th » Fri Apr 12, 2024 2:21 pm

Hello, I am using ESP32S3 with ES8388. I have started learning from LyraT 4.3 board. Now I am building a new circuit using ESP32S3 with ES8388.

From the signal sent out from the ESP32S3, every pin is normal except for the mclk pin, which appears to be unstable. How do I check?

Image

Image

I plugged in the mclk signal from the LyraT 4.3 board and the sound came out correctly.

Image

Code: Select all

i2s_chan_config_t tx_chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM, I2S_ROLE_MASTER);
    ESP_ERROR_CHECK(i2s_new_channel(&tx_chan_cfg, &tx_chan, NULL));

    i2s_std_config_t tx_std_cfg = {
        .clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(SAMPLE_RATE),
        .slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO),
        .gpio_cfg = {
            .mclk = I2S_MCK_IO, // some codecs may require mclk signal, this example doesn't need it
            .bclk = I2S_BCK_IO,
            .ws = I2S_WS_IO,
            .dout = I2S_DO_IO,
            .din = I2S_DI_IO,
            .invert_flags = {
                .mclk_inv = false,
                .bclk_inv = false,
                .ws_inv = false,
            },
        },
    };

    tx_std_cfg.clk_cfg.mclk_multiple = 512;
    gpio_set_direction(0, GPIO_MODE_OUTPUT);

    // PIN_FUNC_SELECT(IO_MUX_GPIO0_REG, 1); // FUNC_GPIO0_CLK_OUT1 = 1
    WRITE_PERI_REG(PIN_CTRL, 0xFFF0);

    ESP_ERROR_CHECK(i2s_channel_init_std_mode(tx_chan, &tx_std_cfg));
    ESP_ERROR_CHECK(i2s_channel_enable(tx_chan));
Last edited by natee.th on Sat Apr 13, 2024 7:48 am, edited 1 time in total.

natee.th
Posts: 26
Joined: Fri Feb 10, 2023 5:25 pm

Re: I2S MCLK_PIN not stable

Postby natee.th » Sat Apr 13, 2024 7:42 am

I tried using this project
https://github.com/espressif/esp-idf/t ... 2s_es8311
and it turned out that mclk was not normal either.

Image

Volvox
Posts: 21
Joined: Sat Mar 18, 2017 7:54 pm

Re: I2S MCLK_PIN signal error?

Postby Volvox » Sat Apr 13, 2024 1:28 pm

My whole ESP experience is ( we assembled a lot more than 5000pcs of this module up to now), that this kind of problems are mostly related to improper PCB Layout (Pullups, Powersupply, decoupling ...) or due to some specific pins, that are not that fine for this high speed signals (like the GPIO0 on ESP for APLL out was always a struggle with propagation delays or other similar errors). Other thing is that the software load is too high, then every peripheral and ISR starts producing errors like this. But this you can check easily with the example projects to check if single peripheral works with the sample code.
Without providing a pcs of your custom hardware schematics it is difficult to say, but I would rule out this as first step.

natee.th
Posts: 26
Joined: Fri Feb 10, 2023 5:25 pm

Re: I2S MCLK_PIN signal error?

Postby natee.th » Sat Apr 13, 2024 3:56 pm

I solved it successfully. In conclusion, the GPIO0 pin used as mclk should be moved to another pin (i used GPIO1 ) because GPIO0 is also used in programming. :D

I use this board In case anyone missed it like me.
Image

Who is online

Users browsing this forum: No registered users and 264 guests