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?
I plugged in the mclk signal from the LyraT 4.3 board and the sound came out correctly.
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));