You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "JianyuWang0623 (via GitHub)" <gi...@apache.org> on 2026/03/27 08:10:55 UTC

[PR] esp_i2s: fix ESP32-S3 I2S RX DMA and add ES7210 4-ch ADC codec driver [nuttx]

JianyuWang0623 opened a new pull request, #18622:
URL: https://github.com/apache/nuttx/pull/18622

   ## Summary
   
   Fix I2S RX DMA path on ESP32-S3 and add ES7210 4-channel ADC codec driver with board support for lckfb-szpi-esp32s3.
   
   This PR contains three commits:
   
   1. **esp_i2s: fix I2S RX DMA path for ESP32-S3** — Fix multiple bugs in the I2S RX receive path with GDMA, including streaming flag, interrupt re-enable after DMA load, TDM slot config preservation, RX channel count, DMA direction/peripheral ID, mono mode API, PCM slot config, and auto-stop when no pending buffers remain.
   
   2. **audio: add ES7210 4-ch ADC codec driver** — New audio lower-half driver for the ES7210 quad-channel ADC codec. Supports configurable sample rate, bit depth, and mic gain via I2C control + I2S data transport. Uses LPWORK for async buffer management. Key details: normal I2S mode (not TDM), PGA power-on bit in gain registers, 50ms startup delay for clock stabilization, and AUDIOIOC_STOP notification to I2S layer on stop.
   
   3. **boards/lckfb-szpi-esp32s3: add ES7210 board support** — Board-level integration including defconfig, board init, bringup wiring, header defines, and documentation. On this board, I2S0 is wired to dedicated codec chips (ES7210 ADC + ES8311 DAC), so generic `audio_i2s` device registration is skipped for I2S0 — each codec registers its own audio device directly.
   
   ## Impact
   
   - **I2S RX users on ESP32-S3**: The I2S RX DMA fixes are required for any RX recording use case on ESP32-S3 with GDMA. Without these fixes, RX recording hangs due to race conditions and misconfigured DMA parameters.
   - **New driver**: `CONFIG_AUDIO_ES7210` adds the ES7210 codec driver under `drivers/audio/`. No impact on existing drivers.
   - **Board config**: New `lckfb-szpi-esp32s3:es7210` defconfig. Existing board configs are not affected. The bringup.c change only affects I2S0 initialization when `CONFIG_AUDIO_ES7210` is enabled.
   - **Documentation**: Added ES7210 recording section to lckfb-szpi-esp32s3 board docs.
   
   ## Testing
   
   Host: Ubuntu Linux x86_64
   Board: LCKFB SZPI ESP32-S3 (N16R8) with on-board ES7210 (4-ch ADC) + ES8311 (DAC)
   Toolchain: ESP32-S3 xtensa-esp32s3-elf-gcc
   
   Build and flash:
   ```
   ./tools/configure.sh lckfb-szpi-esp32s3:es7210
   make -j8
   make flash ESPTOOL_PORT=/dev/ttyUSB0
   ```
   
   Recording test with nxrecorder (48kHz / 16-bit / 2ch):
   ```
   nsh> nxrecorder
   nxrecorder> recordraw /tmp/test.pcm 2 16 48000
   nxrecorder> stop
   ```
   
   Pull recorded file from device via ADB and convert to WAV:
   ```
   adb pull /tmp/test.pcm .
   sox -r 48000 -c 2 -b 16 -e signed-integer -t raw test.pcm test.wav
   ```
   
   Verified:
   - Recording starts without hang (previously froze due to I2S RX DMA bugs)
   - `nxrecorder stop` completes cleanly without deadlock
   - Recorded PCM data is valid audio (played back on host as WAV)
   - Multiple start/stop cycles work without resource leaks
   - Checkpatch passes on all 3 commits


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] esp_i2s: fix ESP32-S3 I2S RX DMA and add ES7210 4-ch ADC codec driver [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #18622:
URL: https://github.com/apache/nuttx/pull/18622


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] esp_i2s: fix ESP32-S3 I2S RX DMA and add ES7210 4-ch ADC codec driver [nuttx]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on PR #18622:
URL: https://github.com/apache/nuttx/pull/18622#issuecomment-4154753857

   Hi @JianyuWang0623 , https://github.com/apache/nuttx/pull/18614 was merged upstream. Can you please rebase it and update this PR? Let me know when we can test it ;)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] esp_i2s: fix ESP32-S3 I2S RX DMA and add ES7210 4-ch ADC codec driver [nuttx]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on PR #18622:
URL: https://github.com/apache/nuttx/pull/18622#issuecomment-4142443619

   Hi @JianyuWang0623 , thanks for your contribution.
   
   May I suggest halting it for a while until we merge https://github.com/apache/nuttx/pull/18614: there are a bunch of structural changes that may affect your PR. As soon as we merge it, I can help you fix it if necessary (you can try rebasing it on top of that PR), and we can test it internally with the HW in-the-loop as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] esp_i2s: fix ESP32-S3 I2S RX DMA and add ES7210 4-ch ADC codec driver [nuttx]

Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on PR #18622:
URL: https://github.com/apache/nuttx/pull/18622#issuecomment-4141706777

   Hi @JianyuWang0623 please fix
   
   ```
   ====================================================================================
   Configuration/Tool: esp32-devkitc/i2schar
   2026-03-27 09:49:36
   ------------------------------------------------------------------------------------
     Cleaning...
     Configuring...
     Building NuttX...
   common/espressif/esp_i2s.c: In function 'i2s_rxdma_start':
   Error: common/espressif/esp_i2s.c:940:10: error: variable 'eof_nbytes' set but not used [-Werror=unused-but-set-variable]
     940 |   size_t eof_nbytes;
         |          ^~~~~~~~~~
   In file included from common/espressif/esp_i2s.c:30:
   common/espressif/esp_i2s.c: In function 'i2s_receive':
   Error: common/espressif/esp_i2s.c:3071:15: error: format '%d' expects argument of type 'int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
    3071 |       i2sinfo("i2s_receive: nmaxbytes=%lu ch=%d dw=%d "
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ......
    3074 |               priv->channels, priv->data_width,
         |               ~~~~~~~~~~~~~~
         |                   |
         |                   uint32_t {aka long unsigned int}
   common/espressif/esp_i2s.c:3071:47: note: format string is defined here
    3071 |       i2sinfo("i2s_receive: nmaxbytes=%lu ch=%d dw=%d "
         |                                              ~^
         |                                               |
         |                                               int
         |                                              %ld
   Error: common/espressif/esp_i2s.c:3071:15: error: format '%d' expects argument of type 'int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
    3071 |       i2sinfo("i2s_receive: nmaxbytes=%lu ch=%d dw=%d "
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ......
    3074 |               priv->channels, priv->data_width,
         |                               ~~~~~~~~~~~~~~~~
         |                                   |
         |                                   uint32_t {aka long unsigned int}
   common/espressif/esp_i2s.c:3071:53: note: format string is defined here
    3071 |       i2sinfo("i2s_receive: nmaxbytes=%lu ch=%d dw=%d "
         |                                                    ~^
         |                                                     |
         |                                                     int
         |                                                    %ld
   cc1: all warnings being treated as errors
   make[1]: *** [Makefile:146: esp_i2s.o] Error 1
   make[1]: Target 'libarch.a' not remade because of errors.
   make: *** [tools/LibTargets.mk:170: arch/xtensa/src/libarch.a] Error 2
   make: Target 'all' not remade because of errors.
   /github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
     [1/1] Normalize esp32-devkitc/i2schar
   ====================================================================================
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] esp_i2s: fix ESP32-S3 I2S RX DMA and add ES7210 4-ch ADC codec driver [nuttx]

Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on PR #18622:
URL: https://github.com/apache/nuttx/pull/18622#issuecomment-4169662870

   @tmedicci @fdcavalcanti @eren-terzioglu, could you please test it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] esp_i2s: fix ESP32-S3 I2S RX DMA and add ES7210 4-ch ADC codec driver [nuttx]

Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on PR #18622:
URL: https://github.com/apache/nuttx/pull/18622#issuecomment-4162589018

   Hi @JianyuWang0623, this error has occurred
   
   ```
   ====================================================================================
   Configuration/Tool: esp32s2-kaluga-1/audio
   2026-03-31 11:12:28
   ------------------------------------------------------------------------------------
     Cleaning...
     Configuring...
     Building NuttX...
   Error: common/espressif/esp_i2s.c:293:9: error: "MIN" redefined [-Werror]
     293 | #define MIN(x,y) ((x)<(y)?(x):(y))
         |         ^~~
   In file included from common/espressif/esp_i2s.c:29:
   /github/workspace/sources/nuttx/include/sys/param.h:41:11: note: this is the location of the previous definition
      41 | #  define MIN(a,b)      (((a) < (b)) ? (a) : (b))
         |           ^~~
   cc1: all warnings being treated as errors
   make[1]: *** [Makefile:146: esp_i2s.o] Error 1
   make[1]: Target 'libarch.a' not remade because of errors.
   make: *** [tools/LibTargets.mk:170: arch/xtensa/src/libarch.a] Error 2
   make: Target 'all' not remade because of errors.
   /github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
     [1/1] Normalize esp32s2-kaluga-1/audio
   ====================================================================================
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] esp_i2s: fix ESP32-S3 I2S RX DMA and add ES7210 4-ch ADC codec driver [nuttx]

Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on PR #18622:
URL: https://github.com/apache/nuttx/pull/18622#issuecomment-4142402137

   unrelated error
   ```
   ====================================================================================
   Configuration/Tool: qemu-armv7a/knsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI
   2026-03-27 12:40:59
   ------------------------------------------------------------------------------------
     Cleaning...
     Configuring...
     Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
     Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
     Building NuttX...
   arm-none-eabi-ld: warning: /github/workspace/sources/nuttx/nuttx has a LOAD segment with RWX permissions
   MK: Notice: No header files found in /github/workspace/sources/nuttx/arch/arm/src
   /github/workspace/sources/apps /github/workspace/sources/nuttx
   Warning: fpu.c:57:8: warning: #warning "FPU test not built; Only available in the flat build (CONFIG_BUILD_FLAT)" [-Wcpp]
      57 | #      warning "FPU test not built; Only available in the flat build (CONFIG_BUILD_FLAT)"
         |        ^~~~~~~
   /github/workspace/sources/nuttx
     [1/1] Normalize qemu-armv7a/knsh
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org