← index #8527PR #7183
Related · high · value 2.068
QUERY · ISSUE

ESP32: Support I2S-driven ADC sampling

openby oclykeopened 2022-04-13updated 2024-07-24
port-esp32

The ESP32 I2S peripheral supports an interesting feature: it can be used to push ADC samples into DMA memory. Currently the ESP32 I2S interface does not allow configuration of the peripheral in this way, though it would only require a little effort.

There is not much configuration available. Besides sample rate and number of bits (already included in the I2S module)

  • which ADC peripheral to use
  • which ADC channel to use

Proposal:

  • create a class similar to the I2S class called I2SADC for the ESP32 port
  • leverage most of the existing code (machine_i2s_init_helper) for initialization of this new class

Any thoughts? I really would like to see support for this and so will begin work on a PR asap.

CANDIDATE · PULL REQUEST

esp32,stm32/i2s: I2S protocol support for Pyboards and ESP32.

closedby miketeachmanopened 2021-04-29updated 2021-08-21
port-stm32port-esp32

This PR adds I2S protocol support for STM32 and ESP32 ports:

  • consistent I2S API across the STM32 and ESP32 ports
  • I2S configurations supported:
    • master transmit and master receive
    • 16-bit and 32-bit sample sizes
    • mono and stereo formats
    • specify sampling frequency
    • 3 modes of operation:
      • blocking
      • non-blocking with callback
      • uasyncio
    • specify internal ring buffer size
  • MicroPython documentation for Pyboards and ESP32
  • new uasyncio Stream class method "readinto()"
  • tested on the following development boards:
    • Pyboard D SF2W
    • Pyboard V1.1
    • ESP32 with SPIRAM
    • ESP32
  • builds on the STM32 work of blmorris:
    • https://github.com/micropython/micropython/pull/1361
  • I2S examples repo to support this PR:
    • https://github.com/miketeachman/micropython-i2s-examples
  • this PR obsoletes an ESP32-specific I2S PR:
    • https://github.com/micropython/micropython/pull/4471
  • pybv1.0 metric changes wrt master: text(+5592), data(0), bss(+8)
  • esp32 metric changes wrt master: text(+11228), data(+2832), bss(+24)

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied