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

Fix #10804 by running continuous ADC DMA in endless loop instead of restarting after each run to avoid losing samples (IDFGH-10140) #11411

Closed
wants to merge 1 commit into from

Conversation

Erlkoenig90
Copy link
Contributor

This fixes #10804 by running the ADC DMA in a continuous loop.

  • A function adc_hal_read_desc_finish is introduced to set a DMA descriptor's owner field to 1 such that it can be re-used by DMA.
  • A new DMA callback function on_descr_err is added for the DSCR_ERR interrput. The interrupt is only enabled if the callback is specified. The continuous ADC driver uses this to print an error to detect DMA buffer overruns.

…tead of restarting after each run (descriptor chain) to avoid losing samples. Implement descriptor error callback for GDMA and use it in continuous ADC to check for DMA buffer overrun.
@CLAassistant
Copy link

CLAassistant commented May 16, 2023

CLA assistant check
All committers have signed the CLA.

@espressif-bot espressif-bot added the Status: Opened Issue is new label May 16, 2023
@github-actions github-actions bot changed the title Fix #10804 by running continuous ADC DMA in endless loop instead of restarting after each run to avoid losing samples Fix #10804 by running continuous ADC DMA in endless loop instead of restarting after each run to avoid losing samples (IDFGH-10140) May 16, 2023
@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development and removed Status: Opened Issue is new labels May 16, 2023
@Icarus113
Copy link
Collaborator

Hi @Erlkoenig90 Thanks for your PR.

There was a code for the circular dma descriptors, internally. It's not merged yet.

The adc continuous mode driver is updated a bit. If you can:

  • port your changes (link list change, and the dma descriptor owner change) to current driver
  • decouple the gdma changes into another PR/issue

Then we can consider using this PR.

@Erlkoenig90
Copy link
Contributor Author

Hi, thanks for the answer. Do you mean porting the changes to master branch (instead of release/v5.0)?

@Icarus113
Copy link
Collaborator

Do you mean porting the changes to master branch (instead of release/v5.0)?

Yes, exactly.

Sorry for being misleading in my previous post.

@Erlkoenig90
Copy link
Contributor Author

Okay, I split the PR into #11499 for the descriptor error callback and #11500 for the ADC changes, both based on master. #11499 needs to be merge before #11500 to make the callback available.

@Icarus113
Copy link
Collaborator

As the splitted PRs are merged, close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants