I have an application that plays audio using I2S (I'm using the latest IDF on the master branch). It works, but I needed to dig into some details for my use case which requires audio synchronization and some of what I see in i2s.c makes no sense to me.
What I understand is that through i2s_drive_install, a series of buffers are created as well as a queue. The interrupt handler feeds the DMA with these buffers and every time it has consumed a buffer, it puts is to the queue.
When i2s_write is called, it looks at the current buffer and if it is full or none is available, it waits for one to be produced (as long as required by the tick_to_wait parameter).
Now, the logical behavior for an application is to be able to fill the set of buffer in a burst at the beginning and then call i2s_write with new data and be regulated by this call.
The problem I'm having is that the initialization code of i2s_driver_install or i2s_start does not queue ANY buffers to start with, so we start in a "full" position and a call to i2s_write will block on the queue waiting until the i2s handler produces ONE buffer (it's alos easy to verify by calling i2s_stop and trying i2s_write).
As a result, instead of being able to insert audio in a burst, we have to wait for the i2s DMA handler to insert AT LEAST one buffer in the queue and then we insert audio "at the pointy edge of real time". This is of course terrible for any application that does anything else than a busy loop calling i2s_write all the time. It very much negates the idea of a set of buffers.
Am I missing something or shouldn't all the buffers be inserted in the queue when the i2s_start is called? (or something similar)
I2S wrong buffering method
-
- Posts: 26
- Joined: Thu May 23, 2019 3:05 pm
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: Baidu [Spider], forrest and 139 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.