espressif / esp-dev-kits

Docs, Schematics, Factory Firmwares for ESP Development Kits
Other
345 stars 183 forks source link

s2直接读i2s来获取Mic的数据失败 #17

Closed coollofty closed 1 year ago

coollofty commented 3 years ago

代码如下:

    es8311_init(44100);
    es8311_set_voice_volume(100);

    i2s_config_t i2s_config = {
        .mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_RX,
        .sample_rate = 16000,
        .bits_per_sample = 16,
        .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
        .communication_format = I2S_COMM_FORMAT_I2S_MSB,
        .dma_buf_count = 6,
        .dma_buf_len = 256,
        .use_apll = true,
        .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2,
    };
    i2s_pin_config_t pin_config = {
        .bck_io_num = I2S_SCLK,
        .ws_io_num = I2S_LCLK,
        .data_out_num = I2S_DOUT,
        .data_in_num = I2S_DSIN
    };

    i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
    i2s_set_pin(I2S_NUM_0, &pin_config);

        for(;;) {
            size_t bytesRead = 0;
            int r = i2s_read(0, dmaBuf, I2S_READ_BLOCK_SIZE, &bytesRead, 100 / portTICK_RATE_MS);
            if (r == ESP_OK)
                    // read samples
        }

读出来的数据全部都是0,可以请教一下可能是哪里的问题吗?

Lzw655 commented 1 year ago

很抱歉没有及时回答你的问题! 由于这个问题已经失去时效性了,我将在一周后关闭它。如果你还需要解决这个问题,请留言或新开一个 issue,谢谢!