Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TW#19859] Zero i2s dma buffer after write, so we have silence after buffer underflow #1789

Closed
ghost opened this issue Mar 29, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 29, 2018

See also: earlephilhower/ESP8266Audio#48

If a ets_memset(finish_desc->buf, 0, finish_desc->buf_size);
is added before

xQueueSendFromISR(p_i2s->tx->queue, (void*)(&finish_desc->buf), &high_priority_task_awoken);

It would give us silence when a i2s buffer underflow happens, instead of the looping noise we get now :)

@FayeY FayeY changed the title Zero i2s dma buffer after write, so we have silence after buffer underflow [TW#19859] Zero i2s dma buffer after write, so we have silence after buffer underflow Apr 4, 2018
@jeanthom
Copy link

I guess that some code has been changed in esp-idf (ets_memset() doesn't exist anymore, finish_desc's buf_size element has been renamed to size), therefore the correct fix would be this :

memset(finish_desc->buf, 0, finish_desc->size);

@h3ndrik
Copy link
Contributor

h3ndrik commented Jul 12, 2018

this doesn't result in a compiler-warning:
memset((void*)(finish_desc->buf), 0, finish_desc->size);

but is that correct? does it zero all the dma buffers? i still have problems with earlephilhower/ESP8266Audio#48 even with this patch.
but that is probably another bug on my side.

@igrr igrr closed this as completed in 765bf67 Nov 28, 2018
igrr pushed a commit that referenced this issue Jan 7, 2019
It has been observed that, in case of underflow (data unavailability) in
I2S transmission, previously filled up tx descriptors continue to get
transmitted on line, causing noise in case of audio use case.

This change adds optional `tx_desc_auto_clear` field during I2S driver intialization
than can zero initialize tx descriptor in case of underflow situation in
interrupt handler itself.

Closes: #1789
(cherry picked from commit 765bf67)
catalinio pushed a commit to catalinio/pycom-esp-idf that referenced this issue Jun 28, 2019
It has been observed that, in case of underflow (data unavailability) in
I2S transmission, previously filled up tx descriptors continue to get
transmitted on line, causing noise in case of audio use case.

This change adds optional `tx_desc_auto_clear` field during I2S driver intialization
than can zero initialize tx descriptor in case of underflow situation in
interrupt handler itself.

Closes: espressif/esp-idf#1789
(cherry picked from commit 765bf67)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants