Communication between esp32 module and audio codec w681512 through I2S

duoduo79
Posts: 1
Joined: Fri Apr 15, 2022 4:58 am

Communication between esp32 module and audio codec w681512 through I2S

Postby duoduo79 » Fri Apr 15, 2022 5:37 am

At present, esp32 is used to communicate with w681512. The circuit of w681512 is as follows:
图1 W681512电路图.png
W681512电路图
图1 W681512电路图.png (40.6 KiB) Viewed 1033 times
The PCM interface sequence diagram of w681512 is shown in the figure below:
图2 W681512接口时序图.png
时序图
图2 W681512接口时序图.png (84.3 KiB) Viewed 1033 times
The procedure of I2S interface is as follows:
=====================================================
void i2sInit()
{
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_TX),
.sample_rate = I2S_SAMPLE_RATE, // The format of the signal using ADC_BUILT_IN
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT, // is fixed at 12bit, stereo, MSB
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_PCM|I2S_COMM_FORMAT_PCM_SHORT),
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL3,
.dma_buf_count = 4,
.dma_buf_len = 1024,
.use_apll = true,
.tx_desc_auto_clear = false,
.fixed_mclk = 2048000
};
if(i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL)){

};
/////
i2s_pin_config_t i2s_pin_config0 = {
.bck_io_num = 13, /*!< BCK in out pin,if use mclk,only CAN USE GPIO0 GPIO1 GPIO3*/
.ws_io_num = 15, /*!< WS in out pin*/
.data_out_num = 12, /*!< DATA out pin*/
.data_in_num = 34 /*!< DATA in pin*/
};
i2s_set_pin(I2S_NUM_0, &i2s_pin_config0);
// delay(10);
// i2s_set_clk(I2S_NUM_0, I2S_SAMPLE_RATE, I2S_BITS_PER_SAMPLE_8BIT, I2S_CHANNEL_MONO );
//i2s_set_adc_mode(ADC_UNIT_1, ADC_INPUT);
//i2s_adc_enable(I2S_NUM_0);
}
===========================The problems encountered now are as follows:=============
1、W681512 data is 8 bits, but when bits_ per_ sample = I2S_ BITS_ PER_ SAMPLE_ At 8bit, MCLK has no output,and it has output at other config;
2、When use_ apll = true, . fixed_ MCLK = 2048000, the output frequency of MCLK is always 256khz, and the 2.048MHz signal cannot be output (currently, MCLK is configured in gpio13, but it is still configured in clkout pins, such as gpio0 and gpio3)
3、.communication_ No matter how configured, the SW output waveform can only be Figure 1 or figure 2, and the SW waveform of PCM as shown in Figure 3 can not be obtained
微信图片_20220415133221.jpg
sw
微信图片_20220415133221.jpg (336.01 KiB) Viewed 1033 times

Who is online

Users browsing this forum: Google [Bot] and 43 guests