esp-idf: I2S mic not working since 4.4 (IDFGH-8138)
Answers checklist.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
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: https://github.com/espressif/arduino-esp32/issues/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
platform = espressif32
By changing it to this, it works as intended
platform = espressif32@5.0.0
Later we discovered this commit in arduino-esp32 repo is where it stops to work normally
platform = espressif32
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#666c66d3d1c7437aaebaaadf2084927b7fc476c4
Debug Logs.
No response
More Information.
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21
Commits related to this issue
- i2s: fixed incorrect channel format on ESP32 Closes: https://github.com/espressif/esp-idf/issues/9635 — committed to espressif/esp-idf by L-KAYA a year ago
The bug was found, the
rx_chan_modonv4.4is set to opposite value comparing tov5.0andv5.1Details
Concretely, the
rx_chan_modis actually related tomsdb_rightbit, meanwhilemsdb_rightis depended on thebits_per_sample. The correct relations are (ESP32 mono mode specific):The bug is that
rx_chan_modonv4.4didn’t takemsb_rightinto consideration, so that the left channel and the right channel are exchanged.Solution
The bug will be fixed in the next minor version, for now, you can try the following way to get a temporary fix.
Workaround
You can set to the opposite channel when using 32 bit-width data.
Or, force to update the register after i2s install:
Fix patch
You can also try the patch:
0001-i2s-fixed-incorrect-channel-format-on-ESP32.patch
@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?
It’s indeed a bug before, that
only_leftis actuallyonly_rightmeanwhileonly_rightis stillonly_right, but it has been fixed onrelease/4.4about 3 weeks ago.Have you checked which channel your mic actually sampling (i.e. left when
L/Rpin ofINMP441is pulled down and right when it is pulled up)?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 framework-espidf @ 3.40400.0 (4.4.0)
Not workingt: platform = https://github.com/tasmota/platform-espressif32 framework-espidf @ 3.40403.0 (4.4.3)
I am using the following I2S Config: ` i2s_config_t i2s_config_micro = { .mode = (i2s_mode_t) (I2S_MODE_MASTER | I2S_MODE_RX), .sample_rate = 16000,