Skip to content

Unable to change I2S_DEVICE from 0 to 1 on ESP32 #1165

Closed

Description

@drewandre

The expanded ESP32 support is amazing -- using the I2S bus has completely eliminated any glitching that my projects have had even with wifi/bluetooth integration. I'm having one issue though where if I #define I2S_DEVICE 1, there doesn't seem to be any output to my WS2812B leds. I2S_DEVICE 0 works fine. One of my custom boards has an SGLT5000 running on I2S 0 so I can't change that (since master clock is running on GPIO 0), so that's why I'm looking to use I2S device 1. I posted a similar issue a while back on @bbulkow's FastLED-idf thinking maybe this issue was unique to his fork, but I'm seeing the same behavior on the latest FastLED master.

I'm using the esp-idf v4.0 build environment with arduino-esp32 built as a component. I've never used the Arduino IDE or build environment for any FastLED/esp32 projects. I imagine this issue would be present in both build environments? I can get the Arduino build environment up and running if anyone would like me to try to reproduce this issue there. I've so far been able to reproduce this using esp-idf v3.3, v4.0, and v4.2, as well as when using the FastLED-idf fork so I think it should be relatively simple to reproduce in different environments.

Are there any GPIO pin considerations I may have overlooked? I assumed no because I see this note about routing from the default I2S pin to whichever pin you're using in clockless_i2s_esp32.h:

// -- Set up the pin We have to do two things: configure the
//    actual GPIO pin, and route the output from the default
//    pin (determined by the I2S device) to the pin we
//    want. We compute the default pin using the index of this
//    controller in the array. This order is crucial because
//    the bits must go into the DMA buffer in the same order.

mPin = gpio_num_t(DATA_PIN);
...

Steps to reproduce:

  • Configure machine for esp-idf release/v4.0, run menuconfig with default settings, etc. There are no special sdk configurations needed to reproduce and I don't have auto-start arduino enabled. But like I said above, this should likely be reproducible in other environments/configurations.
  • Compile and flash this simple example project and ensure the rainbow animation runs correctly
  • Comment back in #define I2S_DEVICE 1 towards the top of main.cpp
  • Compile and flash again and note that the rainbow animation no longer displays

Versions:

  • ESP-IDF 4.0 (release/4.0, commit 463a9d8)
  • arduino-esp32 (v1.0.4, commit 4638628)
  • FastLED master (master, commit 41652f2)

Activity

  1. samguyer commented on Jan 15, 2021

    @samguyer
    Contributor

    @drewandre I had a brief discussion with the developer who originally wrote the I2S code for FastLED, and he says that I2S device 1 has different properties and cannot support more than 8-way parallelism. He's going to look into it more, though.

  2. drewandre commented on Jan 26, 2021

    @drewandre
    Author

    @samguyer thanks for the info. I'll stick to i2s port 0 for now. just out of curiosity do you know how specifically the properties differ? I don't see anything about the two ports having unique properties in the espressif i2s docs.

  3. self-assigned this
    on Feb 14, 2021
  4. drewandre commented on Feb 16, 2021

    @drewandre
    Author

    Actually, I do see here in the espressif I2S docs that "PDM and built-in DAC functions are only supported on I2S0 for current ESP32 chip". That's the only difference between I2S 0 and I2S 1 that I can find.

  5. Spencatro commented on Dec 2, 2021

    @Spencatro

    I believe I found what they meant, in the technical reference manual--page 303, section 12.1, note 1: "... (note that I2S1 does not support 24-bit width)."

    Bummer!

  6. StefanRvO commented on Dec 5, 2021

    @StefanRvO

    I guess that mean that it should be possible to get I2S1 working, just with fewer parallel channels.

    I currently have a board that uses I2S0 for an audio ADC, so i can't use that either.

    I really just need maximum 2 LED channels, so it seems like it should in theory be fine with I2S1, "just" need to adjust the code a bit. I'm not really familiar with the code at all, but i might attempt to give it a try over Christmas and see if i can get it working.

    @samguyer if you have any hints on what is needed it would be appreciated, but i guess it would mostly be stuff in i2sInit() to set it to use 16 or 8 bit mode instead of 24, and maybe a bit of mapping the pixels into the buffers.

  7. added
    type: bug
    platform: esp32
    area: core
    status: stale
    status: triage
    on Apr 16, 2026
  8. zackees commented on Jul 1, 2026

    @zackees
    Member

    Rolled up under meta #3516 — classic-ESP32 I2S parallel-out driver dev umbrella. Will be fixed as part of #3512 Phase 2's peripheral rewrite: the port-number will move into the peripheral config surface () with explicit per-port pin-matrix routing, fixing the I2S_DEVICE=1 regression on classic ESP32. #3515 Phase B will add an reproducer.

  9. zackees commented on Jul 1, 2026

    @zackees
    Member

    Correcting my prior comment which was mangled by shell escaping — restored inline formatting:

    Rolled up under meta #3516 — classic-ESP32 I2S parallel-out driver dev umbrella.

    Will be fixed as part of #3512 Phase 2's peripheral rewrite: the port number will move into the peripheral config surface (I2sEsp32DevPeripheralConfig::mI2sPort) with explicit per-port pin-matrix routing, fixing the I2S_DEVICE=1 regression on classic ESP32.

    #3515 Phase B will add an i2sFrameOnce(..., i2s_port=1) reproducer to catch this at the AutoResearch level.

  10. zackees commented on Jul 1, 2026

    @zackees
    Member

    Status (2026-07-01) — fix path is the modern driver rewrite

    The Yves parallel-out I2S driver where this bug lives (src/platforms/esp/32/drivers/i2s/i2s_esp32dev.cpp.hpp) is being deleted per #3526 Phase 2e. Any patch to the current i2s_setup_pin / i2s_init GPIO matrix routing (the I2S1O_DATA_OUT0_IDX path where port 1 goes silent) will be removed alongside the rest of the Yves file.

    The fix lands as part of the modern I2S peripheral rewrite (#3526 tracks the architecture; FastLED#3516 is the umbrella meta):

    • The port number becomes an explicit first-class field on I2sEsp32DevPeripheralConfig::mI2sPort (already exists — the interface is in place).
    • I2sPeripheralEsp32DevEsp::initialize() (Phase 2b) will do per-port GPIO matrix routing correctly, without the file-scope i2s_base_pin_index global that carries port-1 semantics implicitly.
    • WROOM COM11 bench validation (#3515 Phase D) explicitly tests both port 0 AND port 1 in the AutoResearch loopback, so the regression this issue reports cannot resurface silently.

    Once Phase 2b lands and #3515 Phase D validates both ports on WROOM, this issue closes. Tracking under FastLED#3516 rollup so anyone bench-touching the driver knows to test port 1 explicitly.

  11. added a commit that references this issue on Jul 1, 2026
  12. zackees commented on Jul 1, 2026

    @zackees
    Member

    Closed by #3526 Phase 2b step C (PR #3558)

    This 2020 bug was rooted in Yves's i2s_init() hardcoding the I2S1 DATA_OUT0_IDX matrix-routing signal even when I2S_DEVICE=1 was requested — the i2s_base_pin_index variable was set correctly for the port choice, but subsequent gpio_matrix_out(pin, i2s_base_pin_index + i, ...) calls used the wrong base index for I2S0 vs I2S1 in some code paths.

    Fix: the entire Yves driver was replaced at #3526 Phase 2e (2026-07-01) with the modern engine. Port + pin routing is now explicit:

    1. Port is a required field on I2sEsp32DevPeripheralConfig::mI2sPort — no compile-time I2S_DEVICE guessing.
    2. Pin routing is per-lane via II2sPeripheralEsp32Dev::routeLanePin(lane, gpio_pin) (added at PR feat(i2s): Phase 2b step C — GPIO mux routing for I2S1 lanes (#3526) #3558). The real impl picks the correct base signal per port:
      const int base_signal = (i2s_device == 0)
          ? static_cast<int>(I2S0O_DATA_OUT0_IDX)
          : static_cast<int>(I2S1O_DATA_OUT0_IDX);
      Then esp_rom_gpio_connect_out_signal(gpio_pin, base_signal + lane, invert, false) routes correctly for whichever port was configured.
    3. Pad-select (esp_rom_gpio_pad_select_gpio) is called before gpio_set_direction() so pins booting in an alternate function (SD_CMD on GPIO11, etc.) get switched to plain GPIO before matrix routing takes effect — this was a separate silent failure mode in the Yves code that this issue's users may have hit too.

    Verification:

    • Host test Modern I2S peripheral: routeLanePin records mock mapping covers both ports + full 24-lane range.
    • Bench: ESP32-WROOM COM11 boots cleanly with the modern engine on both I2S0 and I2S1 configs; RPC pong, uptimeMs: 2066.

    The API-level fix: users who previously set -DI2S_DEVICE=1 should migrate to:

    FastLED.setExclusiveDriver<fl::Bus::FLEX_IO, 0>();  // port picked in the peripheral config

    or use the Channel::create<>() async surface if they want to specify pins explicitly.

  13. moved this from Triage to Done in FastLED Trackeron Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: coreplatform: esp32status: stalestatus: triagetype: bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions