8000 I2S failed to set up tx callback · Issue #11004 · espressif/arduino-esp32 · GitHub
[go: up one dir, main page]

Skip to content

I2S failed to set up tx callback #11004

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

Closed
1 task done
copych opened this issue Feb 23, 2025 · 9 comments · Fixed by espressif/esp32-arduino-lib-builder#284
Closed
1 task done

I2S failed to set up tx callback #11004

copych opened this issue Feb 23, 2025 · 9 comments · Fixed by espressif/esp32-arduino-lib-builder#284
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@copych
Copy link
copych commented Feb 23, 2025

Board

ESP32S3 (LOLIN S3 PRO)

Device Description

LOLIN S3 PRO has just one native USB (OTG), no uart chip. it has 8MB PSRAM and 16MB flash.
Just the board and i2s DAC.

Hardware Configuration

GPIOs 5(BIT), 6(DAT) and 7(WS) are used to connect I2S DAC PCM5102.

Version

v3.1.3

IDE Name

Arduino IDE 2.3.4

Operating System

Windows 10

Flash frequency

40MHz

PSRAM enabled

yes

Upload speed

921600

Description

I2S doesn't work

Sketch

#define I2S_BCLK_PIN    5       // I2S BIT CLOCK pin (BCL BCK CLK)
#define I2S_DOUT_PIN    6       // to I2S DATA IN pin (DIN D DAT) 
#define I2S_WCLK_PIN    7       // I2S WORD CLOCK pin (WCK WCL LCK)
const i2s_port_t i2s_num = I2S_NUM_0; // i2s port number

I2SClass I2S;

void i2sInit() {
  pinMode(I2S_BCLK_PIN, OUTPUT);
  pinMode(I2S_DOUT_PIN, OUTPUT);
  pinMode(I2S_WCLK_PIN, OUTPUT);

  I2S.setPins(I2S_BCLK_PIN, I2S_WCLK_PIN, I2S_DOUT_PIN); //SCK, WS, SDOUT, SDIN, MCLK
  I2S.begin(I2S_MODE_STD, SAMPLE_RATE, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO);
}

Debug Message

E (2005) gdma: gdma_register_tx_event_callbacks(464): user context not in internal RAM
E (2005) i2s_common: i2s_init_dma_intr(734): Register tx callback failed
E (2008) i2s_std: i2s_channel_init_std_mode(236): initialize dma interrupt failed
E (8983) i2s_common: i2s_channel_write(1211): The channel is not enabled
E (9983) i2s_common: i2s_channel_write(1211): The channel is not enabled
E (10983) i2s_common: i2s_channel_write(1211): The channel is not enabled

Other Steps to Reproduce

it was working with cores up to v.3.1.1 inclusively, v.3.1.2 introduced this bug. This issue can be reproduced on other ESP32S3 boards.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@cniedzi
Copy link
cniedzi commented Feb 23, 2025

See also: schreibfaul1/ESP32-audioI2S#975

@schreibfaul1
Copy link

The error is easy to reproduce.
An ESP32-S3 board with PSRAM without external wiring is sufficient.

#include "Arduino.h"
#include "esp_err.h"
#include "ESP_I2S.h"

#define I2S_BCLK_PIN    5       // I2S BIT CLOCK pin (BCL BCK CLK)
#define I2S_DOUT_PIN    6       // to I2S DATA IN pin (DIN D DAT) 
#define I2S_WCLK_PIN    7       // I2S WORD CLOCK pin (WCK WCL LCK)
const i2s_port_t i2s_num = I2S_NUM_0; // i2s port number
#define SAMPLE_RATE 48000
I2SClass I2S;

void setup(){
  pinMode(I2S_BCLK_PIN, OUTPUT);
  pinMode(I2S_DOUT_PIN, OUTPUT);
  pinMode(I2S_WCLK_PIN, OUTPUT);

  I2S.setPins(I2S_BCLK_PIN, I2S_WCLK_PIN, I2S_DOUT_PIN); //SCK, WS, SDOUT, SDIN, MCLK
  esp_err_t err = I2S.begin(I2S_MODE_STD, SAMPLE_RATE, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO);
}

void loop(){
}

It is important that the PSRAM is activated.
The programme runs without errors up to Arduino version 3.1.1.

This error occurs in Arduino V3.1.2:

Image

and also in Arduino V3.1.3 and 3.2.0-RC1

@me-no-dev
Copy link
Member

Fix incoming: espressif/esp32-arduino-lib-builder#284
Will also report to ESP-IDF

@cniedzi
Copy link
cniedzi commented Mar 7, 2025

@me-no-dev Do you know in which ESP32-Arduino core this fix will be implemented?

@me-no-dev
Copy link
Member

3.2.0-RC2

@cniedzi
Copy link
cniedzi commented Mar 7, 2025

3.2.0-RC2

Thx. Great !!!

@JetForMe
Copy link
JetForMe commented Mar 11, 2025

Will also report to ESP-IDF

Seems I2S should check to see if CONFIG_GDMA_ISR_IRAM_SAFE is set, right? It's not clear to me how it can work if CONFIG_GDMA_ISR_IRAM_SAFE is set but CONFIG_I2S_ISR_IRAM_SAFE is not. Or at least the GDMA callback context I2S allocates should be based on CONFIG_GDMA_ISR_IRAM_SAFE, not CONFIG_I2S_ISR_IRAM_SAFE.

@me-no-dev
Copy link
Member

Neither should need to be set for the driver to work. The problem is that default config with PSRAM is failing

@JetForMe
Copy link

Neither should need to be set for the driver to work. The problem is that default config with PSRAM is failing

It's likely I misunderstood, but looking at the code, the GDMA callback registration function checks to see if the supplied context parameter is in internal RAM when CONFIG_GDMA_ISR_IRAM_SAFE is set. But I2S doesn't allocate that context in internal RAM unless CONFIG_I2S_ISR_IRAM_SAFE is set. So you have two different build settings that must be set together (or rather, if CONFIG_GDMA_ISR_IRAM_SAFE is set, then CONFIG_I2S_ISR_IRAM_SAFE must also be set).

If I2S looked at CONFIG_GDMA_ISR_IRAM_SAFE strictly for the purposes of allocating the channel structure (what it passes as context to GDMA), I think it would be more robust to various configurations. It can still base its own callback checks on CONFIG_I2S_ISR_IRAM_SAFE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
0