-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Second I2S on ESP32 non-working #7111
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
Comments
edit: The parameters of the function call only become valid after stepping once into the function, so what we see here is a GDB usage error on my side
Backtrace:
What I find strange is that there's the call arduino-esp32/libraries/I2S/src/I2S.cpp Line 298 in c93bf11
void setup() {
// put your setup code here, to run once:
Serial.begin(115200 /*500000*/);
Serial.println("BR 1");
while (!Serial.available()); Serial.read(); // ========== attached the debugger while waiting here
i2s_mode_t const m = I2S_PHILIPS_MODE;
uint32_t const sr = 16000;
uint8_t const bps = 24;
if (!I2S.begin(m, sr, bps)) { // ================== Here is where the debugger backtrace from this comment is from
Serial.println("[E] Failed to init I2S!");
while (1);
}
Serial.println("BR 2");
while (!Serial.available()); Serial.read();
I2S1.setBufferSize(128);
if (!I2S1.begin(m, sr, bps)) {
Serial.println("[E] Failed to init I2S1");
while (1);
}
Serial.println("STOP"); while(1);
} |
From the linker map:
From a backtrack:
Note that i2s_hal_config_param(&(pre_alloc_i2s_obj->hal), &pre_alloc_i2s_obj->hal_cfg); ... and ... i2s_obj_t *pre_alloc_i2s_obj = calloc(1, sizeof(i2s_obj_t)); ... therefore But they're inside ...
the data section ... |
Short note ... renaming |
I think I might have a lead: |
Ah yes, that makes sense as to why the input queue doesn't fill. Did you have the issue with |
No, different name seems to work. |
Please try out the changes in the mentioned PR #7117 I have renamed the second I2S to |
Board
ESP32 NodeMCU
Device Description
(irrelevant for issue)
Hardware Configuration
(irrelevant for issue)
Version
v2.0.4
IDE Name
Arduino IDE
Operating System
Windows 10
Flash frequency
80MHz
PSRAM enabled
no
Upload speed
921600
Description
When going to this part of the code
arduino-esp32/libraries/I2S/src/I2S.cpp
Line 156 in 3cb73dc
then it causes the value of
_bitsPerSample
to change to 0.This later causes this assertion to fail:
https://github.com/espressif/esp-idf/blob/1b16ef6cfc2479a08136782f9dc57effefa86f66/components/esp_ringbuf/ringbuf.c#L874
That part of the code is called from here:
arduino-esp32/libraries/I2S/src/I2S.cpp
Lines 297 to 298 in 3cb73dc
I attached a debugger (Segger J-Link via steps defined here, basically using USBDriverTool to change J-Link driver to WinUSB, then using
openocd -f interface/jlink.cfg -c "adapter_khz 1000" -f board/esp-wroom-32.cfg
, then connecting using gdb supplied in esp-idf 4.4.2) to get to the root of this, and got so far as to find out that the actual change seems to happen in this function:https://github.com/espressif/esp-idf/blob/1b16ef6cfc2479a08136782f9dc57effefa86f66/components/hal/esp32/include/hal/i2s_ll.h#L920-L930
(this shows L929 as offender, but that's strange to me, setting to 0 seems incorrect for this? https://github.com/espressif/esp-idf/blob/1b16ef6cfc2479a08136782f9dc57effefa86f66/components/hal/esp32/include/hal/i2s_ll.h#L929)
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: