- #define CONFIG_I2S_CH I2S_NUM_0
- #define CONFIG_SAMPLE_RATE 48000
- #define CONFIG_BIT_SAMPLE 32 //bits
- #define SAMPLE_T int32_t
- #define CONFIG_SAMPLES_SHORT (CONFIG_SAMPLE_RATE / 8) // ~125ms 6000
- #define CONFIG_SAMPLE_T int32_t
- #define CONFIG_SAMPLES_LEQ (CONFIG_SAMPLE_RATE * LEQ_PERIOD)
- #define CONFIG_DMA_BANK_SIZE (CONFIG_SAMPLES_SHORT / 16) //375
- #define CONFIG_DMA_BANKS 32
- #define CONFIG_I2S_WS_GPIO 4
- #define CONFIG_I2S_CLK_GPIO 5
- #define CONFIG_I2S_SD 13
- extern "C" void init_microphone(void)
- {
- // Set the I2S configuration as PDM and 32bits per sample
- i2s_config_t i2s_config = {
- mode :i2s_mode_t(I2S_MODE_MASTER| I2S_MODE_RX),
- .sample_rate = CONFIG_SAMPLE_RATE,
- .bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT,
- .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
- communication_format: i2s_comm_format_t(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
- .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
- .dma_buf_count = CONFIG_DMA_BANKS,
- .dma_buf_len = CONFIG_DMA_BANK_SIZE,
- .use_apll = 0,
- tx_desc_auto_clear: true,
- fixed_mclk: 0,
- };
- // Set the pinout configuration (set using menuconfig)
- i2s_pin_config_t pin_config = {
- .bck_io_num = CONFIG_I2S_CLK_GPIO,
- .ws_io_num = CONFIG_I2S_WS_GPIO,
- .data_out_num = I2S_PIN_NO_CHANGE,
- .data_in_num = CONFIG_I2S_SD,
- };
- // Call driver installation function before any I2S R/W operation.
- ESP_ERROR_CHECK( i2s_driver_install(CONFIG_I2S_CH, &i2s_config, 0, NULL) );
- ESP_ERROR_CHECK( i2s_set_pin(CONFIG_I2S_CH, &pin_config) );
- ESP_ERROR_CHECK( i2s_set_clk(CONFIG_I2S_CH, CONFIG_SAMPLE_RATE, I2S_BITS_PER_SAMPLE_32BIT, I2S_CHANNEL_MONO) );
- }
ESP32-S3 I2S APLL无法启用
Moderator: ESP_Bob
ESP32-S3 I2S APLL无法启用
想请教大家一下ESP32-S3在APLL 无法启用的情况下该如何正确配置I2S总线上的MEMS麦克风的参数,比如i2s_config 和i2s_set_clk。下面是我自己的代码但是无法正确运行。非常感谢!
Re: ESP32-S3 I2S APLL无法启用
因为我不是很会配置sck和ws和ESP32的采样频率这些参数,然后就想用APLL会省事一些。我也参考了一些ESP32的库也是用的APLL,比如这个: https://github.com/ikostoski/esp32-i2s- ... 2s-slm.ino
Re: ESP32-S3 I2S APLL无法启用
<r>问题解决了,是我自己硬件线路接错了。。。抱歉占用了站里的资源
<CODEBOX codebox="c" file="Untitled.c"><s></e></CODEBOX></r>
<CODEBOX codebox="c" file="Untitled.c"><s>
- </s>
- extern "C" void init_microphone(void)<br/>
- {<br/>
- <br/>
- i2s_config_t i2s_config = {<br/>
- <br/>
- mode :i2s_mode_t(I2S_MODE_MASTER| I2S_MODE_RX),<br/>
- .sample_rate = CONFIG_SAMPLE_RATE,<br/>
- .bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT,<br/>
- .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,<br/>
- .communication_format = I2S_COMM_FORMAT_STAND_I2S,<br/>
- .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,<br/>
- .dma_buf_count = CONFIG_DMA_BANKS,<br/>
- .dma_buf_len = CONFIG_DMA_BANK_SIZE,<br/>
- .use_apll = 1,<br/>
- tx_desc_auto_clear: true,<br/>
- .fixed_mclk = 0,<br/>
- };<br/>
- <br/>
- // Set the pinout configuration<br/>
- i2s_pin_config_t pin_config = {<br/>
- <br/>
- .bck_io_num = CONFIG_I2S_CLK_GPIO,<br/>
- .ws_io_num = CONFIG_I2S_WS_GPIO,<br/>
- .data_out_num = I2S_PIN_NO_CHANGE,<br/>
- .data_in_num = CONFIG_I2S_SD,<br/>
- };<br/>
- <br/>
- <br/>
- // Call driver installation function before any I2S R/W operation.<br/>
- <br/>
- ESP_ERROR_CHECK( i2s_driver_install(CONFIG_I2S_CH, &i2s_config, 0, NULL) );<br/>
- ESP_ERROR_CHECK( i2s_set_pin(CONFIG_I2S_CH, &pin_config) );<e>
Re: ESP32-S3 I2S APLL无法启用
ESP32-S3没有APLL吧,数据手册里都写了没有APLL,
Who is online
Users browsing this forum: No registered users and 60 guests