Fix #10804 by running continuous ADC DMA in endless loop instead of restarting after each run (descriptor chain) to avoid losing samples. Use descriptor error callback for GDMA to check for DMA buffer overrun.

Signed-off-by: Armando <douyiwen@espressif.com>
This commit is contained in:
Niklas Gürtler
2023-05-25 10:11:22 +02:00
committed by Armando
parent f76f3dc83f
commit 5da5e1801b
4 changed files with 27 additions and 13 deletions

View File

@@ -380,17 +380,13 @@ static IRAM_ATTR bool s_adc_dma_intr(adc_digi_context_t *adc_digi_ctx)
}
ret = xRingbufferSendFromISR(adc_digi_ctx->ringbuf_hdl, finished_buffer, finished_size, &taskAwoken);
adc_hal_read_desc_finish (&adc_digi_ctx->hal);
if (ret == pdFALSE) {
//ringbuffer overflow
adc_digi_ctx->ringbuf_overflow_flag = 1;
}
}
if (status == ADC_HAL_DMA_DESC_NULL) {
//start next turns of dma operation
adc_hal_digi_start(&adc_digi_ctx->hal, adc_digi_ctx->rx_dma_buf);
}
return (taskAwoken == pdTRUE);
}