Hi ESP_houwenxiang,
It is confirm that if I created the task with priority 23, the repeat buffer pointer problem is fixed.
Thank you.
I am facing another issue that I don't know if you have any suggestion.
If I have the wave file has the size of evenly divided by the size of the buffer_len, the i2s_write() function will be able to write everything to DMA, but if the file has the size that didn't evenly divided by the size of the buffer size, I experience the left over, and the partial left over will stay in the buffer till the next play time where the buffer is fully wrote by i2s_write() and it fully load the buffer.
For example, if I have buff_count = 2, and buffer_len = 1024 the file size to be played is 8407 bytes, it will way 1024x8 and the left over is 215 bytes. From my debug dump out, this 215 bytes is staying in the buffer till the next i2s_write() to be called.
Is there any way we can flush these 215 bytes out at the time we play the file?
What I do right now if the work around, when the function i2s_dac_data_scale() is called, if the length is less than the buffer size, I will pad them with zero to evenly fill the buffer.
Is there a correct way we should do this?
Thank you for your helps.
i2s_write losing data due to fail to return update pointer
-
- Posts: 48
- Joined: Thu Sep 12, 2019 11:39 am
-
- Posts: 118
- Joined: Tue Jun 26, 2018 3:09 am
Re: i2s_write losing data due to fail to return update pointer
Hi, chadpham75
Yes, your processing is correct, because the I2S driver does not automatically clear the buffer, the old data will be repeated unless you write new data.
Yes, your processing is correct, because the I2S driver does not automatically clear the buffer, the old data will be repeated unless you write new data.
wookooho
Who is online
Users browsing this forum: MicroController, snutw_ and 101 guests