-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2S mic not working since 4.4 (IDFGH-8138) #9635
Comments
Thanks for raising this, I am having the same issue - also with Tasmota image: It seems to have stopped between 4.4.0 and 4.4.3 Working: platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.3/platform-espressif32-2.0.2.3.zip Not workingt: platform = https://github.com/tasmota/platform-espressif32 I am using the following I2S Config:
|
I've tried on the latest release/v4.4 branch, it works well now, this bug( |
How do I test for a specific commit of the IDF?
If yes, it does not work for me. I receive only NaN values from the mic. |
Maybe you can try
|
I believe you meant this?
because your suggestion was not building. And, still no luck: NaN values. |
I ran that example directly on IDF #include <stdio.h>
#include "driver/i2s.h"
// you shouldn't need to change these settings
#define SAMPLE_BUFFER_SIZE 512
#define SAMPLE_RATE 8000
// most microphones will probably default to left channel but you may need to tie the L/R pin low
#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_ONLY_LEFT
// either wire your microphone to the same pins or change these to match your wiring
#define I2S_MIC_SERIAL_CLOCK GPIO_NUM_32
#define I2S_MIC_LEFT_RIGHT_CLOCK GPIO_NUM_25
#define I2S_MIC_SERIAL_DATA GPIO_NUM_33
// don't mess around with this
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX),
.sample_rate = SAMPLE_RATE,
.bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT,
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 4,
.dma_buf_len = 1024,
.use_apll = false,
.tx_desc_auto_clear = false,
.fixed_mclk = 0
};
// and don't mess around with this
i2s_pin_config_t i2s_mic_pins = {
.bck_io_num = I2S_MIC_SERIAL_CLOCK,
.ws_io_num = I2S_MIC_LEFT_RIGHT_CLOCK,
.data_out_num = I2S_PIN_NO_CHANGE,
.data_in_num = I2S_MIC_SERIAL_DATA
};
void setup(void)
{
// start up the I2S peripheral
i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
i2s_set_pin(I2S_NUM_0, &i2s_mic_pins);
}
int32_t raw_samples[SAMPLE_BUFFER_SIZE] = {0};
void loop(void)
{
// read from the I2S device
size_t bytes_read = 0;
i2s_read(I2S_NUM_0, raw_samples, sizeof(int32_t) * SAMPLE_BUFFER_SIZE, &bytes_read, portMAX_DELAY);
int samples_read = bytes_read / sizeof(int32_t);
// dump the samples out to the serial channel.
for (int i = 0; i < samples_read; i++) {
printf("%d ", raw_samples[i]);
}
printf("\n");
}
void app_main(void)
{
setup();
while (1) {
loop();
vTaskDelay(pdMS_TO_TICKS(500));
}
} The code ran as expected for me, maybe you can take a try as well. If it works, we can just waiting for the release of v4.4.3 |
I tried your sample code, it does not work with my INMP441 mic. |
Have you tried to use |
Interesting, |
It's indeed a bug before, that Have you checked which channel your mic actually sampling (i.e. left when |
Got it, but if it has been fixed on Not too sure about which channel is it using, I tried to pull |
Weird, have you updated to the latest |
Yes like so:
And it does not work. I mean, it works only if I use |
@MikeBailleul You can try
i use a very actual IDF commit. The mentioned commit is there. |
So I can confirm that on Specifically: Separately I have a custom board with an ESP32 connected to an I2S ADC programmed to only output on the left channel. This also does not work on I can temporarily use the wrong |
@L-KAYA Are there any updates on this? As stated the workaround is rather simple but it would be ideal to have this fixed. Anything else we can test? |
I had the same issue. Thank you for the hint. |
Appologize for the late reply! I'll take further test this week, if there is any workaround or patch, I'll post here for preview |
@L-KAYA Thank you for tracking down the fix! I will await v4.4.5 (v4.5?) for our project as the using the opposite channel is simple enough currently. |
Answers checklist.
IDF version.
v4.4
Operating System used.
macOS
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
No response
Development Kit.
ESP32 Dev Module
Power Supply used.
USB
What is the expected behavior?
Using this sketch: https://github.com/atomic14/esp32-i2s-mic-test/blob/main/i2s_mic_test/i2s_mic_test.ino
With a INMP441 configured as follow:
WS -> 25
SCK -> 32
SD -> 33
L/R -> GND
GND -> GND
VDD -> 3.3V
It should output values of the sound received by the mic.
What is the actual behavior?
Only 0 values
Steps to reproduce.
I originally submitted an issue here: espressif/arduino-esp32#7177
But I was redirected to esp-idf since it appears to be related to it.
A brief summary:
In platformio.ini, this does NOT work because it is using the latest release of arduino-esp32
By changing it to this, it works as intended
Later we discovered this commit in arduino-esp32 repo is where it stops to work normally
Debug Logs.
No response
More Information.
No response
The text was updated successfully, but these errors were encountered: