Chapter 2. API Reference
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• i2s_num: I2S port number
• dest: Destination address to read into
• size: Size of data in bytes
• [out] bytes_read: Number of bytes read, if timeout, bytes read will be less than the size
passed in.
• ticks_to_wait: RX buffer wait timeout in RTOS ticks. If this many ticks pass without bytes
becoming available in the DMA receive buffer, then the function will return (note that if data is read
from the DMA buffer in pieces, the overall operation may still take longer than this timeout.) Pass
portMAX_DELAY for no timeout.
esp_err_t i2s_set_sample_rates(i2s_port_t
Set sample rate used for I2S RX and TX.
The bit clock rate is determined by the sample rate and i2s_config_t configuration parameters (number of
channels, bits_per_sample).
bit_clock = rate * (number of channels) * bits_per_sample
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Parameter error
• ESP_ERR_NO_MEM Out of memory
Parameters
• i2s_num: I2S port number
• rate: I2S sample rate (ex: 8000, 44100...)
esp_err_t i2s_stop(i2s_port_t
Stop I2S driver.
There is no need to call i2s_stop() before calling i2s_driver_uninstall().
Disables I2S TX/RX, until i2s_start() is called.
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• i2s_num: I2S port number
esp_err_t i2s_start(i2s_port_t
Start I2S driver.
It is not necessary to call this function after i2s_driver_install() (it is started automatically), however it is
necessary to call it after i2s_stop().
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• i2s_num: I2S port number
esp_err_t i2s_zero_dma_buffer(i2s_port_t
Zero the contents of the TX DMA buffer.
Pushes zero-byte samples into the TX DMA buffer, until it is full.
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• i2s_num: I2S port number
Espressif Systems
i2s_num, uint32_t rate)
i2s_num)
i2s_num)
i2s_num)
301
Submit Document Feedback
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?